Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/24/17 09:31:29 (7 years ago)
Author:
jkarder
Message:

#2205: worked on optimization networks

  • created separate project for ttp optimization
  • removed some unused classes
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
     22using System;
    223using System.Collections.Generic;
    324using HeuristicLab.Algorithms.CMAEvolutionStrategy;
     
    1132using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    1233
    13 namespace HeuristicLab.Networks.IntegratedOptimization {
    14   [Item("TtpNetwork5", "An optimization network for the TTP.")]
     34namespace HeuristicLab.Networks.IntegratedOptimization.TravelingThief {
     35  [Item("TtpNetwork1", "Version 1 of a TTP optimization network.")]
    1536  [Creatable("Optimization Networks")]
    1637  [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 {
    2739    #region Nodes
    28     public TtpOrchestratorNode5 Orchestrator {
    29       get { return (TtpOrchestratorNode5)Nodes["Orchestrator"]; }
     40    public TtpOrchestratorNode1 Orchestrator {
     41      get { return (TtpOrchestratorNode1)Nodes["Orchestrator"]; }
    3042    }
    3143
     
    4456
    4557    [StorableConstructor]
    46     private TtpNetwork5(bool deserializing) : base(deserializing) { }
    47     private TtpNetwork5(TtpNetwork5 original, Cloner cloner) : base(original, cloner) {
     58    private TtpNetwork1(bool deserializing) : base(deserializing) { }
     59    private TtpNetwork1(TtpNetwork1 original, Cloner cloner) : base(original, cloner) {
    4860      RegisterEvents();
    4961    }
     
    5971    }
    6072
    61     public TtpNetwork5() : base("TtpNetwork5") {
    62       var orchestratorNode = new TtpOrchestratorNode5("Orchestrator");
     73    public TtpNetwork1() : base("TtpNetwork1") {
     74      var orchestratorNode = new TtpOrchestratorNode1("Orchestrator");
    6375      Nodes.Add(orchestratorNode);
    6476
     
    7082      orchestratorNode.MetaSolverOrchestrationPort.ConnectedPort = metaSolverNode.OrchestrationPort;
    7183      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);
    8984
    9085      var tspSolverNode = new OrchestratedAlgorithmNode("TspSolver");
     
    109104      IntValue kspCapacity; IntArray kspItemWeights; IntArray kspItemValues;
    110105      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",
    112107          out tspCoordinates,
    113108          out kspCapacity, out kspItemValues, out kspItemWeights,
     
    133128
    134129    public override IDeepCloneable Clone(Cloner cloner) {
    135       return new TtpNetwork5(this, cloner);
     130      return new TtpNetwork1(this, cloner);
    136131    }
    137132
Note: See TracChangeset for help on using the changeset viewer.