Changeset 9392 for branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionList.cs
- Timestamp:
- 04/23/13 13:31:29 (11 years ago)
- Location:
- branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3
- Property svn:ignore
-
old new 1 1 *.user 2 2 Plugin.cs 3 obj
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.DecisionList/3.3/DecisionList.cs
r9352 r9392 80 80 81 81 // for convenience 82 public IEnumerable<IAction> Evaluate(IEnumerable< DecisionListInput> input) {83 int numberOfAliveRules;84 return Evaluate(input, out numberOfAliveRules);82 public IEnumerable<IAction> Evaluate(IEnumerable<IGAssistInput> input) { 83 ItemSet<Rule> aliveRules; 84 return Evaluate(input, out aliveRules); 85 85 } 86 86 // for convenience 87 public IEnumerable<IAction> Evaluate(IEnumerable< DecisionListInput> input, out int numberOfAliveRules) {87 public IEnumerable<IAction> Evaluate(IEnumerable<IGAssistInput> input, out ItemSet<Rule> aliveRules) { 88 88 double theoryLengtgh; 89 return Evaluate(input, out numberOfAliveRules, out theoryLengtgh);89 return Evaluate(input, out aliveRules, out theoryLengtgh); 90 90 } 91 public IEnumerable<IAction> Evaluate(IEnumerable< DecisionListInput> input, out int numberOfAliveRules, out double theoryLengtgh) {91 public IEnumerable<IAction> Evaluate(IEnumerable<IGAssistInput> input, out ItemSet<Rule> aliveRules, out double theoryLength) { 92 92 var estimated = new List<IAction>(); 93 var activatedRules = new HashSet<Rule>(); 93 var activatedRules = new ItemSet<Rule>(); 94 int count = 0; 94 95 foreach (var dli in input) { 96 count++; 95 97 foreach (var rule in rules) { 96 98 if (rule.MatchInput(dli)) { … … 100 102 } 101 103 } 104 if (count > estimated.Count) { 105 estimated.Add(defaultAction); 106 } 102 107 } 103 numberOfAliveRules = activatedRules.Count;104 theoryLengt gh = activatedRules.Sum(x => x.ComputeTheoryLength());108 aliveRules = activatedRules; 109 theoryLength = activatedRules.Sum(x => x.ComputeTheoryLength()); 105 110 106 111 return estimated; 112 } 113 114 public void RemoveRules(IEnumerable<Rule> deadRules) { 115 foreach (var deadRule in deadRules) { 116 Rules.Remove(deadRule); 117 } 107 118 } 108 119 … … 145 156 } 146 157 } 158 159 public IGAssistSolution CreateGAssistSolution(IGAssistNichesProblemData problemData) { 160 return new DecisionListSolution(this, problemData); 161 } 147 162 #endregion 148 163 }
Note: See TracChangeset
for help on using the changeset viewer.