//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> same_section_flag_combine_list1 = new() { new (){11, 13, 15, 17}, new (){12, 14, 16 ,18}, }; List> same_section_flag_combine_list2 = new() { new (){21, 22, 23, 24}, new (){25, 26, 27 }, }; var must_close_flag_list=new List() { 25, 26, 27 , 21, 22, 23, 24 }; var combine=new List() { 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> same_section_flag_combine_list, int pumpCount) //{ // Dictionary> dict = new(); // for (int pump_count = 2; pump_count <= pumpCount; pump_count++) // { // dict[pump_count] = new List(); // 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 GetCombine(List flags,int count) //{ // var combine = IStation.Curve.PermutationAndCombination.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.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.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.GetCombination(same_section_flag1.ToArray(), 3); // part1.ForEach(x => Console.WriteLine(IntListHelper.ToString(x))); // var part2 = IStation.Curve.PermutationAndCombination.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();