Shuxia Ning
2024-07-17 fd681339c81201ed6fb3303647ecab89e3e6c0c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
//var chConfig = ScheduleConfigHelper.Create();  
//var bol=new IStation.Service.ScheduleConfig().Save(chConfig); 
//Console.WriteLine(bol);
 
using Yw.Untity;
using static System.Net.Mime.MediaTypeNames;
 
var station=new IStation.Service.Station().Get(); 
var helper = new IStation.Algorithm.ScheduleHelper();
 
 
 
 
List<List<int>> same_section_flag_combine_list1 = new()
{
    new (){11, 13, 15, 17},
    new (){12, 14, 16 ,18},
};
 
 
List<List<int>> same_section_flag_combine_list2 = new()
{
    new (){21, 22, 23, 24},
    new (){25, 26, 27 },
};
 
 
var must_close_flag_list=new List<int>() { 25, 26, 27 , 21, 22, 23, 24 };
var combine=new List<int>() { 25, 26, 27, 21, 22, 23 };
 
var difC = Math.Abs(combine.Count - must_close_flag_list.Count);
 
 
var c1 = combine.Intersect(must_close_flag_list).Count() ;
 
var count = combine.Except(must_close_flag_list).Count();
var count2 = must_close_flag_list.Except(combine).Count();
var count3 = must_close_flag_list.Except(combine).Count();
if (count == difC)
{
 
}
 
 
//var same_section_flag1 = same_section_flag_combine_list[0];
//var same_section_flag2 = same_section_flag_combine_list[1];
 
 
//var same_section_flag_remark1 = IntListHelper.ToString(same_section_flag1);
//var same_section_flag_remark2 = IntListHelper.ToString(same_section_flag2);
 
//var pumps = station.S1; 
//var pump_flag_list = pumps.Select(x => x.Flag).ToList(); 
 
//var minCombineCount = same_section_flag_combine_list.Min(x => x.Count);
//var maxCombineCount = same_section_flag_combine_list.Max(x=>x.Count);
 
 
//Test(same_section_flag_combine_list1, 8);
//Console.WriteLine($">>>>>>>>>>>>>>>>>>>"); 
//Console.WriteLine($">>>>>>>>>>>>>>>>>>>"); 
//Console.WriteLine($">>>>>>>>>>>>>>>>>>>");
 
//Test(same_section_flag_combine_list2, 7);
 
//void Test(List<List<int >> same_section_flag_combine_list, int pumpCount)
//{ 
//    Dictionary<int, List<int[]>> dict = new();
//    for (int pump_count = 2; pump_count <= pumpCount; pump_count++)
//    {
//        dict[pump_count] = new List<int[]>();
//        if (pump_count == 2)
//        {
//            foreach (var same_section in same_section_flag_combine_list)
//            {
//                var combine = GetCombine(same_section, 2);
//                dict[pump_count].AddRange(combine);
//            }
//        }
//        else if (pump_count == 3)
//        {
//            foreach (var same_section in same_section_flag_combine_list)
//            {
//                var combine = GetCombine(same_section, 3);
//                dict[pump_count].AddRange(combine);
//            }
//        }
//        else if (pump_count == 4)
//        {
//            foreach (var same_section in same_section_flag_combine_list)
//            {
//                var combine3 = GetCombine(same_section, 3);
//                dict[pump_count].AddRange(combine3);
//                if (same_section.Count > 3)
//                {
//                    var combine4 = GetCombine(same_section, 4);
//                    dict[pump_count].AddRange(combine4);
//                }
//            }
//        }
//        else if (pump_count == 5)
//        {
//            foreach (var same_section in same_section_flag_combine_list)
//            {
//                if (same_section.Count > 3)
//                {
//                    var combine4 = GetCombine(same_section, 4);
//                    dict[pump_count].AddRange(combine4);
//                }
//            }
//        }
//        else if (pump_count == 6)
//        {
//            foreach (var same_section in same_section_flag_combine_list)
//            {
//                if (same_section.Count > 3)
//                {
//                    var combine4 = GetCombine(same_section, 4);
//                    dict[pump_count].AddRange(combine4);
//                }
//            }
//        }
 
//    }
 
 
//    foreach (var item in dict)
//    {
//        Console.WriteLine($">>>>>>>>>>>>>>>>>>>{item.Key}");
//        foreach (var value in item.Value)
//        {
//            Console.WriteLine(IntListHelper.ToString(value));
//        }
//    }
//}
 
//List<int[]> GetCombine(List<int> flags,int count)
//{
//    var combine = IStation.Curve.PermutationAndCombination<int>.GetCombination(flags.ToArray(), count); 
//    return combine;
//}
 
 
//Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>");
//Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>");
 
 
 
//for (int pumpCount = 2; pumpCount <= pumps.Count; pumpCount++)
//{
 
//    switch (pumpCount)
//    {
//        case 1:
//            {
//                Console.WriteLine("----1----");
//            }
//            break;
//        case 2:
//            {
//                Console.WriteLine("----2----");
//                var combine_list = IStation.Curve.PermutationAndCombination<int>.GetCombination(pump_flag_list.ToArray(), pumpCount);//排列组合 
//                foreach (var combine in combine_list)
//                {
//                    var combine_remark = IntListHelper.ToString(combine.OrderBy(x => x));
//                    if (same_section_flag_remark1.Contains(combine_remark))
//                    {
//                        Console.WriteLine(combine_remark);
//                        continue;
//                    }
//                    if (same_section_flag_remark2.Contains(combine_remark))
//                    {
//                        Console.WriteLine(combine_remark);
//                        continue;
//                    }
//                }
//            }
//            break;
//        case 3:
//            {
//                Console.WriteLine("----3----");
//                var combine_list = IStation.Curve.PermutationAndCombination<int>.GetCombination(pump_flag_list.ToArray(), pumpCount);//排列组合 
//                foreach (var combine in combine_list)
//                {
//                    var combine_remark = IntListHelper.ToString(combine.OrderBy(x => x));
//                    if (same_section_flag_remark1.Contains(combine_remark))
//                    {
//                        Console.WriteLine(combine_remark);
//                        continue;
//                    }
//                    if (same_section_flag_remark2.Contains(combine_remark))
//                    {
//                        Console.WriteLine(combine_remark);
//                        continue;
//                    }
//                }
//            }
//            break;
//        case 4:
//            {
//                Console.WriteLine("----4----");
//                var part1 = IStation.Curve.PermutationAndCombination<int>.GetCombination(same_section_flag1.ToArray(), 3);
//                part1.ForEach(x => Console.WriteLine(IntListHelper.ToString(x)));
//                var part2 = IStation.Curve.PermutationAndCombination<int>.GetCombination(same_section_flag2.ToArray(), 3);
//                part2.ForEach(x => Console.WriteLine(IntListHelper.ToString(x)));
//                Console.WriteLine(same_section_flag_remark1);
//                Console.WriteLine(same_section_flag_remark2);
//            }
//            break;
//        case 5:
//            {
 
//            }
//            break;
//        case 6:
//            {
 
//            }
//            break;
//        default:
//            {
 
//            }
//            break;
//    }
 
//}
 
 
Console.ReadKey();