Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/31/17 16:54:03 (7 years ago)
Author:
jkarder
Message:

#2205: worked on optimization networks

  • added variegation problem for minimization and maximization
  • refactored some classes
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  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Encodings.RealVectorEncoding;
    2829using HeuristicLab.Optimization;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    5051
    5152      var cmaes = new CMAEvolutionStrategy();
    52       var vp = new VariegationProblem();
    53       vp.SetMaximization(false);
     53      var vp = new MinimizationVariegationProblem<RealVectorEncoding>();
    5454      cmaes.Problem = vp;
    5555      cmaes.MaximumGenerations = 80;
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpNetwork2.cs

    r14621 r14628  
    2626using HeuristicLab.Common;
    2727using HeuristicLab.Core;
     28using HeuristicLab.Encodings.RealVectorEncoding;
    2829using HeuristicLab.Optimization;
    2930using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    5051
    5152      var cmaes = new CMAEvolutionStrategy();
    52       var vp = new VariegationProblem();
    53       vp.SetMaximization(false);
     53      var vp = new MinimizationVariegationProblem<RealVectorEncoding>();
    5454      cmaes.Problem = vp;
    5555      cmaes.MaximumGenerations = 80;
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode.cs

    r14621 r14628  
    5050    protected const string FlpSolverName = "FlpSolver";
    5151    protected const string VrpSolverName = "VrpSolver";
     52    protected const string OrchestrationPortNameSuffix = "OrchestrationPort";
     53    protected const string EvaluationPortNameSuffix = "EvaluationPort";
    5254    #endregion
    5355
    5456    protected CancellationTokenSource cts;
    55     protected ResultCollection flpResults, vrpResults;
    5657
    5758    [Storable]
     
    309310
    310311    #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) { }
    317313
    318314    protected virtual void FlpSolverEvaluationPortMessage(IMessage message) { }
     
    320316
    321317    #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) { }
    328319
    329320    private void VrpSolverEvaluationPortMessage(IMessage message) { }
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode1.cs

    r14621 r14628  
    4343    public LrpOrchestratorNode1() : this("LrpOrchestratorNode1") { }
    4444    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);
    4949    }
    5050
     
    6060      if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns;
    6161      metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags);
    62       var problem = new VariegationProblem();
     62      var problem = new MinimizationVariegationProblem<RealVectorEncoding>();
    6363      problem.Encoding.Length = nrOfCustomers * 2;
    6464      problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } });
     
    8585      cts.Token.ThrowIfCancellationRequested();
    8686
     87      var flpResults = (ResultCollection)flpMsg["Results"];
    8788      var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value;
    8889      var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution);
     
    109110        cts.Token.ThrowIfCancellationRequested();
    110111
     112        var vrpResults = (ResultCollection)vrpMsg["Results"];
    111113        var bestVrpSolution = (VRPSolution)vrpResults["Best valid VRP Solution"].Value.Clone();
    112114        vrpSolutions.Add(new Result("Depot " + depot.Key, bestVrpSolution));
  • branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.LocationRouting/3.3/LrpOrchestratorNode2.cs

    r14621 r14628  
    4343    public LrpOrchestratorNode2() : this("LrpOrchestratorNode2") { }
    4444    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);
    4949    }
    5050
     
    6060      if (clearRuns) msgFlags |= OrchestrationMessage.ClearRuns;
    6161      metaMsg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(msgFlags);
    62       var problem = new VariegationProblem();
     62      var problem = new MinimizationVariegationProblem<RealVectorEncoding>();
    6363      problem.Encoding.Length = nrOfDepots * 2;
    6464      problem.Encoding.Bounds = new DoubleMatrix(new[,] { { -1.0, 1.0 } });
     
    8585      cts.Token.ThrowIfCancellationRequested();
    8686
     87      var flpResults = (ResultCollection)flpMsg["Results"];
    8788      var bestFlpSolution = (IntegerVector)flpResults["Best Solution"].Value;
    8889      var flpSolution = FlpParameter.Value.GetSolution(bestFlpSolution);
     
    109110        cts.Token.ThrowIfCancellationRequested();
    110111
     112        var vrpResults = (ResultCollection)vrpMsg["Results"];
    111113        var bestVrpSolution = (VRPSolution)vrpResults["Best valid VRP Solution"].Value.Clone();
    112114        vrpSolutions.Add(new Result("Depot " + depot.Key, bestVrpSolution));
Note: See TracChangeset for help on using the changeset viewer.