Changeset 3129
- Timestamp:
- 03/19/10 18:07:11 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Selection/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Selection/3.3/RandomSelector.cs
r3017 r3129 22 22 using System.Collections.Generic; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 25 using HeuristicLab.Optimization; 26 using HeuristicLab.Parameters; 24 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 28 … … 31 34 [StorableClass] 32 35 [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 } 35 53 36 54 protected override IScope[] Select(List<IScope> scopes) { -
trunk/sources/HeuristicLab.Selection/3.3/Selector.cs
r3096 r3129 34 34 [Item("Selector", "A base class for selection operators.")] 35 35 [StorableClass] 36 public abstract class Selector : SingleSuccessorOperator , ISelector{36 public abstract class Selector : SingleSuccessorOperator { 37 37 public override bool CanChangeName { 38 38 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"]; }46 39 } 47 40 protected ScopeParameter CurrentScopeParameter { … … 49 42 } 50 43 51 public BoolValue CopySelected {52 get { return CopySelectedParameter.Value; }53 set { CopySelectedParameter.Value = value; }54 }55 44 public IScope CurrentScope { 56 45 get { return CurrentScopeParameter.ActualValue; } … … 59 48 protected Selector() 60 49 : 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."));63 50 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope from which sub-scopes should be selected.")); 64 51 } -
trunk/sources/HeuristicLab.Selection/3.3/SingleObjectiveSelector.cs
r3096 r3129 33 33 [StorableClass] 34 34 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 } 35 41 public IValueLookupParameter<BoolValue> MaximizationParameter { 36 42 get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; } … … 40 46 } 41 47 48 public BoolValue CopySelected { 49 get { return CopySelectedParameter.Value; } 50 set { CopySelectedParameter.Value = value; } 51 } 52 42 53 protected SingleObjectiveSelector() 43 54 : 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.")); 44 57 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the current problem is a maximization problem, otherwise false.")); 45 58 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.