private Engine wireEngine(MainSettings mainSettings, MainAppData data, RobotKiller killer, RobotBreeder breeder, Population population)
        {
            EngineSettings    engineSettings    = getEngineSettings(mainSettings);
            TimePointExecutor timePointExecutor = wireTimePointExecutor(mainSettings);

            return(EngineFactory.getDefaultEngine(engineSettings, data, timePointExecutor, killer, breeder, population));
        }
        private Population wirePopulation(MainSettings settings)
        {
            PopulationDAO dao        = PopulationDAOFactory.getDefaultDAO(settings.populationDAO);
            Population    population = PopulationFactory.getDefaultPopulation(dao);

            population.DesiredSize = settings.populationDesiredSize;
            return(population);
        }
        private TimePointExecutor wireTimePointExecutor(MainSettings settings)
        {
            DataSetExecutor       dataSetExecutor       = new SimpleDataSetExecutor();
            RobotExecutorSettings robotExecutorSettings = new RobotExecutorSettings(settings);
            RobotExecutorFactory  robotExecutorFactory  = new RobotExecutorFactory(robotExecutorSettings);

            return(TimePointExecutorFactory.getDefaultExecutor(dataSetExecutor, robotExecutorFactory, output));
        }
        private EngineSettings getEngineSettings(MainSettings settings)
        {
            EngineSettings engineSettings = new EngineSettings();

            engineSettings.startTimePoint  = settings.startTimePoint;
            engineSettings.endTimePoint    = settings.endTimePoint;
            engineSettings.performTraining = settings.performTraining;
            engineSettings.resultThreshold = settings.resultThreshold;
            return(engineSettings);
        }
        private RobotKiller getRobotKiller(MainSettings settings)
        {
            RobotKillerSettings killerSettings = new RobotKillerSettings();

            killerSettings.maximumDeathByAge          = settings.maximumDeathByAge;
            killerSettings.maximumDeathByWeight       = settings.maximumDeathByWeight;
            killerSettings.probabilityOfDeathByAge    = settings.probabilityOfDeathByAge;
            killerSettings.probabilityOfDeathByWeight = settings.probabilityOfDeathByWeight;
            killerSettings.protectRobotsUntilOutcomes = settings.protectRobotsUntilOutcomes;
            killerSettings.protectBestRobots          = settings.protectBestRobots;
            killerSettings.killNonPredictingRobots    = settings.killNonPredictingRobots;
            killerSettings.requireSymmetricalRobots   = settings.requireSymmetricalRobots;
            return(RobotKillerFactory.getDefaultRobotKiller(killerSettings, output));
        }
 private bool validateSettings(MainSettings settings)
 {
     try
     {
         settings.validate();
         return(true);
     }
     catch (System.ArgumentException ex)
     {
         Console.WriteLine(ex.ToString());
         Console.Write(ex.StackTrace);
         output.errorMessage(ex.Message);
         return(false);
     }
 }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static void checkSimulation(com.alphatica.genotick.ui.Parameters parameters) throws IllegalAccessException
        private static void checkSimulation(Parameters parameters)
        {
            if (!parameters.allConsumed())
            {
                output.errorMessage("Not all arguments processed: " + parameters.Unconsumed);
                exit(errorCodes.UNKNOWN_ARGUMENT);
            }
            Simulation simulation = new Simulation(output);

            input.Simulation = simulation;
            MainSettings settings = input.getSettings(output);
            MainAppData  data     = input.getData(settings.dataSettings, output);

            settings.validateTimePoints(data);
            simulation.start(settings, data);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("UnusedReturnValue") public java.util.List<com.alphatica.genotick.timepoint.TimePointStats> start(MainSettings mainSettings, com.alphatica.genotick.data.MainAppData data) throws IllegalAccessException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual IList <TimePointStats> start(MainSettings mainSettings, MainAppData data)
        {
            if (!validateSettings(mainSettings))
            {
                return(null);
            }
            logSettings(mainSettings);
            RobotKiller  killer  = getRobotKiller(mainSettings);
            Mutator      mutator = getMutator(mainSettings);
            RobotBreeder breeder = wireBreeder(mainSettings, mutator);

            population = wirePopulation(mainSettings);
            Engine engine = wireEngine(mainSettings, data, killer, breeder, population);
            IList <TimePointStats> results = engine.start(output);

            showSummary(results);
            return(results);
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private void logSettings(MainSettings settings) throws IllegalAccessException
        private void logSettings(MainSettings settings)
        {
            string settingsString = settings.String;

            output.infoMessage(settingsString);
        }
Exemplo n.º 10
0
        private Mutator getMutator(MainSettings settings)
        {
            MutatorSettings mutatorSettings = new MutatorSettings(settings.instructionMutationProbability, settings.newInstructionProbability, settings.skipInstructionProbability);

            return(MutatorFactory.getDefaultMutator(mutatorSettings));
        }
Exemplo n.º 11
0
        private RobotBreeder wireBreeder(MainSettings settings, Mutator mutator)
        {
            BreederSettings breederSettings = new BreederSettings(settings.minimumOutcomesBetweenBreeding, settings.inheritedChildWeight, settings.minimumOutcomesToAllowBreeding, settings.randomRobotsAtEachUpdate, settings.dataMaximumOffset, settings.ignoreColumns);

            return(RobotBreederFactory.getDefaultBreeder(breederSettings, mutator));
        }