Exemplo n.º 1
0
 protected void BuildEvaluator()
 {
     MapBuilder mapBuilder = new MapBuilder(_building.ToDataModel());
     Simulator sim = new Simulator();
     sim.MaximumTicks = _building.GetFloorCount() * 2;
     sim.SetupSimulator(mapBuilder.BuildBuildingMap(), mapBuilder.BuildPeopleMap());
     _evaluator = new EvaCalcEvaluator(sim, _building, true);
 }
        public Genetics.Generic.ITransformer<List<bool>> BuildTransformer(BuildingEditor.ViewModel.Building building)
        {
            MapBuilder mapBuilder = new MapBuilder(building.ToDataModel());
            Simulator sim = new Simulator();

            sim.MaximumTicks = building.GetFloorCount() * 2;
            sim.SetupSimulator(mapBuilder.BuildBuildingMap(), mapBuilder.BuildPeopleMap());
            EvaCalcEvaluator evaluator = new EvaCalcEvaluator(sim, new Building(building));

            return new LocalOptimization(building, evaluator);
        }
Exemplo n.º 3
0
        private void Setup()
        {
            _building.ShortGenotype = _geneticsConfiguration.ShortGenotype;
            _building.ApplySimpleEvacuationIfShortGenotype();

            MapBuilder mapBuilder = new MapBuilder(_building.ToDataModel());
            Simulator sim = new Simulator();

            sim.MaximumTicks = _building.GetFloorCount() * 2;
            sim.SetupSimulator(mapBuilder.BuildBuildingMap(), mapBuilder.BuildPeopleMap());
            EvaCalcEvaluator evaluator = new EvaCalcEvaluator(sim, new Building(_building));

            BinaryChromosome.CrossoverOperator = _geneticsConfiguration.CrossoverOperator;
            BinaryChromosome.MutationOperator = _geneticsConfiguration.MutationOperator;
            BinaryChromosome.Transformer = _geneticsConfiguration.Transformer;
            BinaryChromosome.Repairer = new AdvancedRepairer(new Building(_building));
            BinaryChromosome.Evaluator = evaluator;

            GeneticAlgorithm = new GeneticAlgorithm(new BinaryChromosomeFactory(_building.GetFloorCount() * 2), _geneticsConfiguration.InitialPopulationSize);
            if (_geneticsConfiguration.MaxIterationsWithoutImprovement > 0)
                GeneticAlgorithm.EnableBestChromosomeBasedStopCondition(_geneticsConfiguration.MaxIterationsWithoutImprovement);
            GeneticAlgorithm.Selector = _geneticsConfiguration.Selector;
            GeneticAlgorithm.MaxIterations = _geneticsConfiguration.MaxIterations;
            GeneticAlgorithm.CrossoverProbability = _geneticsConfiguration.CrossoverProbability;
            GeneticAlgorithm.ReportStatus += CollectAlgorithmStatus;
        }
Exemplo n.º 4
0
            public EvaCalcEvaluator GetEvaluator()
            {
                MapBuilder mapBuilder = new MapBuilder(building.ToDataModel());
                Simulator sim = new Simulator();

                sim.MaximumTicks = building.GetFloorCount() * 2;
                sim.SetupSimulator(mapBuilder.BuildBuildingMap(), mapBuilder.BuildPeopleMap());
                return new EvaCalcEvaluator(sim, new Building(building));
            }