Free cookie consent management tool by TermsFeed Policy Generator

source: branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork1.cs @ 14628

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

#2205: worked on optimization networks

  • added variegation problem for minimization and maximization
  • refactored some classes
File size: 2.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Algorithms.CMAEvolutionStrategy;
23using HeuristicLab.Algorithms.LocalSearch;
24using HeuristicLab.Algorithms.ParameterlessPopulationPyramid;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Encodings.RealVectorEncoding;
28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
29
30namespace HeuristicLab.Networks.IntegratedOptimization.TravelingThief {
31  [Item("TtpNetwork1", "Version 1 of a TTP optimization network.")]
32  [Creatable("Optimization Networks")]
33  [StorableClass]
34  public sealed class TtpNetwork1 : TtpNetwork {
35    [StorableConstructor]
36    private TtpNetwork1(bool deserializing) : base(deserializing) { }
37    private TtpNetwork1(TtpNetwork1 original, Cloner cloner) : base(original, cloner) { }
38    public TtpNetwork1() : this("TtpNetwork1") { }
39    public TtpNetwork1(string name) : base(name) {
40      Orchestrator = new TtpOrchestratorNode1(OrchestratorNodeName);
41      MetaSolver = new OrchestratedAlgorithmNode(MetaSolverNodeName);
42      TspSolver = new OrchestratedAlgorithmNode(TspSolverNodeName);
43      KspSolver = new OrchestratedAlgorithmNode(KspSolverNodeName);
44
45      var cmaes = new CMAEvolutionStrategy();
46      cmaes.Problem = new MaximizationVariegationProblem<RealVectorEncoding>();
47      cmaes.MaximumGenerations = 80;
48      MetaSolver.Algorithm = cmaes;
49      Orchestrator.MetaSolverOrchestrationPort.ConnectedPort = MetaSolver.OrchestrationPort;
50
51      var ls = new LocalSearch();
52      ls.Problem = new TourProfitProblem();
53      ls.MaximumIterations.Value = 100;
54      ls.SampleSize.Value = 2000;
55      TspSolver.Algorithm = ls;
56      Orchestrator.TspSolverOrchestrationPort.ConnectedPort = TspSolver.OrchestrationPort;
57
58      var p3 = new ParameterlessPopulationPyramid();
59      p3.Problem = Orchestrator.KspParameter.Value;
60      p3.MaximumRuntime = 3;
61      KspSolver.Algorithm = p3;
62      Orchestrator.KspSolverOrchestrationPort.ConnectedPort = KspSolver.OrchestrationPort;
63    }
64
65    public override IDeepCloneable Clone(Cloner cloner) {
66      return new TtpNetwork1(this, cloner);
67    }
68  }
69}
Note: See TracBrowser for help on using the repository browser.