コード例 #1
0
        void IFitnessFunction.update(SimulatorExperiment simExp, Environment environment, instance_pack ip)
        {
            // For brain switching by multitask.
            // Schrum: If not using preference neurons, and the current brain does not match the environment
            if (simExp.multibrain && !simExp.preferenceNeurons && ip.agentBrain.getBrainCounter() != currentEnvironment)
            {
                // Schrum: get the appropriate brain for this environment
                ip.agentBrain.switchBrains(currentEnvironment);
            }


            if (currentEnvironment == TASK_TEAM_PATROL)
            { // Team patrol
                teamPatrol.update(simExp, environment, ip);
            }
            else if (currentEnvironment == TASK_LONE_PATROL)
            { // Lone patrol
                lonePatrol.update(simExp, environment, ip);
            }
            else if (currentEnvironment == TASK_DUAL_TASK_HALLWAY || currentEnvironment == TASK_DUAL_TASK_FORAGE)
            { // Dual task
                dualTask.update(simExp, environment, ip);
            }
            else if (currentEnvironment == TASK_TWO_ROOMS)
            { // Two rooms
                twoRooms.update(simExp, environment, ip);
            }
            else
            {
                Console.WriteLine("Error! Unknown environment! " + environment.name + ":" + currentEnvironment);
                System.Environment.Exit(1);
            }
        }