private CPopulationFitness calculateSimPopulationFitness(CPopulationInfo populationInfo) { try { ProtocolManager.Open(); Console.WriteLine("Evaluating generation " + populationInfo.Generation); return(ProtocolManager.Client.calculateSimPopulationFitness(populationInfo)); } catch (Exception exception) { Console.WriteLine("Lost connection to evaluator (" + exception.StackTrace + ")"); Console.WriteLine("Sleeping for 2 seconds, creating new connection."); ProtocolManager.Close(); Thread.Sleep(2000); return(calculateSimPopulationFitness(populationInfo)); } }