Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3129 for trunk/sources


Ignore:
Timestamp:
03/19/10 18:07:11 (15 years ago)
Author:
abeham
Message:

Removed interface ISelector from Selector #931

Location:
trunk/sources/HeuristicLab.Selection/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Selection/3.3/RandomSelector.cs

    r3017 r3129  
    2222using System.Collections.Generic;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Optimization;
     26using HeuristicLab.Parameters;
    2427using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2528
     
    3134  [StorableClass]
    3235  [Creatable("Test")]
    33   public sealed class RandomSelector : StochasticSelector {
    34     public RandomSelector() : base() { }
     36  public sealed class RandomSelector : StochasticSelector, ISelector {
     37    protected ValueParameter<BoolValue> CopySelectedParameter {
     38      get { return (ValueParameter<BoolValue>)Parameters["CopySelected"]; }
     39    }
     40    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
     41      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
     42    }
     43
     44    public BoolValue CopySelected {
     45      get { return CopySelectedParameter.Value; }
     46      set { CopySelectedParameter.Value = value; }
     47    }
     48   
     49    public RandomSelector() : base() {
     50      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
     51      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
     52    }
    3553
    3654    protected override IScope[] Select(List<IScope> scopes) {
  • trunk/sources/HeuristicLab.Selection/3.3/Selector.cs

    r3096 r3129  
    3434  [Item("Selector", "A base class for selection operators.")]
    3535  [StorableClass]
    36   public abstract class Selector : SingleSuccessorOperator, ISelector {
     36  public abstract class Selector : SingleSuccessorOperator {
    3737    public override bool CanChangeName {
    3838      get { return false; }
    39     }
    40 
    41     protected ValueParameter<BoolValue> CopySelectedParameter {
    42       get { return (ValueParameter<BoolValue>)Parameters["CopySelected"]; }
    43     }
    44     public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
    45       get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
    4639    }
    4740    protected ScopeParameter CurrentScopeParameter {
     
    4942    }
    5043
    51     public BoolValue CopySelected {
    52       get { return CopySelectedParameter.Value; }
    53       set { CopySelectedParameter.Value = value; }
    54     }
    5544    public IScope CurrentScope {
    5645      get { return CurrentScopeParameter.ActualValue; }
     
    5948    protected Selector()
    6049      : base() {
    61       Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
    62       Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
    6350      Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected."));
    6451    }
  • trunk/sources/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs

    r3096 r3129  
    3333  [StorableClass]
    3434  public abstract class SingleObjectiveSelector : Selector, ISingleObjectiveSelector {
     35    protected ValueParameter<BoolValue> CopySelectedParameter {
     36      get { return (ValueParameter<BoolValue>)Parameters["CopySelected"]; }
     37    }
     38    public IValueLookupParameter<IntValue> NumberOfSelectedSubScopesParameter {
     39      get { return (ValueLookupParameter<IntValue>)Parameters["NumberOfSelectedSubScopes"]; }
     40    }
    3541    public IValueLookupParameter<BoolValue> MaximizationParameter {
    3642      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
     
    4046    }
    4147
     48    public BoolValue CopySelected {
     49      get { return CopySelectedParameter.Value; }
     50      set { CopySelectedParameter.Value = value; }
     51    }
     52
    4253    protected SingleObjectiveSelector()
    4354      : base() {
     55      Parameters.Add(new ValueParameter<BoolValue>("CopySelected", "True if the selected sub-scopes should be copied, otherwise false.", new BoolValue(true)));
     56      Parameters.Add(new ValueLookupParameter<IntValue>("NumberOfSelectedSubScopes", "The number of sub-scopes which should be selected."));
    4457      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false."));
    4558      Parameters.Add(new SubScopesLookupParameter<DoubleValue>("Quality", "The quality value contained in each sub-scope which is used for selection."));
Note: See TracChangeset for help on using the changeset viewer.