Changeset 4670


Ignore:
Timestamp:
10/29/10 18:28:23 (9 years ago)
Author:
mkommend
Message:

Refactored Selection and fixed some errors and warnings (ticket #922).

Location:
branches/CloningRefactoring
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Algorithms.DataAnalysis/3.3/SupportVectorMachine.cs

    r4666 r4670  
    162162    }
    163163
    164     public override IDeepCloneable Clone(Cloner cloner) {
    165       SupportVectorMachine clone = (SupportVectorMachine)base.Clone(cloner);
    166 
    167       return clone;
    168     }
    169 
    170164    public override void Prepare() {
    171165      if (Problem != null) base.Prepare();
  • branches/CloningRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationCrossover.cs

    r4667 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/BatchRun.cs

    r4665 r4670  
    172172    }
    173173
    174     protected BatchRun(BatchRun original, Cloner cloner)
     174    private BatchRun(BatchRun original, Cloner cloner)
    175175      : base(original, cloner) {
    176176      executionState = original.executionState;
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/Experiment.cs

    r4665 r4670  
    132132      Initialize();
    133133    }
    134     protected Experiment(Experiment original, Cloner cloner)
     134    private Experiment(Experiment original, Cloner cloner)
    135135      : base(original, cloner) {
    136136      executionState = original.executionState;
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/Result.cs

    r4665 r4670  
    108108      Initialize();
    109109    }
    110     protected Result(Result original, Cloner cloner)
     110    private Result(Result original, Cloner cloner)
    111111      : base(original, cloner) {
    112112      value = cloner.Clone(original.value);
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/Run.cs

    r4665 r4670  
    3838    [StorableConstructor]
    3939    private Run(bool deserializing) : base(deserializing) { }
    40     protected Run(Run original, Cloner cloner)
     40    private Run(Run original, Cloner cloner)
    4141      : base(original, cloner) {
    4242      color = original.color;
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/UserDefinedAlgorithm.cs

    r4665 r4670  
    5555    [StorableConstructor]
    5656    private UserDefinedAlgorithm(bool deserializing) : base(deserializing) { }
    57     private UserDefinedAlgorithm(UserDefinedAlgorithm original, Cloner cloner)
     57    internal UserDefinedAlgorithm(UserDefinedAlgorithm original, Cloner cloner)
    5858      : base(original, cloner) {
    5959    }
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/UserDefinedProblem.cs

    r4665 r4670  
    222222    [StorableClass]
    223223    private class EmptyUserDefinedProblemEvaluator : ParameterizedNamedItem, ISingleObjectiveEvaluator {
    224       public EmptyUserDefinedProblemEvaluator() : base() { }
     224
    225225      [StorableConstructor]
    226226      private EmptyUserDefinedProblemEvaluator(bool deserializing) : base(deserializing) { }
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/BestSelector.cs

    r4477 r4670  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3536  public sealed class BestSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
    3637    public BestSelector() : base() { }
     38    [StorableConstructor]
     39    private BestSelector(bool deserializing) : base(deserializing) { }
     40    private BestSelector(BestSelector original, Cloner cloner)
     41      : base(original, cloner) {
     42    }
     43    public override IDeepCloneable Clone(Cloner cloner) {
     44      return new BestSelector(this, cloner);
     45    }
     46
    3747
    3848    protected override IScope[] Select(List<IScope> scopes) {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/ConditionalSelector.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4243    }
    4344
     45    [StorableConstructor]
     46    protected ConditionalSelector(bool deserializing) : base(deserializing) { }
     47    protected ConditionalSelector(ConditionalSelector original, Cloner cloner)
     48      : base(original, cloner) {
     49    }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new ConditionalSelector(this, cloner);
     52    }
    4453    public ConditionalSelector()
    4554      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs

    r4068 r4670  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    8081
    8182    [StorableConstructor]
    82     private GenderSpecificSelector(bool deserializing) : base() { }
     83    private GenderSpecificSelector(bool deserializing) : base(deserializing) { }
     84    [StorableHook(HookType.AfterDeserialization)]
     85    private void AfterDeserialization() {
     86      Initialize();
     87    }
     88
     89    protected GenderSpecificSelector(GenderSpecificSelector original, Cloner cloner)
     90      : base(original, cloner) {
     91      Initialize();
     92    }
     93    public override IDeepCloneable Clone(Cloner cloner) {
     94      return new GenderSpecificSelector(this, cloner);
     95    }
     96
    8397    public GenderSpecificSelector()
    8498      : base() {
     
    142156
    143157    #region Helpers
    144     [StorableHook(HookType.AfterDeserialization)]
    145158    private void Initialize() {
    146159      FemaleSelectorParameter.ValueChanged += new EventHandler(SelectorParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/LeftReducer.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class LeftReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private LeftReducer(bool deserializing) : base(deserializing) { }
     37    private LeftReducer(LeftReducer original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new LeftReducer(this, cloner);
     40    }
    3441    public LeftReducer() : base() { }
    3542
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/LeftSelector.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4344      get { return CopySelectedParameter.Value; }
    4445      set { CopySelectedParameter.Value = value; }
     46    }
     47
     48    [StorableConstructor]
     49    private LeftSelector(bool deserializing) : base(deserializing) { }
     50    private LeftSelector(LeftSelector original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new LeftSelector(this, cloner);
    4555    }
    4656
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/LinearRankSelector.cs

    r4477 r4670  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3435  [StorableClass]
    3536  public sealed class LinearRankSelector : StochasticSingleObjectiveSelector, ISingleObjectiveSelector {
     37    [StorableConstructor]
     38    private LinearRankSelector(bool deserializing) : base(deserializing) { }
     39    private LinearRankSelector(LinearRankSelector original, Cloner cloner)
     40      : base(original, cloner) {
     41    }
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new LinearRankSelector(this, cloner);
     44    }
    3645    public LinearRankSelector() : base() { }
    3746
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/MergingReducer.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class MergingReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private MergingReducer(bool deserializing) : base(deserializing) { }
     37    private MergingReducer(MergingReducer original, Cloner cloner)
     38      : base(original, cloner) {
     39    }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new MergingReducer(this, cloner);
     42    }
    3443    public MergingReducer() : base() { }
    3544
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r4489 r4670  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3132  [StorableClass]
    3233  public class OffspringSelector : SingleSuccessorOperator {
    33 
    3434    public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter {
    3535      get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; }
     
    6262    }
    6363
     64    [StorableConstructor]
     65    private OffspringSelector(bool deserializing) : base(deserializing) { }
     66    private OffspringSelector(OffspringSelector original, Cloner cloner)
     67      : base(original, cloner) {
     68    }
     69    public override IDeepCloneable Clone(Cloner cloner) {
     70      return new OffspringSelector(this, cloner);
     71    }
    6472    public OffspringSelector()
    6573      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/ProportionalSelector.cs

    r4477 r4670  
    2323using System.Collections.Generic;
    2424using System.Linq;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Data;
     
    4546    }
    4647
     48    [StorableConstructor]
     49    private ProportionalSelector(bool deserializing) : base(deserializing) { }
     50    private ProportionalSelector(ProportionalSelector original, Cloner cloner)
     51      : base(original, cloner) {
     52    }
     53    public override IDeepCloneable Clone(Cloner cloner) {
     54      return new ProportionalSelector(this, cloner);
     55    }
    4756    public ProportionalSelector()
    4857      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/RandomReplacer.cs

    r4068 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4950    [StorableConstructor]
    5051    private RandomReplacer(bool deserializing) : base(deserializing) { }
     52    private RandomReplacer(RandomReplacer original, Cloner cloner)
     53      : base(original, cloner) {
     54    }
     55    public override IDeepCloneable Clone(Cloner cloner) {
     56      return new RandomReplacer(this, cloner);
     57    }
    5158    public RandomReplacer()
    5259      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/RandomSelector.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4647    }
    4748
     49    [StorableConstructor]
     50    private RandomSelector(bool deserializing) : base(deserializing) { }
     51    private RandomSelector(RandomSelector original, Cloner cloner)
     52      : base(original, cloner) {
     53    }
     54    public override IDeepCloneable Clone(Cloner cloner) {
     55      return new RandomSelector(this, cloner);
     56    }
    4857    public RandomSelector()
    4958      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/Reducer.cs

    r4068 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    4142    }
    4243
     44    [StorableConstructor]
     45    protected Reducer(bool deserializing) : base(deserializing) { }
     46    protected Reducer(Reducer original, Cloner cloner)
     47      : base(original, cloner) {
     48    }
    4349    protected Reducer()
    4450      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/Replacer.cs

    r3601 r4670  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4041
    4142    [StorableConstructor]
    42     protected Replacer(bool deserializing) : base() { }
     43    protected Replacer(bool deserializing) : base(deserializing) { }
     44    protected Replacer(Replacer original, Cloner cloner) : base(original, cloner) { }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new Replacer(this, cloner);
     47    }
    4348    public Replacer() {
    4449      Parameters.Add(new ValueLookupParameter<ISelector>("ReplacedSelector", "The selection operator to select those scopes that are to be replaced."));
     
    7479      int remaining = ExecutionContext.Scope.SubScopes[0].SubScopes.Count;
    7580      int selected = ExecutionContext.Scope.SubScopes[1].SubScopes.Count;
    76      
     81
    7782      ISelector replacedSelector = ReplacedSelectorParameter.ActualValue;
    7883      ISelector selectedSelector = SelectedSelectorParameter.ActualValue;
    79      
     84
    8085      if (replacedSelector != null) {
    8186        replacedSelector.CopySelected = new BoolValue(false);
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/RightChildReducer.cs

    r4489 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    4243  [StorableClass]
    4344  public class RightChildReducer : Reducer, IReducer {
     45    [StorableConstructor]
     46    protected RightChildReducer(bool deserializing) : base(deserializing) { }
     47    protected RightChildReducer(RightChildReducer original, Cloner cloner) : base(original, cloner) { }
     48    public override IDeepCloneable Clone(Cloner cloner) {
     49      return new RightChildReducer(this, cloner);
     50    }
     51    public RightChildReducer() : base() { }
    4452    /// <summary>
    4553    ///  Reduces the sub-scopes, so that the selected sub-scope contains all selected leaves
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/RightReducer.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Optimization;
     
    3233  [StorableClass]
    3334  public sealed class RightReducer : Reducer, IReducer {
     35    [StorableConstructor]
     36    private RightReducer(bool deserializing) : base(deserializing) { }
     37    private RightReducer(RightReducer original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new RightReducer(this, cloner);
     40    }
    3441    public RightReducer() : base() { }
    3542
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/RightSelector.cs

    r4477 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4445      set { CopySelectedParameter.Value = value; }
    4546    }
     47    [StorableConstructor]
     48    private RightSelector(bool deserializing) : base(deserializing) { }
     49    private RightSelector(RightSelector original, Cloner cloner) : base(original, cloner) { }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new RightSelector(this, cloner);
     52    }
     53
    4654    public RightSelector()
    4755      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/Selector.cs

    r4068 r4670  
    2121
    2222using System.Collections.Generic;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Operators;
     
    4344      get { return CurrentScopeParameter.ActualValue; }
    4445    }
     46
     47    [StorableConstructor]
     48    protected Selector(bool deserializing) : base(deserializing) { }
     49    protected Selector(Selector original, Cloner cloner) : base(original, cloner) { }
    4550
    4651    protected Selector()
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs

    r4068 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5051    }
    5152
     53    [StorableConstructor]
     54    protected SingleObjectiveSelector(bool deserializing) : base(deserializing) { }
     55    protected SingleObjectiveSelector(SingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
     56
    5257    protected SingleObjectiveSelector()
    5358      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/StochasticSelector.cs

    r4068 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    3637    }
    3738
     39    [StorableConstructor]
     40    protected StochasticSelector(bool deserializing) : base(deserializing) { }
     41    protected StochasticSelector(StochasticSelector original, Cloner cloner) : base(original, cloner) { }
    3842    protected StochasticSelector()
    3943      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/StochasticSingleObjectiveSelector.cs

    r4068 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Optimization;
     
    3536      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    3637    }
    37 
     38    [StorableConstructor]
     39    protected StochasticSingleObjectiveSelector(bool deserializing) : base(deserializing) { }
     40    protected StochasticSingleObjectiveSelector(StochasticSingleObjectiveSelector original, Cloner cloner) : base(original, cloner) { }
    3841    protected StochasticSingleObjectiveSelector()
    3942      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/TournamentSelector.cs

    r4477 r4670  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3738    public ValueLookupParameter<IntValue> GroupSizeParameter {
    3839      get { return (ValueLookupParameter<IntValue>)Parameters["GroupSize"]; }
     40    }
     41
     42    [StorableConstructor]
     43    private TournamentSelector(bool deserializing) : base(deserializing) { }
     44    private TournamentSelector(TournamentSelector original, Cloner cloner) : base(original, cloner) { }
     45    public override IDeepCloneable Clone(Cloner cloner) {
     46      return new TournamentSelector(this, cloner);
    3947    }
    4048
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/WorstReplacer.cs

    r4068 r4670  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    4647    [StorableConstructor]
    4748    private WorstReplacer(bool deserializing) : base(deserializing) { }
     49    private WorstReplacer(WorstReplacer original, Cloner cloner) : base(original, cloner) { }
     50    public override IDeepCloneable Clone(Cloner cloner) {
     51      return new WorstReplacer(this, cloner);
     52    }
    4853    public WorstReplacer()
    4954      : base() {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/WorstSelector.cs

    r4477 r4670  
    2222using System.Collections.Generic;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3435  [StorableClass]
    3536  public sealed class WorstSelector : SingleObjectiveSelector, ISingleObjectiveSelector {
     37    [StorableConstructor]
     38    private WorstSelector(bool deserializing) : base(deserializing) { }
     39    private WorstSelector(WorstSelector original, Cloner cloner) : base(original, cloner) { }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new WorstSelector(this, cloner);
     42    }
    3643    public WorstSelector() : base() { }
    3744
Note: See TracChangeset for help on using the changeset viewer.