[14601] | 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 |
|
---|
[14649] | 22 | using System.Linq;
|
---|
[14586] | 23 | using HeuristicLab.Algorithms.CMAEvolutionStrategy;
|
---|
[14598] | 24 | using HeuristicLab.Algorithms.LocalSearch;
|
---|
[14586] | 25 | using HeuristicLab.Algorithms.ParameterlessPopulationPyramid;
|
---|
| 26 | using HeuristicLab.Common;
|
---|
| 27 | using HeuristicLab.Core;
|
---|
[14628] | 28 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
[14586] | 29 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 30 |
|
---|
[14601] | 31 | namespace HeuristicLab.Networks.IntegratedOptimization.TravelingThief {
|
---|
| 32 | [Item("TtpNetwork1", "Version 1 of a TTP optimization network.")]
|
---|
[14586] | 33 | [Creatable("Optimization Networks")]
|
---|
| 34 | [StorableClass]
|
---|
[14621] | 35 | public sealed class TtpNetwork1 : TtpNetwork {
|
---|
[14586] | 36 | [StorableConstructor]
|
---|
[14601] | 37 | private TtpNetwork1(bool deserializing) : base(deserializing) { }
|
---|
[14610] | 38 | private TtpNetwork1(TtpNetwork1 original, Cloner cloner) : base(original, cloner) { }
|
---|
| 39 | public TtpNetwork1() : this("TtpNetwork1") { }
|
---|
| 40 | public TtpNetwork1(string name) : base(name) {
|
---|
[14616] | 41 | Orchestrator = new TtpOrchestratorNode1(OrchestratorNodeName);
|
---|
| 42 | MetaSolver = new OrchestratedAlgorithmNode(MetaSolverNodeName);
|
---|
| 43 | TspSolver = new OrchestratedAlgorithmNode(TspSolverNodeName);
|
---|
| 44 | KspSolver = new OrchestratedAlgorithmNode(KspSolverNodeName);
|
---|
| 45 |
|
---|
[14586] | 46 | var cmaes = new CMAEvolutionStrategy();
|
---|
[14628] | 47 | cmaes.Problem = new MaximizationVariegationProblem<RealVectorEncoding>();
|
---|
[14649] | 48 | var cmaAnalyzer = cmaes.Analyzer.Operators.OfType<CMAAnalyzer>().Single();
|
---|
| 49 | cmaes.Analyzer.Operators.SetItemCheckedState(cmaAnalyzer, true);
|
---|
[14586] | 50 | cmaes.MaximumGenerations = 80;
|
---|
[14610] | 51 | MetaSolver.Algorithm = cmaes;
|
---|
| 52 | Orchestrator.MetaSolverOrchestrationPort.ConnectedPort = MetaSolver.OrchestrationPort;
|
---|
[14586] | 53 |
|
---|
[14598] | 54 | var ls = new LocalSearch();
|
---|
| 55 | ls.Problem = new TourProfitProblem();
|
---|
| 56 | ls.MaximumIterations.Value = 100;
|
---|
| 57 | ls.SampleSize.Value = 2000;
|
---|
[14610] | 58 | TspSolver.Algorithm = ls;
|
---|
| 59 | Orchestrator.TspSolverOrchestrationPort.ConnectedPort = TspSolver.OrchestrationPort;
|
---|
[14586] | 60 |
|
---|
| 61 | var p3 = new ParameterlessPopulationPyramid();
|
---|
[14610] | 62 | p3.Problem = Orchestrator.KspParameter.Value;
|
---|
[14586] | 63 | p3.MaximumRuntime = 3;
|
---|
[14610] | 64 | KspSolver.Algorithm = p3;
|
---|
| 65 | Orchestrator.KspSolverOrchestrationPort.ConnectedPort = KspSolver.OrchestrationPort;
|
---|
[14586] | 66 | }
|
---|
| 67 |
|
---|
| 68 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[14601] | 69 | return new TtpNetwork1(this, cloner);
|
---|
[14586] | 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|