Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization/3.3/TtpNetwork4.cs @ 14598

Last change on this file since 14598 was 14598, checked in by jkarder, 7 years ago

#2205: worked on optimization networks

  • switched from IConfigurationPorts to IMessagePorts
  • removed option to clone algorithms in OrchestratedAlgorithmNodes
  • made properties of TourProfitProblem storable
  • fixed event handler registration
File size: 3.7 KB
Line 
1//using HeuristicLab.Algorithms.CMAEvolutionStrategy;
2//using HeuristicLab.Algorithms.LocalSearch;
3//using HeuristicLab.Algorithms.ParameterlessPopulationPyramid;
4//using HeuristicLab.Common;
5//using HeuristicLab.Core;
6//using HeuristicLab.Core.Networks;
7//using HeuristicLab.Data;
8//using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
9
10//namespace HeuristicLab.Networks.IntegratedOptimization {
11//  [Item("TtpNetwork4", "An optimization network for the TTP.")]
12//  [Creatable("Optimization Networks")]
13//  [StorableClass]
14//  // standard ttp
15//  // cmaes variegates tsp coordinates
16//  // 1) init cmaes (length = ksp.values.length)
17//  // 2) start cmaes
18//  // 3) evaluate vector as follows:
19//  // 4) change tsp coordinates (mult by factor in vector)
20//  // 5) best tsp
21//  // 6) best ksp
22//  // 7) return ttp quality
23//  public sealed class TtpNetwork4 : Network {
24//    [StorableConstructor]
25//    private TtpNetwork4(bool deserializing) : base(deserializing) { }
26//    private TtpNetwork4(TtpNetwork4 original, Cloner cloner) : base(original, cloner) { }
27//    public TtpNetwork4() : base("TtpNetwork4") {
28//      var orchestratorNode = new TtpOrchestratorNode4();
29//      Nodes.Add(orchestratorNode);
30
31//      var metaSolverNode = new OrchestratedAlgorithmNode("MetaSolver");
32//      var cmaes = new CMAEvolutionStrategy();
33//      cmaes.MaximumEvaluatedSolutions = 3000;
34//      cmaes.Engine = new ParallelEngine.ParallelEngine();
35//      metaSolverNode.Algorithm = cmaes;
36//      orchestratorNode.MetaSolverOrchestrationPort.ConnectedPort = metaSolverNode.OrchestrationPort;
37//      Nodes.Add(metaSolverNode);
38
39//      var tspSolverNode = new OrchestratedAlgorithmNode("TspSolver") { CloneAlgorithm = true };
40//      var ls = new LocalSearch();
41//      ls.Problem = orchestratorNode.TspParameter.Value;
42//      ls.MaximumIterations.Value = 100;
43//      tspSolverNode.Algorithm = ls;
44//      orchestratorNode.TspSolverOrchestrationPort.ConnectedPort = tspSolverNode.OrchestrationPort;
45//      Nodes.Add(tspSolverNode);
46
47//      var kspSolverNode = new OrchestratedAlgorithmNode("KspSolver") { CloneAlgorithm = true };
48//      var p3 = new ParameterlessPopulationPyramid();
49//      p3.Problem = orchestratorNode.KspParameter.Value;
50//      p3.MaximumRuntime = 3;
51//      kspSolverNode.Algorithm = p3;
52//      orchestratorNode.KspSolverOrchestrationPort.ConnectedPort = kspSolverNode.OrchestrationPort;
53//      Nodes.Add(kspSolverNode);
54
55//      #region Import
56//      DoubleMatrix tspCoordinates;
57//      IntValue kspCapacity; IntArray kspItemWeights; IntArray kspItemValues;
58//      IntArray ttpAvailability; DoubleValue ttpMinSpeed; DoubleValue ttpMaxSpeed; DoubleValue ttpRentingRatio;
59//      TtpImporter.ImportTtpInstance(@"ttp-instances\berlin52-ttp\berlin52_n51_uncorr_01.ttp",
60//          out tspCoordinates,
61//          out kspCapacity, out kspItemValues, out kspItemWeights,
62//          out ttpAvailability, out ttpMinSpeed, out ttpMaxSpeed, out ttpRentingRatio);
63
64//      var tsp = orchestratorNode.TspParameter.Value;
65//      tsp.Coordinates = tspCoordinates;
66
67//      var ksp = orchestratorNode.KspParameter.Value;
68//      ksp.KnapsackCapacity = kspCapacity;
69//      ksp.Encoding.Length = kspItemValues.Length;
70//      ksp.Values = kspItemValues;
71//      ksp.Weights = kspItemWeights;
72
73//      orchestratorNode.AvailabilityParameter.Value = ttpAvailability;
74//      orchestratorNode.MinSpeedParameter.Value = ttpMinSpeed;
75//      orchestratorNode.MaxSpeedParameter.Value = ttpMaxSpeed;
76//      orchestratorNode.RentingRatioParameter.Value = ttpRentingRatio;
77//      #endregion
78//    }
79
80//    public override IDeepCloneable Clone(Cloner cloner) {
81//      return new TtpNetwork4(this, cloner);
82//    }
83//  }
84//}
Note: See TracBrowser for help on using the repository browser.