public override void run() { if (log) { Console.WriteLine("Hibrido:"); Console.Out.WriteLine($"{id} -> Inicio Evolutivo"); } _evolutivo.run(); solEHibrido = _evolutivo.getBest(); _trepaColinas.setSolInit(solEHibrido); if (log) { Console.Out.WriteLine($"{id} -> Inicio Trepa-Colinas"); } _trepaColinas.run(); solTrepaColinas = _trepaColinas.getBest(); bestSol = solTrepaColinas; if (log) { Console.Out.WriteLine($"{id} -> Terminou"); } }
public void run() { CSVFile csvFile = new CSVFile(); TrepaColinas tr = getNewIntace(); csvFile.Write(0, 0, tr.descricao()); csvFile.addCabecalhoTC(data); Hipotese best = null; for (int i = 0; i < tests; i++) { tr = getNewIntace(); tr.run(); Hipotese hip = tr.getBest(); if ((best == null || best.eval > hip.eval) && hip.valido == 0) // guardar a melhor { best = new Hipotese(hip, "Melhor", hip.interacao); best.evaluate(); } //Console.Out.WriteLine(hip.ToString2() + " : " + hip.ToString()); //System.Threading.Thread.Sleep(100); csvFile.addBestTrepaColinas(tr); } if (best != null) { best.evaluate(); csvFile.addHipoteseTC(best); } else { csvFile.Write(0, -1, "Nao foi encontrada nenhuma solucao"); } csvFile.toFile(outputfile); }