Changeset 14601 for branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork1.cs
- Timestamp:
- 01/24/17 09:31:29 (7 years ago)
- Location:
- branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief
- Files:
-
- 2 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.TravelingThief/3.3/TtpNetwork1.cs
r14600 r14601 1 using System; 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 22 using System; 2 23 using System.Collections.Generic; 3 24 using HeuristicLab.Algorithms.CMAEvolutionStrategy; … … 11 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 12 33 13 namespace HeuristicLab.Networks.IntegratedOptimization {14 [Item("TtpNetwork 5", "An optimization network for the TTP.")]34 namespace HeuristicLab.Networks.IntegratedOptimization.TravelingThief { 35 [Item("TtpNetwork1", "Version 1 of a TTP optimization network.")] 15 36 [Creatable("Optimization Networks")] 16 37 [StorableClass] 17 // standard ttp 18 // cmaes variegates ksp values (factors) 19 // 1) init cmaes (length = ksp.values.length) 20 // 2) start cmaes 21 // 3) evaluate vector as follows: 22 // 4) change ksp values (mult by factor in vector) 23 // 5) best ksp 24 // 6) best tsp for ksp selection 25 // 7) return ttp quality 26 public sealed class TtpNetwork5 : Network, IOptimizer { 38 public sealed class TtpNetwork1 : Network, IOptimizer { 27 39 #region Nodes 28 public TtpOrchestratorNode 5Orchestrator {29 get { return (TtpOrchestratorNode 5)Nodes["Orchestrator"]; }40 public TtpOrchestratorNode1 Orchestrator { 41 get { return (TtpOrchestratorNode1)Nodes["Orchestrator"]; } 30 42 } 31 43 … … 44 56 45 57 [StorableConstructor] 46 private TtpNetwork 5(bool deserializing) : base(deserializing) { }47 private TtpNetwork 5(TtpNetwork5original, Cloner cloner) : base(original, cloner) {58 private TtpNetwork1(bool deserializing) : base(deserializing) { } 59 private TtpNetwork1(TtpNetwork1 original, Cloner cloner) : base(original, cloner) { 48 60 RegisterEvents(); 49 61 } … … 59 71 } 60 72 61 public TtpNetwork 5() : base("TtpNetwork5") {62 var orchestratorNode = new TtpOrchestratorNode 5("Orchestrator");73 public TtpNetwork1() : base("TtpNetwork1") { 74 var orchestratorNode = new TtpOrchestratorNode1("Orchestrator"); 63 75 Nodes.Add(orchestratorNode); 64 76 … … 70 82 orchestratorNode.MetaSolverOrchestrationPort.ConnectedPort = metaSolverNode.OrchestrationPort; 71 83 Nodes.Add(metaSolverNode); 72 73 //var tspSolverNode = new OrchestratedAlgorithmNode("TspSolver");74 //var osga = new OffspringSelectionGeneticAlgorithm();75 //osga.Problem = new TourProfitProblem();76 //osga.ComparisonFactorLowerBound.Value = 1.0;77 //osga.ComparisonFactorModifier = null;78 //osga.ComparisonFactorUpperBound.Value = 1.0;79 //var crossover = (MultiPermutationCrossover)(osga.Crossover = osga.CrossoverParameter.ValidValues.First(x => x is MultiPermutationCrossover));80 //foreach (var c in crossover.Operators)81 // crossover.Operators.SetItemCheckedState(c, c is CosaCrossover || c is OrderCrossover2 || c is PartiallyMatchedCrossover);82 //osga.MaximumSelectionPressure.Value = 200;83 //osga.Mutator = osga.MutatorParameter.ValidValues.First(x => x is MultiPermutationManipulator);84 //osga.PopulationSize.Value = 200;85 //osga.Selector = osga.SelectorParameter.ValidValues.First(x => x is RandomSelector);86 //tspSolverNode.Algorithm = osga;87 //orchestratorNode.TspSolverOrchestrationPort.ConnectedPort = tspSolverNode.OrchestrationPort;88 //Nodes.Add(tspSolverNode);89 84 90 85 var tspSolverNode = new OrchestratedAlgorithmNode("TspSolver"); … … 109 104 IntValue kspCapacity; IntArray kspItemWeights; IntArray kspItemValues; 110 105 IntArray ttpAvailability; DoubleValue ttpMinSpeed; DoubleValue ttpMaxSpeed; DoubleValue ttpRentingRatio; 111 TtpImporter.ImportTtpInstance(@"ttp-instances\berlin52-ttp\berlin52_n51_uncorr -similar-weights_05.ttp",106 TtpImporter.ImportTtpInstance(@"ttp-instances\berlin52-ttp\berlin52_n51_uncorr_01.ttp", 112 107 out tspCoordinates, 113 108 out kspCapacity, out kspItemValues, out kspItemWeights, … … 133 128 134 129 public override IDeepCloneable Clone(Cloner cloner) { 135 return new TtpNetwork 5(this, cloner);130 return new TtpNetwork1(this, cloner); 136 131 } 137 132
Note: See TracChangeset
for help on using the changeset viewer.