Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8792


Ignore:
Timestamp:
10/11/12 14:04:58 (12 years ago)
Author:
svonolfe
Message:

Improved performance when small time steps are used (#1955)

Location:
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs

    r8782 r8792  
    262262    }
    263263
     264    protected virtual void UpdateSimulationTime(PickupDeliverySimulation simulation, PickupDeliveryScenario scenario, ResultCollection results) {
     265      if (!results.ContainsKey("SimulationTime")) {
     266        results.Add(new Result("SimulationTime", new DoubleValue()));
     267      }
     268
     269      (results["SimulationTime"].Value as DoubleValue).Value = simulation.SimulationTime;
     270    }
     271
    264272    public virtual void Analyze(PickupDeliverySimulation simulation, PickupDeliveryScenario scenario, ResultCollection results) {
     273      UpdateSimulationTime(simulation, scenario, results);
    265274      UpdateOrderResults(simulation, scenario, results);
    266275      UpdateVehicleResults(simulation, scenario, results);
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliverySimulation.cs

    r8791 r8792  
    8383    public double SimulationTime {
    8484      get {
    85         if (!Results.ContainsKey("SimulationTime")) {
    86           return 0;
    87         } else {
    88           DoubleValue simulationTime =
    89             (Results["SimulationTime"].Value as DoubleValue);
    90           return simulationTime.Value;
    91         }
     85        return simulationTime;
    9286      }
    9387
    9488      private set {
    95         if (!Results.ContainsKey("SimulationTime")) {
    96           Results.Add(new Result("SimulationTime", new DoubleValue(0)));
    97         }
    98 
    99         Results["SimulationTime"].Value = new DoubleValue(value);
     89        simulationTime = value;
    10090      }
    10191    }
     
    194184      }
    195185
     186      simulationTime = original.simulationTime;
    196187      newSimulationTime = original.newSimulationTime;
    197188      lastResultCollection = original.lastResultCollection;
     
    322313
    323314    [Storable]
     315    private double simulationTime;
     316
     317    [Storable]
    324318    private double lastResultCollection;
    325319
     
    371365
    372366    private void UpdateSimulationState() {
    373       bool update = false;
    374367      if (Optimization != null) {
    375368        foreach (PDAction action in Optimization.GetActions()) {
     
    382375          foreach (PDChange change in changes)
    383376            OnSimulationStateChanged(change.BaseObject, change.ChangeType);
    384 
    385           if (changes.Count > 0)
    386             update = true;
    387         }
    388       }
    389 
    390       if (update)
    391         UpdateVisualization();
     377        }
     378      }
    392379    }
    393380
     
    395382      if (stopped || SimulationTime == 0 ||
    396383         (SimulationTime - lastResultCollection) >= ResultCollectionInterval) {
    397         //UpdateVisualization();   
     384        UpdateVisualization();   
    398385        if (Analyzer != null) {
    399386          Analyzer.Analyze(this, Scenario, Results);
     
    426413      simulationObject = new SimulationObject();
    427414      lastResultCollection = 0;
     415      simulationTime = 0;
    428416      newSimulationTime = 0;
    429417
     
    453441      base.OnPrepared();
    454442      PrepareOptimization();
     443      simulationTime = 0;
    455444      newSimulationTime = 0;
    456445    }
     
    461450      InitWaitHandle();
    462451
    463       if (!Results.ContainsKey("SimulationTime")) {
     452      if (simulationTime == 0) {
    464453        PrepareOptimization();
    465454        CreateSimulation();
Note: See TracChangeset for help on using the changeset viewer.