Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/15 23:38:51 (9 years ago)
Author:
abeham
Message:

#2221:

  • Completely refactored PTSP branch
    • Added two sets of problem instances based on TSPLIB: homogeneous and heterogeneous
    • Implemented missing EvaluateByCoordinates for 1-shift moves
    • Made it clear that move evaluators are for estimated PTSP only
    • Changed parameter realization from a rather strange list of list of ints to a list of bool arrays
    • Reusing code of the 2-opt and 1-shift move evaluators in 2.5 move evaluator
    • Introducing distance calculators to properly handle the case when no distance matrix is given (previous code only worked with distance matrix and without only with euclidean distance in some settings)
    • Fixed several smaller code issues: protected, static, method parameters, copy & paste, interfaces, naming, parameters, serialization hooks, license headers, doc comments, data types
File:
1 copied

Legend:

Unmodified
Added
Removed
  • branches/PTSP/HeuristicLab.Problems.PTSP/3.3/Moves/TwoPointFiveOpt/TwoPointFiveMoveGenerator.cs

    r13408 r13412  
    3232  [Item("TwoPointFiveMoveGenerator", "Base class for all inversion and shift (2.5-opt) move generators.")]
    3333  [StorableClass]
    34   public abstract class TwoPointFiveMoveGenerator : SingleSuccessorOperator, I25MoveOperator, IMoveGenerator {
     34  public abstract class TwoPointFiveMoveGenerator : SingleSuccessorOperator, ITwoPointFiveMoveOperator, IMoveGenerator {
    3535    public override bool CanChangeName {
    3636      get { return false; }
    3737    }
     38
    3839    public ILookupParameter<Permutation> PermutationParameter {
    3940      get { return (ILookupParameter<Permutation>)Parameters["Permutation"]; }
     
    4243      get { return (LookupParameter<TwoPointFiveMove>)Parameters["TwoPointFiveMove"]; }
    4344    }
    44     protected ScopeParameter CurrentScopeParameter {
    45       get { return (ScopeParameter)Parameters["CurrentScope"]; }
    46     }
    4745
    4846    [StorableConstructor]
    4947    protected TwoPointFiveMoveGenerator(bool deserializing) : base(deserializing) { }
    5048    protected TwoPointFiveMoveGenerator(TwoPointFiveMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    51     public TwoPointFiveMoveGenerator()
     49    protected TwoPointFiveMoveGenerator()
    5250      : base() {
    5351      Parameters.Add(new LookupParameter<Permutation>("Permutation", "The permutation for which moves should be generated."));
     
    5755
    5856    public override IOperation Apply() {
    59       Permutation p = PermutationParameter.ActualValue;
    60       TwoPointFiveMove[] moves = GenerateMoves(p);
    61       Scope[] moveScopes = new Scope[moves.Length];
     57      var p = PermutationParameter.ActualValue;
     58      var moves = GenerateMoves(p);
     59      var moveScopes = new Scope[moves.Length];
    6260      for (int i = 0; i < moveScopes.Length; i++) {
    6361        moveScopes[i] = new Scope(i.ToString());
    6462        moveScopes[i].Variables.Add(new Variable(TwoPointFiveMoveParameter.ActualName, moves[i]));
    6563      }
    66       CurrentScopeParameter.ActualValue.SubScopes.AddRange(moveScopes);
     64      ExecutionContext.Scope.SubScopes.AddRange(moveScopes);
    6765      return base.Apply();
    6866    }
Note: See TracChangeset for help on using the changeset viewer.