Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PTSP/HeuristicLab.Problems.PTSP/3.3/Moves/TwoPointFiveOpt/TwoPointFiveMove.cs @ 12272

Last change on this file since 12272 was 12272, checked in by apolidur, 9 years ago

#2221: Adding 2.5-opt-EEs operators to PTSP

File size: 1.6 KB
Line 
1using HeuristicLab.Common;
2using HeuristicLab.Core;
3using HeuristicLab.Encodings.PermutationEncoding;
4using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
5
6namespace HeuristicLab.Problems.PTSP {
7  public class TwoPointFiveMove : Item {
8   
9    [StorableConstructor]
10    public TwoPointFiveMove() : this(-1, -1,null, true) { }
11    protected TwoPointFiveMove(bool deserializing) : base(deserializing) { }
12    protected TwoPointFiveMove(TwoPointFiveMove original, Cloner cloner)
13      : base(original, cloner) {
14      this.Index1 = original.Index1;
15      this.Index2 = original.Index2;
16      this.IsInvert = original.IsInvert;
17      if (original.Permutation != null)
18        this.Permutation = cloner.Clone(original.Permutation);
19    }
20    public TwoPointFiveMove(int index1, int index2, Permutation permutation, bool isinvert)
21      : base() {
22      Index1 = index1;
23      Index2 = index2;
24      IsInvert = isinvert;
25      Permutation = permutation;
26    }
27
28    public TwoPointFiveMove(int index1, int index2, bool isinvert)
29      : base() {
30      Index1 = index1;
31      Index2 = index2;
32      IsInvert = isinvert;
33      Permutation = null;
34    }
35
36    [Storable]
37    public int Index1 { get; protected set; }
38    [Storable]
39    public int Index2 { get; protected set; }
40    [Storable]
41    public Permutation Permutation { get; protected set; }
42    [Storable]
43    public bool IsInvert { get; protected set; }
44
45    public override IDeepCloneable Clone(Cloner cloner) {
46      return new TwoPointFiveMove(this, cloner);
47    }
48  }
49}
Note: See TracBrowser for help on using the repository browser.