#region License Information
/* HeuristicLab
* Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System.Linq;
using HeuristicLab.Algorithms.CMAEvolutionStrategy;
using HeuristicLab.Algorithms.LocalSearch;
using HeuristicLab.Algorithms.ParameterlessPopulationPyramid;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.Encodings.RealVectorEncoding;
using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
namespace HeuristicLab.Networks.IntegratedOptimization.TravelingThief {
[Item("TtpNetwork1", "Version 1 of a TTP optimization network.")]
[Creatable("Optimization Networks")]
[StorableClass]
public sealed class TtpNetwork1 : TtpNetwork {
[StorableConstructor]
private TtpNetwork1(bool deserializing) : base(deserializing) { }
private TtpNetwork1(TtpNetwork1 original, Cloner cloner) : base(original, cloner) { }
public TtpNetwork1() : this("TtpNetwork1") { }
public TtpNetwork1(string name) : base(name) {
Orchestrator = new TtpOrchestratorNode1(OrchestratorNodeName);
MetaSolver = new OrchestratedAlgorithmNode(MetaSolverNodeName);
TspSolver = new OrchestratedAlgorithmNode(TspSolverNodeName);
KspSolver = new OrchestratedAlgorithmNode(KspSolverNodeName);
var cmaes = new CMAEvolutionStrategy();
cmaes.Problem = new MaximizationVariegationProblem();
var cmaAnalyzer = cmaes.Analyzer.Operators.OfType().Single();
cmaes.Analyzer.Operators.SetItemCheckedState(cmaAnalyzer, true);
cmaes.MaximumGenerations = 80;
MetaSolver.Algorithm = cmaes;
Orchestrator.MetaSolverOrchestrationPort.ConnectedPort = MetaSolver.OrchestrationPort;
var ls = new LocalSearch();
ls.Problem = new TourProfitProblem();
ls.MaximumIterations.Value = 100;
ls.SampleSize.Value = 2000;
TspSolver.Algorithm = ls;
Orchestrator.TspSolverOrchestrationPort.ConnectedPort = TspSolver.OrchestrationPort;
var p3 = new ParameterlessPopulationPyramid();
p3.Problem = Orchestrator.KspParameter.Value;
p3.MaximumRuntime = 3;
KspSolver.Algorithm = p3;
Orchestrator.KspSolverOrchestrationPort.ConnectedPort = KspSolver.OrchestrationPort;
}
public override IDeepCloneable Clone(Cloner cloner) {
return new TtpNetwork1(this, cloner);
}
}
}