Exemplo n.º 1
0
        public Simulation(
            ISimulationParameters simulationParams,
            IMutator mutator,
            IItemSelector itemSelector,
            IPopulationLogger logger,
            IEvaluator evaluator,
            ICrossoverSelector selector,
            ICrossBreeder breeder,
            IPopulationGenerator populationGenerator)
        {
            ObjectValidator.IfNullThrowException(simulationParams, nameof(simulationParams));
            ObjectValidator.IfNullThrowException(mutator, nameof(mutator));
            ObjectValidator.IfNullThrowException(itemSelector, nameof(itemSelector));
            ObjectValidator.IfNullThrowException(logger, nameof(logger));
            ObjectValidator.IfNullThrowException(evaluator, nameof(evaluator));
            ObjectValidator.IfNullThrowException(selector, nameof(selector));
            ObjectValidator.IfNullThrowException(breeder, nameof(breeder));
            ObjectValidator.IfNullThrowException(populationGenerator, nameof(populationGenerator));

            _mutator              = mutator;
            _itemSelector         = itemSelector;
            _logger               = logger;
            _evaluator            = evaluator;
            _selector             = selector;
            _breeder              = breeder;
            _populationGenerator  = populationGenerator;
            _simulationParameters = simulationParams;
        }
Exemplo n.º 2
0
        public Evaluator(IItemSelector itemSelector)
        {
            ObjectValidator.IfNullThrowException(itemSelector, nameof(itemSelector));

            _itemSelector = itemSelector;
        }