Changeset 9605 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Crossover
- Timestamp:
- 06/11/13 13:32:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/Crossover/SinglePointCrossover.cs
r9352 r9605 48 48 49 49 public static DecisionList Apply(IRandom random, DecisionList parent1, DecisionList parent2) { 50 if (!parent1.DefaultAction.Match(parent2.DefaultAction)) { throw new ArgumentException("Default action of parents have to match!"); } 50 if (parent1 == null && parent1 != parent2) { throw new ArgumentException("Either both parents have a default action or none does."); } 51 if (parent1.DefaultAction != null && !parent1.DefaultAction.Match(parent2.DefaultAction)) { throw new ArgumentException("Default action of parents have to match!"); } 51 52 52 53 int rulesP1 = random.Next(0, parent1.Rules.Count()); … … 64 65 } 65 66 67 if (parent1.DefaultAction == null) { 68 return new DecisionList(rules); 69 } 66 70 return new DecisionList(rules, parent1.DefaultAction); 67 71 }
Note: See TracChangeset
for help on using the changeset viewer.