dynrules

RuleSet.h

00001 /*
00002  * dynrules - Python dynamic rules engine
00003  *
00004  * Authors: Marcus von Appen
00005  *
00006  * This file is distributed under the Public Domain.
00007  */
00008 
00009 #ifndef _RULESET_H_
00010 #define _RULESET_H_
00011 
00012 #include <vector>
00013 #include "Rule.h"
00014 
00015 namespace dynrules
00016 {
00020     class RuleSet
00021     {
00022     public:
00026         RuleSet ();
00027 
00036         RuleSet (double minweight, double maxweight);
00037 
00041         virtual ~RuleSet ();
00042 
00048         double getMinWeight () const;
00049         
00057         void setMinWeight (double minweight);
00058 
00064         double getMaxWeight () const;
00065 
00073         void setMaxWeight (double maxweight);
00074 
00080         double getWeight() const;
00081 
00087         std::vector<Rule*> getRules() const;
00088 
00096         void addRule (Rule* rule);
00097 
00109         bool removeRule (Rule* rule);
00110 
00117         Rule *find (int id);
00118 
00122         void clear ();
00123 
00134         void updateWeights (void *fitness);
00135 
00145         virtual double calculateAdjustment (void *fitness);
00146 
00155         virtual void distributeRemainder (double remainder);
00156 
00157     protected:
00158         
00162         double _minweight;
00163         
00167         double _maxweight;
00168 
00172         double _weight;
00173 
00177         std::vector<Rule*> _rules;
00178     };
00179 
00180 } //namespace
00181 
00182 #endif /* _RULESET_H_ */
 All Classes Functions Variables