- Timestamp:
- 09/01/10 11:13:46 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.VehicleRouting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.VehicleRouting
-
Property
svn:mergeinfo
set to
/branches/VRP/HeuristicLab.Problems.VehicleRouting merged eligible
-
Property
svn:mergeinfo
set to
-
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs
r4179 r4352 34 34 using HeuristicLab.Problems.VehicleRouting.Encodings.Alba; 35 35 using HeuristicLab.Problems.VehicleRouting.Encodings.General; 36 using HeuristicLab.Problems.VehicleRouting.Encodings.Prins; 36 37 37 38 namespace HeuristicLab.Problems.VehicleRouting { … … 176 177 private BestVRPSolutionAnalyzer BestVRPSolutionAnalyzer { 177 178 get { return operators.OfType<BestVRPSolutionAnalyzer>().FirstOrDefault(); } 179 } 180 private BestAverageWorstVRPToursAnalyzer BestAverageWorstVRPToursAnalyzer { 181 get { return operators.OfType<BestAverageWorstVRPToursAnalyzer>().FirstOrDefault(); } 178 182 } 179 183 #endregion … … 314 318 operators = new List<IOperator>(); 315 319 operators.Add(new BestVRPSolutionAnalyzer()); 320 operators.Add(new BestAverageWorstVRPToursAnalyzer()); 316 321 ParameterizeAnalyzer(); 317 operators.AddRange(ApplicationManager.Manager.GetInstances<IVRPOperator>().Cast<IOperator>() );322 operators.AddRange(ApplicationManager.Manager.GetInstances<IVRPOperator>().Cast<IOperator>().OrderBy(op => op.Name)); 318 323 ParameterizeOperators(); 319 324 UpdateMoveEvaluators(); … … 333 338 } 334 339 private void ParameterizeSolutionCreator() { 335 SolutionCreator.CitiesParameter.Value = new IntValue(Coordinates.Rows - 1);336 340 SolutionCreator.VehiclesParameter.ActualName = VehiclesParameter.Name; 337 341 SolutionCreator.CoordinatesParameter.ActualName = CoordinatesParameter.Name; … … 367 371 BestVRPSolutionAnalyzer.OverloadParameter.ActualName = Evaluator.OverloadParameter.ActualName; 368 372 BestVRPSolutionAnalyzer.TardinessParameter.ActualName = Evaluator.TardinessParameter.ActualName; 373 BestVRPSolutionAnalyzer.TravelTimeParameter.ActualName = Evaluator.TravelTimeParameter.ActualName; 374 BestVRPSolutionAnalyzer.VehiclesUtilizedParameter.ActualName = Evaluator.VehcilesUtilizedParameter.ActualName; 369 375 BestVRPSolutionAnalyzer.VRPToursParameter.ActualName = SolutionCreator.VRPToursParameter.ActualName; 370 376 BestVRPSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 377 378 BestAverageWorstVRPToursAnalyzer.DistanceParameter.ActualName = Evaluator.DistanceParameter.ActualName; 379 BestAverageWorstVRPToursAnalyzer.OverloadParameter.ActualName = Evaluator.OverloadParameter.ActualName; 380 BestAverageWorstVRPToursAnalyzer.TardinessParameter.ActualName = Evaluator.TardinessParameter.ActualName; 381 BestAverageWorstVRPToursAnalyzer.TravelTimeParameter.ActualName = Evaluator.TravelTimeParameter.ActualName; 382 BestAverageWorstVRPToursAnalyzer.VehiclesUtilizedParameter.ActualName = Evaluator.VehcilesUtilizedParameter.ActualName; 383 BestAverageWorstVRPToursAnalyzer.ResultsParameter.ActualName = "Results"; 371 384 } 372 385 private void ParameterizeOperators() { … … 387 400 } 388 401 402 foreach (IPrinsOperator op in Operators.OfType<IPrinsOperator>()) { 403 op.FleetUsageFactor.ActualName = FleetUsageFactor.Name; 404 op.TimeFactor.ActualName = TimeFactor.Name; 405 op.DistanceFactor.ActualName = DistanceFactor.Name; 406 op.OverloadPenalty.ActualName = OverloadPenalty.Name; 407 op.TardinessPenalty.ActualName = TardinessPenalty.Name; 408 } 409 389 410 foreach (IVRPMoveEvaluator op in Operators.OfType<IVRPMoveEvaluator>()) { 390 411 op.FleetUsageFactor.ActualName = FleetUsageFactor.Name; … … 427 448 DueTime = new DoubleArray(parser.Duetimes); 428 449 ServiceTime = new DoubleArray(parser.Servicetimes); 450 451 OnReset(); 452 } 453 454 public void ImportFromTSPLib(string tspFileName) { 455 TSPLIBParser parser = new TSPLIBParser(tspFileName); 456 parser.Parse(); 457 458 this.Name = parser.Name; 459 460 int problemSize = parser.Demands.Length; 461 462 Coordinates = new DoubleMatrix(parser.Vertices); 463 if (parser.Vehicles != -1) 464 Vehicles.Value = parser.Vehicles; 465 else 466 Vehicles.Value = problemSize - 1; 467 Capacity.Value = parser.Capacity; 468 Demand = new DoubleArray(parser.Demands); 469 ReadyTime = new DoubleArray(problemSize); 470 DueTime = new DoubleArray(problemSize); 471 ServiceTime = new DoubleArray(problemSize); 472 473 for (int i = 0; i < problemSize; i++) { 474 ReadyTime[i] = 0; 475 DueTime[i] = int.MaxValue; 476 ServiceTime[i] = 0; 477 } 478 479 if (parser.Distance != -1) { 480 DueTime[0] = parser.Distance; 481 } 482 483 if (parser.Depot != 1) 484 throw new Exception("Invalid depot specification"); 485 486 if (parser.WeightType != TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) 487 throw new Exception("Invalid weight type"); 488 489 OnReset(); 490 } 491 492 public void ImportFromORLib(string orFileName) { 493 ORLIBParser parser = new ORLIBParser(orFileName); 494 parser.Parse(); 495 496 this.Name = parser.Name; 497 int problemSize = parser.Demands.Length; 498 499 Coordinates = new DoubleMatrix(parser.Vertices); 500 Vehicles.Value = problemSize - 1; 501 Capacity.Value = parser.Capacity; 502 Demand = new DoubleArray(parser.Demands); 503 ReadyTime = new DoubleArray(problemSize); 504 DueTime = new DoubleArray(problemSize); 505 ServiceTime = new DoubleArray(problemSize); 506 507 ReadyTime[0] = 0; 508 DueTime[0] = parser.MaxRouteTime; 509 ServiceTime[0] = 0; 510 511 for (int i = 1; i < problemSize; i++) { 512 ReadyTime[i] = 0; 513 DueTime[i] = int.MaxValue; 514 ServiceTime[i] = parser.ServiceTime; 515 } 429 516 430 517 OnReset();
Note: See TracChangeset
for help on using the changeset viewer.