Changeset 14628 for branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief
- Timestamp:
- 01/31/17 16:54:03 (7 years ago)
- Location:
- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork1.cs
r14621 r14628 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Encodings.RealVectorEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 … … 43 44 44 45 var cmaes = new CMAEvolutionStrategy(); 45 cmaes.Problem = new VariegationProblem();46 cmaes.Problem = new MaximizationVariegationProblem<RealVectorEncoding>(); 46 47 cmaes.MaximumGenerations = 80; 47 48 MetaSolver.Algorithm = cmaes; -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork2.cs
r14621 r14628 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Encodings.RealVectorEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 … … 43 44 44 45 var cmaes = new CMAEvolutionStrategy(); 45 cmaes.Problem = new VariegationProblem();46 cmaes.Problem = new MaximizationVariegationProblem<RealVectorEncoding>(); 46 47 cmaes.MaximumGenerations = 80; 47 48 MetaSolver.Algorithm = cmaes; -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork3.cs
r14621 r14628 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Encodings.RealVectorEncoding; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 29 … … 43 44 44 45 var cmaes = new CMAEvolutionStrategy(); 45 cmaes.Problem = new VariegationProblem();46 cmaes.Problem = new MaximizationVariegationProblem<RealVectorEncoding>(); 46 47 cmaes.MaximumGenerations = 80; 47 48 MetaSolver.Algorithm = cmaes; -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode.cs
r14621 r14628 29 29 using HeuristicLab.Encodings.RealVectorEncoding; 30 30 using HeuristicLab.Operators; 31 using HeuristicLab.Optimization;32 31 using HeuristicLab.Parameters; 33 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 49 48 protected const string TspSolverName = "TspSolver"; 50 49 protected const string KspSolverName = "KspSolver"; 50 protected const string OrchestrationPortNameSuffix = "OrchestrationPort"; 51 protected const string EvaluationPortNameSuffix = "EvaluationPort"; 51 52 #endregion 52 53 53 54 protected CancellationTokenSource cts; 54 protected ResultCollection tspResults, kspResults;55 55 56 56 [Storable] … … 319 319 320 320 #region TspSolver Message Handling 321 protected virtual void TspSolverOrchestrationPortMessage(IMessage message) { 322 var results = (ResultCollection)message["Results"]; 323 if (results.ContainsKey("Best TSP Solution")) { 324 tspResults = results; 325 } 326 } 321 protected virtual void TspSolverOrchestrationPortMessage(IMessage message) { } 327 322 328 323 protected virtual void TspSolverEvaluationPortMessage(IMessage message) { } … … 330 325 331 326 #region KspSolver Message Handling 332 protected virtual void KspSolverOrchestrationPortMessage(IMessage message) { 333 var results = (ResultCollection)message["Results"]; 334 if (results.ContainsKey("Best Solution")) { 335 kspResults = results; 336 } 337 } 327 protected virtual void KspSolverOrchestrationPortMessage(IMessage message) { } 338 328 339 329 private void KspSolverEvaluationPortMessage(IMessage message) { } -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode1.cs
r14616 r14628 43 43 public TtpOrchestratorNode1() : this("TtpOrchestratorNode1") { } 44 44 public TtpOrchestratorNode1(string name) : base(name) { 45 MetaSolverOrchestrationPort = CreateOrchestrationPort< VariegationProblem>(MetaSolverName);46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName , "RealVector", "Quality");47 TspSolverOrchestrationPort = CreateOrchestrationPort<TourProfitProblem>(TspSolverName );48 KspSolverOrchestrationPort = CreateOrchestrationPort<BinaryKnapsackProblem>(KspSolverName );45 MetaSolverOrchestrationPort = CreateOrchestrationPort<MaximizationVariegationProblem<RealVectorEncoding>>(MetaSolverName + OrchestrationPortNameSuffix); 46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName + EvaluationPortNameSuffix, "RealVector", "Quality"); 47 TspSolverOrchestrationPort = CreateOrchestrationPort<TourProfitProblem>(TspSolverName + OrchestrationPortNameSuffix); 48 KspSolverOrchestrationPort = CreateOrchestrationPort<BinaryKnapsackProblem>(KspSolverName + 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 MaximizationVariegationProblem<RealVectorEncoding>(); 63 63 problem.Encoding.Length = KspParameter.Value.Length; 64 64 problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } }); … … 81 81 cts.Token.ThrowIfCancellationRequested(); 82 82 83 var kspResults = (ResultCollection)kspMsg["Results"]; 83 84 var bestKspSolution = (BinaryVector)kspResults["Best Solution"].Value.Clone(); 84 85 var kspCapacity = (IntValue)KspParameter.Value.KnapsackCapacity.Clone(); … … 106 107 cts.Token.ThrowIfCancellationRequested(); 107 108 109 var tspResults = (ResultCollection)tspMsg["Results"]; 108 110 var bestTspSolution = (Permutation)tspResults["Best TSP Solution"].Value.Clone(); 109 111 var coordinates = (DoubleMatrix)TspParameter.Value.Coordinates.Clone(); -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode2.cs
r14616 r14628 42 42 public TtpOrchestratorNode2() : this("TtpOrchestratorNode2") { } 43 43 public TtpOrchestratorNode2(string name) : base(name) { 44 MetaSolverOrchestrationPort = CreateOrchestrationPort< VariegationProblem>(MetaSolverName);45 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName , "RealVector", "Quality");46 TspSolverOrchestrationPort = CreateOrchestrationPort<TravelingSalesmanProblem>(TspSolverName );47 KspSolverOrchestrationPort = CreateOrchestrationPort<LootProfitProblem>(KspSolverName );44 MetaSolverOrchestrationPort = CreateOrchestrationPort<MaximizationVariegationProblem<RealVectorEncoding>>(MetaSolverName + OrchestrationPortNameSuffix); 45 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName + EvaluationPortNameSuffix, "RealVector", "Quality"); 46 TspSolverOrchestrationPort = CreateOrchestrationPort<TravelingSalesmanProblem>(TspSolverName + OrchestrationPortNameSuffix); 47 KspSolverOrchestrationPort = CreateOrchestrationPort<LootProfitProblem>(KspSolverName + OrchestrationPortNameSuffix); 48 48 } 49 49 … … 59 59 if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns; 60 60 metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags); 61 var problem = new VariegationProblem();61 var problem = new MaximizationVariegationProblem<RealVectorEncoding>(); 62 62 problem.Encoding.Length = TspParameter.Value.Coordinates.Rows * 2; 63 63 problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } }); … … 82 82 cts.Token.ThrowIfCancellationRequested(); 83 83 84 var tspResults = (ResultCollection)tspMsg["Results"]; 84 85 var bestTspSolution = (PathTSPTour)tspResults["Best TSP Solution"].Value.Clone(); 85 86 var coordinates = (DoubleMatrix)TspParameter.Value.Coordinates.Clone(); … … 103 104 cts.Token.ThrowIfCancellationRequested(); 104 105 106 var kspResults = (ResultCollection)kspMsg["Results"]; 105 107 var bestKspSolution = (BinaryVector)kspResults["Best Solution"].Value.Clone(); 106 108 var kspCapacity = (IntValue)KspParameter.Value.KnapsackCapacity.Clone(); -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpOrchestratorNode3.cs
r14616 r14628 43 43 public TtpOrchestratorNode3() : this("TtpOrchestratorNode3") { } 44 44 public TtpOrchestratorNode3(string name) : base(name) { 45 MetaSolverOrchestrationPort = CreateOrchestrationPort< VariegationProblem>(MetaSolverName);46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName , "RealVector", "Quality");47 TspSolverOrchestrationPort = CreateOrchestrationPort<TravelingSalesmanProblem>(TspSolverName );48 KspSolverOrchestrationPort = CreateOrchestrationPort<BinaryKnapsackProblem>(KspSolverName );45 MetaSolverOrchestrationPort = CreateOrchestrationPort<MaximizationVariegationProblem<RealVectorEncoding>>(MetaSolverName + OrchestrationPortNameSuffix); 46 MetaSolverEvaluationPort = CreateEvaluationPort<RealVector>(MetaSolverName + EvaluationPortNameSuffix, "RealVector", "Quality"); 47 TspSolverOrchestrationPort = CreateOrchestrationPort<TravelingSalesmanProblem>(TspSolverName + OrchestrationPortNameSuffix); 48 KspSolverOrchestrationPort = CreateOrchestrationPort<BinaryKnapsackProblem>(KspSolverName + 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 MaximizationVariegationProblem<RealVectorEncoding>(); 63 63 problem.Encoding.Length = KspParameter.Value.Length + TspParameter.Value.Coordinates.Rows * 2; 64 64 problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } }); … … 84 84 cts.Token.ThrowIfCancellationRequested(); 85 85 86 var kspResults = (ResultCollection)kspMsg["Results"]; 86 87 var bestKspSolution = (BinaryVector)kspResults["Best Solution"].Value.Clone(); 87 88 var kspCapacity = (IntValue)KspParameter.Value.KnapsackCapacity.Clone(); … … 115 116 cts.Token.ThrowIfCancellationRequested(); 116 117 118 var tspResults = (ResultCollection)tspMsg["Results"]; 117 119 var bestTspSolution = (Permutation)tspResults["Best TSP Solution"].Value.Clone(); 118 120 var coordinates = (DoubleMatrix)TspParameter.Value.Coordinates.Clone();
Note: See TracChangeset
for help on using the changeset viewer.