private static bool ComputeBestof3Sol(string nomep) { //int i_sol = 3; int i_sol = 1; int i, j; TimeSpan timeelapsed = new TimeSpan(); //uint[] setN = {1000, 3000, 5000}; uint[] setN = { 1000 }; //uint[] setN = { 100, 500, 1000, 3000, 5000, 10000, 15000, 20000 }; uint setpofsol; //double MaxIterSec = 60 * 5; // 5 min; double MaxIterSec = 0.0; pmed.Seed = 1657; pmed.MaxIterSecond = MaxIterSec; swBatchOut.WriteLine("\r\nSeed = {0}", pmed.Seed); uint bestsol = int.MaxValue; bool isbestwrap = false; for (j = 0; j < setN.Length; j++) { Console.WriteLine("preparing computation {0} ...", setN[j]); pmed.SetSolutions(setN[j]); setpofsol = 0; //swBatchOut.WriteLine("Computing with {0} sols", setN[j]); bestsol = int.MaxValue; isbestwrap = false; timeelapsed = new TimeSpan(); for (i = 0; i < i_sol; i++) { Console.WriteLine("Computing SOl.."); if (!pmed.ComputeSolutions(true, true)) { swBatchOut.WriteLine("Cannot Compute Wrapper Solution!!! error!!!"); } /*else*/ if (bestsol > pmed.WrapperSolution) { if (pmed.WrapperSolution > 0) { if (pmed.WrapperSolution < pmed.Solutions[pmed.BestSolutionIndex]) { isbestwrap = true; } else { isbestwrap = false; } bestsol = pmed.WrapperSolution; //Console.WriteLine("\r\nChecking Solutions Set of p ..."); //setpofsol = pmed.CheckPofSolutions(false); timeelapsed = pmed.GetTotalElapsedTime(); } else { swBatchOut.WriteLine("{0} : No Wrapper Computed!!!!", nomep); if (bestsol > pmed.Solutions[pmed.BestSolutionIndex]) { Console.WriteLine("\r\nChecking Solutions Set of p ..."); //setpofsol = pmed.CheckPofSolutions(false); timeelapsed = pmed.GetTotalElapsedTime(); bestsol = pmed.Solutions[pmed.BestSolutionIndex]; } } //timeelapsed = pmed.GetTotalElapsedTime(); //setpofsol = pmed.CheckPofSolutions(false); } } //salvo i risultati del meglio Console.Write("\r\nSalvo i risultati..."); swBatchOut.WriteLine("{4} : Solution = {0} --- Wrapper = {1} --- TotTime = {2} --- N = {3} CheckSetP = {5}", bestsol, isbestwrap, timeelapsed, setN[j], nomep, setpofsol); swBatchOut.Flush(); Console.WriteLine("ok"); } return(true); }