Changeset 9605 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Rule.cs
- Timestamp:
- 06/11/13 13:32:32 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Rule.cs
r9392 r9605 43 43 public IAction Action { get { return action; } } 44 44 45 public double Length { 46 get { return variables.Values.Sum(x => x.Length); } 47 } 48 45 49 [StorableConstructor] 46 50 protected Rule(bool deserializing) : base(deserializing) { } … … 77 81 } 78 82 79 public void Randomize(IRandom random, double oneP ercentage, IEnumerable<IDiscretizer> discretizer) {83 public void Randomize(IRandom random, double oneProbability, IEnumerable<IDiscretizer> discretizers, IEnumerable<IAction> exceptActions = null) { 80 84 foreach (var variable in variables.Values) { 81 variable.Randomize(random, oneP ercentage, discretizer);85 variable.Randomize(random, oneProbability, discretizers); 82 86 } 83 action.Randomize(random); 87 if (exceptActions == null) { 88 action.Randomize(random); 89 } else { 90 action.Randomize(random, exceptActions); 91 } 92 } 93 94 public void SetToMatchInput(IGAssistInput input) { 95 foreach (var variable in variables) { 96 if (!input.VariableNames.Contains(variable.Key)) { 97 throw new ArgumentException("input does not contain variable name of rule"); 98 } 99 variable.Value.SetToMatch(input.GetVariableValue(variable.Key)); 100 } 84 101 } 85 102
Note: See TracChangeset
for help on using the changeset viewer.