public FitnessInfo Evaluate(IBlackBox brain, ParallelEvaluationParameters parallelParameters) { ProgramMalmo programMalmo = new ProgramMalmo(); // The brain to Malmo controller will be subscribed to the update // events of ProgramMalmo, and it will controll the actions of the // Minecraft character. Here we only care about evaluating the results // of these actions. //BrainToMalmoController brainToMalmoController = new BrainToMalmoController(brain, programMalmo); //BuilderController brainToMalmoController = new BuilderController(brain, programMalmo); MazeControllerNoTurn brainToMalmoController = new MazeControllerNoTurn(brain, programMalmo); //MazeControllerWithDiagonals brainToMalmoController = new MazeControllerWithDiagonals(brain, programMalmo); ++evalCount; System.Diagnostics.Debug.WriteLine("Evaluate one. Simulation name: " + parallelParameters.simulationName + " with assigned port: " + parallelParameters.assignedPort.ToString()); System.Diagnostics.Debug.WriteLine("\nEnter evaluation " + evalCount); programMalmo.RunMalmo(parallelParameters); // FitnessInfo takes an "alternative fitness", so here we simply pass // the same fitness value twice. System.Diagnostics.Debug.WriteLine("Exit evaluation " + evalCount + "\n"); brainToMalmoController.CleanUp(); brainToMalmoController = null; return(new FitnessInfo(fitness, fitness)); }
/// <summary> /// Implement here the task. In our case, this should be something like /// creating a serires of Minecraft simulations for each brain and get /// a fitness in each case. /// /// If no name is given for the simulation (calling only Evaluate(box)) /// then en empty name will be used. /// </summary> /*public FitnessInfo Evaluate(IBlackBox brain, string userName) * { * return Evaluate(brain, userName, "DefaultName"); * }*/ public FitnessInfo Evaluate(IBlackBox brain, string simulationName, string userName) { ParallelEvaluationParameters parallelParameters = new ParallelEvaluationParameters(simulationName, userName, 0); return(Evaluate(brain, parallelParameters)); }