Changeset 9242 for branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Covering
- Timestamp:
- 02/25/13 12:37:18 (12 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3
- Property svn:ignore
-
old new 1 1 obj 2 Plugin.cs
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.VariableVector/3.3/Covering/VariableVectorCoveringCreator.cs
r9226 r9242 34 34 public class VariableVectorCoveringCreator : CoveringSolutionCreator, IVariableVectorCoveringCreator { 35 35 36 public IValueLookupParameter<VariableVector> SampleVariableVectorParameter { 37 get { return (IValueLookupParameter<VariableVector>)Parameters["SampleVariableVector"]; } 36 public IValueLookupParameter<IVariableVectorClassificationProblemData> ProblemDataParameter { 37 get { return (IValueLookupParameter<IVariableVectorClassificationProblemData>)Parameters["ProblemData"]; } 38 } 39 40 private IVariableVectorClassificationProblemData ProblemData { 41 get { return ProblemDataParameter.ActualValue; } 38 42 } 39 43 … … 45 49 public VariableVectorCoveringCreator() 46 50 : base() { 47 Parameters.Add(new ValueLookupParameter< VariableVector>("SampleVariableVector"));51 Parameters.Add(new ValueLookupParameter<IVariableVectorClassificationProblemData>("ProblemData")); 48 52 } 49 53 public override IDeepCloneable Clone(Cloner cloner) { … … 55 59 var actionCast = action as VariableVectorAction; 56 60 57 VariableVectorCondition sampleVariableVectorCondition = SampleVariableVectorParameter.ActualValue.Condition;61 VariableVectorCondition sampleVariableVectorCondition = ProblemData.SampleVariableVectorParameter.Value.Condition; 58 62 IEnumerable<IVariable> newCondition = CoverInput(inputCast, sampleVariableVectorCondition, random, changeSymbolProbability); 59 63 60 return new VariableVector(newCondition, actionCast.Va lues);64 return new VariableVector(newCondition, actionCast.VariableDictionary.Values); 61 65 } 62 66 63 67 private IEnumerable<IVariable> CoverInput(VariableVectorInput input, VariableVectorCondition sample, IRandom random, double changeSymbolProbability) { 64 varconditionVariables = new List<IVariable>();65 if (!sample. Keys.All(x => input.ContainsKey(x))) {68 List<IVariable> conditionVariables = new List<IVariable>(); 69 if (!sample.VariableDictionary.Keys.All(x => input.InputDictionary.ContainsKey(x))) { 66 70 throw new ArgumentException("Input does not contain all variable names from sample"); 67 71 } 68 foreach (var keyValuePair in sample ) {72 foreach (var keyValuePair in sample.VariableDictionary) { 69 73 IVariable variable = keyValuePair.Value.GetEmptyCopy(); 70 variable.Cover(random, input [keyValuePair.Key], changeSymbolProbability);74 variable.Cover(random, input.InputDictionary[keyValuePair.Key], changeSymbolProbability); 71 75 conditionVariables.Add(variable); 72 76 }
Note: See TracChangeset
for help on using the changeset viewer.