Changeset 9204 for branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Covering
- Timestamp:
- 02/04/13 16:16:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/Covering/CombinedIntegerVectorCoveringCreator.cs
r9194 r9204 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data;25 24 using HeuristicLab.Encodings.ConditionActionEncoding; 26 using HeuristicLab.Operators;27 using HeuristicLab.Parameters;28 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 26 … … 31 28 [Item("CombinedIntegerVectorCoveringCreator", "Description missing")] 32 29 [StorableClass] 33 public class CombinedIntegerVectorCoveringCreator : SingleSuccessorOperator, ICoveringSolutionCreator { 34 35 #region Parameter Properties 36 public ILookupParameter<IInput> CoverInputParameter { 37 get { return (ILookupParameter<IInput>)Parameters["CoverInput"]; } 38 } 39 public ILookupParameter<IAction> ActionParameter { 40 get { return (ILookupParameter<IAction>)Parameters["Action"]; } 41 } 42 public IValueLookupParameter<IClassifier> CreatedClassifierParameter { 43 get { return (IValueLookupParameter<IClassifier>)Parameters["CreatedClassifier"]; } 44 } 45 public ILookupParameter<PercentValue> ChangeSymbolProbabilityParameter { 46 get { return (ILookupParameter<PercentValue>)Parameters["ChangeSymbolProbability"]; } 47 } 48 public ILookupParameter<IRandom> RandomParameter { 49 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 50 } 51 52 #endregion 30 public class CombinedIntegerVectorCoveringCreator : CoveringSolutionCreator, ICombinedIntegerVectorOperator { 53 31 54 32 [StorableConstructor] … … 62 40 public CombinedIntegerVectorCoveringCreator() 63 41 : base() { 64 Parameters.Add(new LookupParameter<IInput>("CoverInput"));65 Parameters.Add(new LookupParameter<IAction>("Action"));66 Parameters.Add(new ValueLookupParameter<IClassifier>("CreatedClassifier"));67 Parameters.Add(new LookupParameter<PercentValue>("ChangeSymbolProbability"));68 Parameters.Add(new LookupParameter<IRandom>("Random"));69 42 } 70 43 71 p ublic override IOperation Apply() {72 CombinedIntegerVector newCondition = (CombinedIntegerVector) CoverInputParameter.ActualValue.Clone();44 protected override IClassifier CreateCoveredClassifier(IInput input, IAction action, IRandom random, double changeSymbolProbability) { 45 CombinedIntegerVector newCondition = (CombinedIntegerVector)input.Clone(); 73 46 74 CombinedIntegerVector condition = (CombinedIntegerVector) CoverInputParameter.ActualValue;75 CombinedIntegerVector action = (CombinedIntegerVector)ActionParameter.ActualValue;47 CombinedIntegerVector condition = (CombinedIntegerVector)input; 48 CombinedIntegerVector newAction = (CombinedIntegerVector)action; 76 49 77 newCondition = UniformSomePositionManipulator.ManipulateCondition( RandomParameter.ActualValue, condition, newCondition, ChangeSymbolProbabilityParameter.ActualValue.Value);50 newCondition = UniformSomePositionManipulator.ManipulateCondition(random, condition, newCondition, changeSymbolProbability); 78 51 79 CreatedClassifierParameter.ActualValue = new CombinedIntegerVector(newCondition, newCondition.Bounds, action, action.Bounds); 80 return base.Apply(); 52 return new CombinedIntegerVector(newCondition, newCondition.Bounds, newAction, newAction.Bounds); 81 53 } 82 54 }
Note: See TracChangeset
for help on using the changeset viewer.