Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4902


Ignore:
Timestamp:
11/22/10 13:24:18 (14 years ago)
Author:
vdorfer
Message:

#1040:

  • adapted NSGAII to new cloning implementation
Location:
branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/BasicMultiObjectiveQualityAnalyzer.cs

    r4601 r4902  
    3030using HeuristicLab.Optimization;
    3131using HeuristicLab.Parameters;
     32using HeuristicLab.Common;
    3233
    3334namespace HeuristicLab.Algorithms.NSGA2 {
     
    4546    }
    4647
     48    [StorableConstructor]
     49    protected BasicMultiObjectiveQualityAnalyzer(bool deserializing) : base(deserializing) { }
     50    protected BasicMultiObjectiveQualityAnalyzer(BasicMultiObjectiveQualityAnalyzer original, Cloner cloner) : base(original, cloner) { }
    4751    public BasicMultiObjectiveQualityAnalyzer() {
    4852      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Rank", "The rank of solution describes to which front it belongs."));
     
    8791      return base.Apply();
    8892    }
     93
     94    public override IDeepCloneable Clone(Cloner cloner) {
     95      return new BasicMultiObjectiveQualityAnalyzer(this, cloner);
     96    }
    8997  }
    9098}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/CrowdedComparisonSorter.cs

    r4067 r4902  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Algorithms.NSGA2 {
     
    4748    }
    4849
     50    [StorableConstructor]
     51    protected CrowdedComparisonSorter(bool deserializing) : base(deserializing) { }
     52    protected CrowdedComparisonSorter(CrowdedComparisonSorter original, Cloner cloner) : base(original, cloner) { }
    4953    public CrowdedComparisonSorter() {
    5054      Parameters.Add(new ScopeTreeLookupParameter<IntValue>("Rank", "The rank of the solution."));
     
    8892      #endregion
    8993    }
     94
     95    public override IDeepCloneable Clone(Cloner cloner) {
     96      return new CrowdedComparisonSorter(this, cloner);
     97    }
    9098  }
    9199}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/CrowdedTournamentSelector.cs

    r4167 r4902  
    2828using HeuristicLab.Selection;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Algorithms.NSGA2 {
     
    6364    }
    6465
     66    [StorableConstructor]
     67    protected CrowdedTournamentSelector(bool deserializing) : base(deserializing) { }
     68    protected CrowdedTournamentSelector(CrowdedTournamentSelector original, Cloner cloner) : base(original, cloner) { }
    6569    public CrowdedTournamentSelector()
    6670      : base() {
     
    108112      return selected;
    109113    }
     114
     115    public override IDeepCloneable Clone(Cloner cloner) {
     116      return new CrowdedTournamentSelector(this, cloner);
     117    }
    110118  }
    111119}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/CrowdingDistanceAssignment.cs

    r4067 r4902  
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HeuristicLab.Common;
    3031
    3132namespace HeuristicLab.Algorithms.NSGA2 {
     
    4849    [StorableConstructor]
    4950    protected CrowdingDistanceAssignment(bool deserializing) : base(deserializing) { }
     51    protected CrowdingDistanceAssignment(CrowdingDistanceAssignment original, Cloner cloner) : base(original, cloner) { }
    5052    public CrowdingDistanceAssignment() {
    5153      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The vector of quality values."));
     
    114116      #endregion
    115117    }
     118
     119    public override IDeepCloneable Clone(Cloner cloner) {
     120      return new CrowdingDistanceAssignment(this, cloner);
     121    }
    116122  }
    117123}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/DefaultCrossover.cs

    r4068 r4902  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Common;
    2728
    2829namespace HeuristicLab.Algorithms.NSGA2 {
     
    3435    }
    3536
     37
     38    [StorableConstructor]
     39    protected DefaultCrossover(bool deserializing) : base(deserializing) { }
     40    protected DefaultCrossover(DefaultCrossover original, Cloner cloner) : base(original, cloner) { }
    3641    public DefaultCrossover()
    3742      : base() {
     
    4954      return base.Apply();
    5055    }
     56
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new DefaultCrossover(this, cloner);
     59    }
    5160  }
    5261}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/FastNonDominatedSort.cs

    r4067 r4902  
    2727using HeuristicLab.Parameters;
    2828using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Algorithms.NSGA2 {
     
    5152    }
    5253
     54    [StorableConstructor]
     55    protected FastNonDominatedSort(bool deserializing) : base(deserializing) { }
     56    protected FastNonDominatedSort(FastNonDominatedSort original, Cloner cloner) : base(original, cloner) { }
    5357    public FastNonDominatedSort() {
    5458      Parameters.Add(new ValueLookupParameter<BoolArray>("Maximization", "Whether each objective is maximization or minimization."));
     
    151155      fronts[i].Add(p);
    152156    }
     157
     158    public override IDeepCloneable Clone(Cloner cloner) {
     159      return new FastNonDominatedSort(this, cloner);
     160    }
    153161  }
    154162}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2.cs

    r4514 r4902  
    4040  [Creatable("Algorithms")]
    4141  [StorableClass]
    42   public class NSGA2 : EngineAlgorithm {
     42  public class NSGA2 : EngineAlgorithm, IStorableContent {
    4343    #region Problem Properties
    4444    public override Type ProblemType {
     
    150150
    151151    [StorableConstructor]
    152     public NSGA2(bool deserializing) : base(deserializing) { }
     152    protected NSGA2(bool deserializing) : base(deserializing) { }
     153    protected NSGA2(NSGA2 original, Cloner cloner) : base (original, cloner) {
     154      basicMOQualityAnalyzer = (BasicMultiObjectiveQualityAnalyzer)cloner.Clone(original.basicMOQualityAnalyzer);
     155      AttachEventHandlers();
     156    }
    153157    public NSGA2() {
    154158      Parameters.Add(new ValueParameter<IntValue>("Seed", "The random seed used to initialize the new pseudo random number generator.", new IntValue(0)));
     
    214218
    215219    public override IDeepCloneable Clone(Cloner cloner) {
    216       NSGA2 clone = (NSGA2)base.Clone(cloner);
    217       clone.basicMOQualityAnalyzer = (BasicMultiObjectiveQualityAnalyzer)cloner.Clone(basicMOQualityAnalyzer);
    218       clone.AttachEventHandlers();
    219       return clone;
     220      return new NSGA2(this, cloner);     
    220221    }
    221222
     
    375376    }
    376377    #endregion
     378
     379    public string Filename {
     380      get;
     381      set;
     382    }
    377383  }
    378384}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/NSGA2MainLoop.cs

    r4068 r4902  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828using HeuristicLab.Selection;
     29using HeuristicLab.Common;
    2930
    3031namespace HeuristicLab.Algorithms.NSGA2 {
     
    7879
    7980    [StorableConstructor]
    80     private NSGA2MainLoop(bool deserializing) : base() { }
     81    protected NSGA2MainLoop(bool deserializing) : base(deserializing) { }
     82    protected NSGA2MainLoop(NSGA2MainLoop original, Cloner cloner) : base(original, cloner) { }
    8183    public NSGA2MainLoop()
    8284      : base() {
     
    218220      #endregion
    219221    }
     222
     223    public override IDeepCloneable Clone(Cloner cloner) {
     224      return new NSGA2MainLoop(this, cloner);
     225    }
    220226  }
    221227}
  • branches/NSGA2/HeuristicLab.Algorithms.NSGA2/3.3/RankAndCrowdingSorter.cs

    r4068 r4902  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Selection;
     27using HeuristicLab.Common;
     28using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2729
    2830namespace HeuristicLab.Algorithms.NSGA2 {
     
    4143    }
    4244
     45    [StorableConstructor]
     46    protected RankAndCrowdingSorter(bool deserializing) : base(deserializing) { }
     47    protected RankAndCrowdingSorter(RankAndCrowdingSorter original, Cloner cloner) : base(original, cloner) { }
    4348    public RankAndCrowdingSorter()
    4449      : base() {
     
    7277      mergingReducer.Successor = null;
    7378    }
     79
     80    public override IDeepCloneable Clone(Cloner cloner) {
     81      return new RankAndCrowdingSorter(this, cloner);
     82    }
    7483  }
    7584}
Note: See TracChangeset for help on using the changeset viewer.