dynrules
 All Classes Functions Variables
RuleSet.h
1 /*
2  * dynrules - Python dynamic rules engine
3  *
4  * Authors: Marcus von Appen
5  *
6  * This file is distributed under the Public Domain.
7  */
8 
9 #ifndef _RULESET_H_
10 #define _RULESET_H_
11 
12 #include <vector>
13 #include "Rule.h"
14 
15 namespace dynrules
16 {
20  class RuleSet
21  {
22  public:
26  RuleSet ();
27 
36  RuleSet (double minweight, double maxweight);
37 
41  virtual ~RuleSet ();
42 
48  double getMinWeight () const;
49 
57  void setMinWeight (double minweight);
58 
64  double getMaxWeight () const;
65 
73  void setMaxWeight (double maxweight);
74 
80  double getWeight() const;
81 
87  std::vector<Rule*> getRules() const;
88 
96  void addRule (Rule* rule);
97 
109  bool removeRule (Rule* rule);
110 
117  Rule *find (int id);
118 
122  void clear ();
123 
134  void updateWeights (void *fitness);
135 
145  virtual double calculateAdjustment (void *fitness);
146 
155  virtual void distributeRemainder (double remainder);
156 
157  protected:
158 
162  double _minweight;
163 
167  double _maxweight;
168 
172  double _weight;
173 
177  std::vector<Rule*> _rules;
178  };
179 
180 } //namespace
181 
182 #endif /* _RULESET_H_ */