#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("TtpNetwork2", "Version 2 of a TTP optimization network.")]
[Creatable("Optimization Networks")]
[StorableClass]
public sealed class TtpNetwork2 : TtpNetwork {
[StorableConstructor]
private TtpNetwork2(bool deserializing) : base(deserializing) { }
private TtpNetwork2(TtpNetwork2 original, Cloner cloner) : base(original, cloner) { }
public TtpNetwork2() : this("TtpNetwork2") { }
public TtpNetwork2(string name) : base(name) {
Orchestrator = new TtpOrchestratorNode2(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 = Orchestrator.TspParameter.Value;
ls.MaximumIterations.Value = 100;
ls.SampleSize.Value = 2000;
TspSolver.Algorithm = ls;
Orchestrator.TspSolverOrchestrationPort.ConnectedPort = TspSolver.OrchestrationPort;
var p3 = new ParameterlessPopulationPyramid();
p3.Problem = new LootProfitProblem();
p3.MaximumRuntime = 3;
KspSolver.Algorithm = p3;
Orchestrator.KspSolverOrchestrationPort.ConnectedPort = KspSolver.OrchestrationPort;
}
public override IDeepCloneable Clone(Cloner cloner) {
return new TtpNetwork2(this, cloner);
}
}
}