Changeset 8792
- Timestamp:
- 10/11/12 14:04:58 (12 years ago)
- Location:
- branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs
r8782 r8792 262 262 } 263 263 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 264 272 public virtual void Analyze(PickupDeliverySimulation simulation, PickupDeliveryScenario scenario, ResultCollection results) { 273 UpdateSimulationTime(simulation, scenario, results); 265 274 UpdateOrderResults(simulation, scenario, results); 266 275 UpdateVehicleResults(simulation, scenario, results); -
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliverySimulation.cs
r8791 r8792 83 83 public double SimulationTime { 84 84 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; 92 86 } 93 87 94 88 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; 100 90 } 101 91 } … … 194 184 } 195 185 186 simulationTime = original.simulationTime; 196 187 newSimulationTime = original.newSimulationTime; 197 188 lastResultCollection = original.lastResultCollection; … … 322 313 323 314 [Storable] 315 private double simulationTime; 316 317 [Storable] 324 318 private double lastResultCollection; 325 319 … … 371 365 372 366 private void UpdateSimulationState() { 373 bool update = false;374 367 if (Optimization != null) { 375 368 foreach (PDAction action in Optimization.GetActions()) { … … 382 375 foreach (PDChange change in changes) 383 376 OnSimulationStateChanged(change.BaseObject, change.ChangeType); 384 385 if (changes.Count > 0) 386 update = true; 387 } 388 } 389 390 if (update) 391 UpdateVisualization(); 377 } 378 } 392 379 } 393 380 … … 395 382 if (stopped || SimulationTime == 0 || 396 383 (SimulationTime - lastResultCollection) >= ResultCollectionInterval) { 397 //UpdateVisualization();384 UpdateVisualization(); 398 385 if (Analyzer != null) { 399 386 Analyzer.Analyze(this, Scenario, Results); … … 426 413 simulationObject = new SimulationObject(); 427 414 lastResultCollection = 0; 415 simulationTime = 0; 428 416 newSimulationTime = 0; 429 417 … … 453 441 base.OnPrepared(); 454 442 PrepareOptimization(); 443 simulationTime = 0; 455 444 newSimulationTime = 0; 456 445 } … … 461 450 InitWaitHandle(); 462 451 463 if ( !Results.ContainsKey("SimulationTime")) {452 if (simulationTime == 0) { 464 453 PrepareOptimization(); 465 454 CreateSimulation();
Note: See TracChangeset
for help on using the changeset viewer.