Changeset 14628 for branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting
- Timestamp:
- 01/31/17 16:54:03 (8 years ago)
- Location:
- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpNetwork1.cs
r14621 r14628 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Encodings.RealVectorEncoding; 28 29 using HeuristicLab.Optimization; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 50 51 51 52 var cmaes = new CMAEvolutionStrategy(); 52 var vp = new VariegationProblem(); 53 vp.SetMaximization(false); 53 var vp = new MinimizationVariegationProblem<RealVectorEncoding>(); 54 54 cmaes.Problem = vp; 55 55 cmaes.MaximumGenerations = 80; -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpNetwork2.cs
r14621 r14628 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Encodings.RealVectorEncoding; 28 29 using HeuristicLab.Optimization; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 50 51 51 52 var cmaes = new CMAEvolutionStrategy(); 52 var vp = new VariegationProblem(); 53 vp.SetMaximization(false); 53 var vp = new MinimizationVariegationProblem<RealVectorEncoding>(); 54 54 cmaes.Problem = vp; 55 55 cmaes.MaximumGenerations = 80; -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode.cs
r14621 r14628 50 50 protected const string FlpSolverName = "FlpSolver"; 51 51 protected const string VrpSolverName = "VrpSolver"; 52 protected const string OrchestrationPortNameSuffix = "OrchestrationPort"; 53 protected const string EvaluationPortNameSuffix = "EvaluationPort"; 52 54 #endregion 53 55 54 56 protected CancellationTokenSource cts; 55 protected ResultCollection flpResults, vrpResults;56 57 57 58 [Storable] … … 309 310 310 311 #region FlpSolver Message Handling 311 protected virtual void FlpSolverOrchestrationPortMessage(IMessage message) { 312 var results = (ResultCollection)message["Results"]; 313 if (results.ContainsKey("Best Solution")) { 314 flpResults = results; 315 } 316 } 312 protected virtual void FlpSolverOrchestrationPortMessage(IMessage message) { } 317 313 318 314 protected virtual void FlpSolverEvaluationPortMessage(IMessage message) { } … … 320 316 321 317 #region VrpSolver Message Handling 322 protected virtual void VrpSolverOrchestrationPortMessage(IMessage message) { 323 var results = (ResultCollection)message["Results"]; 324 if (results.ContainsKey("Best valid VRP Solution")) { 325 vrpResults = results; 326 } 327 } 318 protected virtual void VrpSolverOrchestrationPortMessage(IMessage message) { } 328 319 329 320 private void VrpSolverEvaluationPortMessage(IMessage message) { } -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode1.cs
r14621 r14628 43 43 public LrpOrchestratorNode1() : this("LrpOrchestratorNode1") { } 44 44 public LrpOrchestratorNode1(string name) : base(name) { 45 MetaSolverOrchestrationPort = CreateOrchestrationPort< VariegationProblem>(MetaSolverName);46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName , "RealVector", "Quality");47 FlpSolverOrchestrationPort = CreateOrchestrationPort<FacilityLocationProblem>(FlpSolverName );48 VrpSolverOrchestrationPort = CreateOrchestrationPort<VehicleRoutingProblem>(VrpSolverName );45 MetaSolverOrchestrationPort = CreateOrchestrationPort<MinimizationVariegationProblem<RealVectorEncoding>>(MetaSolverName + OrchestrationPortNameSuffix); 46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName + EvaluationPortNameSuffix, "RealVector", "Quality"); 47 FlpSolverOrchestrationPort = CreateOrchestrationPort<FacilityLocationProblem>(FlpSolverName + OrchestrationPortNameSuffix); 48 VrpSolverOrchestrationPort = CreateOrchestrationPort<VehicleRoutingProblem>(VrpSolverName + OrchestrationPortNameSuffix); 49 49 } 50 50 … … 60 60 if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns; 61 61 metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags); 62 var problem = new VariegationProblem();62 var problem = new MinimizationVariegationProblem<RealVectorEncoding>(); 63 63 problem.Encoding.Length = nrOfCustomers * 2; 64 64 problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } }); … … 85 85 cts.Token.ThrowIfCancellationRequested(); 86 86 87 var flpResults = (ResultCollection)flpMsg["Results"]; 87 88 var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value; 88 89 var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution); … … 109 110 cts.Token.ThrowIfCancellationRequested(); 110 111 112 var vrpResults = (ResultCollection)vrpMsg["Results"]; 111 113 var bestVrpSolution = (VRPSolution)vrpResults["Best valid VRP Solution"].Value.Clone(); 112 114 vrpSolutions.Add(new Result("Depot " + depot.Key, bestVrpSolution)); -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode2.cs
r14621 r14628 43 43 public LrpOrchestratorNode2() : this("LrpOrchestratorNode2") { } 44 44 public LrpOrchestratorNode2(string name) : base(name) { 45 MetaSolverOrchestrationPort = CreateOrchestrationPort< VariegationProblem>(MetaSolverName);46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName , "RealVector", "Quality");47 FlpSolverOrchestrationPort = CreateOrchestrationPort<FacilityLocationProblem>(FlpSolverName );48 VrpSolverOrchestrationPort = CreateOrchestrationPort<VehicleRoutingProblem>(VrpSolverName );45 MetaSolverOrchestrationPort = CreateOrchestrationPort<MinimizationVariegationProblem<RealVectorEncoding>>(MetaSolverName + OrchestrationPortNameSuffix); 46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName + EvaluationPortNameSuffix, "RealVector", "Quality"); 47 FlpSolverOrchestrationPort = CreateOrchestrationPort<FacilityLocationProblem>(FlpSolverName + OrchestrationPortNameSuffix); 48 VrpSolverOrchestrationPort = CreateOrchestrationPort<VehicleRoutingProblem>(VrpSolverName + OrchestrationPortNameSuffix); 49 49 } 50 50 … … 60 60 if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns; 61 61 metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags); 62 var problem = new VariegationProblem();62 var problem = new MinimizationVariegationProblem<RealVectorEncoding>(); 63 63 problem.Encoding.Length = nrOfDepots * 2; 64 64 problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } }); … … 85 85 cts.Token.ThrowIfCancellationRequested(); 86 86 87 var flpResults = (ResultCollection)flpMsg["Results"]; 87 88 var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value; 88 89 var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution); … … 109 110 cts.Token.ThrowIfCancellationRequested(); 110 111 112 var vrpResults = (ResultCollection)vrpMsg["Results"]; 111 113 var bestVrpSolution = (VRPSolution)vrpResults["Best valid VRP Solution"].Value.Clone(); 112 114 vrpSolutions.Add(new Result("Depot " + depot.Key, bestVrpSolution));
Note: See TracChangeset
for help on using the changeset viewer.