Exemplo n.º 1
0
        public EvacuationSimulation(Building building, GeneticsConfiguration<List<bool>> geneticsConfiguration)
        {
            _building = building;
            _geneticsConfiguration = geneticsConfiguration;

            Setup();
        }
Exemplo n.º 2
0
 public FloorIconUpdater(Building building, ListView floors)
 {
     _building = building;
     _lastSelectedFloor = _building.CurrentFloor;
     _bw = new BackgroundWorker();
     _bw.DoWork += Work;
     floors.SelectionChanged += new SelectionChangedEventHandler(OnFloorChanged);
     UpdateAll();
 }
Exemplo n.º 3
0
        public Building(Building other)
            : this(other.ToDataModel())
        {
            ShortGenotype = other.ShortGenotype;

            if (ShortGenotype)
            {
                Rooms.Where(x => x.NumberOfDoors == 1)
                    .ToList()
                    .ForEach(x => x.ApplySimpleEvacuation());
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads building definition from given xml file.
        /// </summary>
        /// <param name="file">Path to building definition file.</param>
        public void LoadBuilding(string file)
        {
            CurrentFile = file;
            Common.DataModel.Building building = new Common.DataModel.Building();
            building.Load(file);

            var viewMode = CurrentBuilding != null ? CurrentBuilding.ViewMode : "";
            CurrentBuilding = new Building(building);
            CurrentBuilding.ViewMode = viewMode;

            _debugInfo.Building = CurrentBuilding;
        }
Exemplo n.º 5
0
 internal GeneticsConfiguration<List<bool>> BuildConfiguration(Building CurrentBuilding)
 {
     return new GeneticsConfiguration<List<bool>>()
     {
         CrossoverOperator = SelectedCrossover.BuildCrossoverOperator(CurrentBuilding),
         MutationOperator = SelectedMutation.BuildMutationOperator(CurrentBuilding),
         InitialPopulationSize = InitPopSize,
         MaxIterations = MaxIterations,
         Selector = SelectedSelector.BuildSelector(),
         Transformer = SelectedTransformer.BuildTransformer(CurrentBuilding),
         ShortGenotype = ShortGenotype,
         CrossoverProbability = CrossoverProbability,
         MaxIterationsWithoutImprovement = MaxIterationsWithoutImprovement
     };
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates new building.
 /// </summary>
 public void NewBuilding()
 {
     CurrentFile = "";
     CurrentBuilding = new Building(5, 5);
     CurrentBuilding.ViewMode = CurrentTool.Name;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Loads building definition from given xml file.
 /// </summary>
 /// <param name="file">Path to building definition file.</param>
 public void LoadBuilding(string file)
 {
     CurrentFile = file;
     Common.DataModel.Building building = new Common.DataModel.Building();
     building.Load(file);
     CurrentBuilding = new Building(building);
 }
Exemplo n.º 8
0
 private void LoadBuilding()
 {
     LoadBuildingPath();
     var buildingCommonModel = new Common.DataModel.Building();
     buildingCommonModel.Load(buildingPath);
     building = new Building(buildingCommonModel);
 }
Exemplo n.º 9
0
 private void CreateLocalOptimizationOperator()
 {
     Building building;
     switch (GetAttributeValueOfElement("Type", "Transformer"))
     {
         case "None":
             geneticsConfiguration.Transformer = null;
             break;
         case "ThreeSegmentLoopOptimizer":
             building = GetBuilding();
             if (geneticsConfiguration.ShortGenotype)
             {
                 building.ShortGenotype = true;
                 building.ApplySimpleEvacuationIfShortGenotype();
             }
             geneticsConfiguration.Transformer = new ThreeSegmentLoopOptimizer(building, Double.Parse(GetAttributeValueOfElement("Probability", "Transformer"), CultureInfo.InvariantCulture));
             break;
         case "LocalOptimization":
             building = GetBuilding();
             if (geneticsConfiguration.ShortGenotype)
             {
                 building.ShortGenotype = true;
                 building.ApplySimpleEvacuationIfShortGenotype();
             }
             geneticsConfiguration.Transformer = new LocalOptimization(building, GetEvaluator());
             break;
         default:
             throw new ArgumentException("Invalid transformer name");
     }
 }