Shark Machine Learning Library
  • About Shark
  • Sourceforge
    • Project Summary
    • Downloads
    • Subversion Repository
  • Getting Started
  • Tutorials
  • FAQ
  • Main Modules
    • ReClaM
    • EALib
    • MOO-EALib
    • Fuzzy
  • Tools
    • Mixture
    • Array
    • Rng
    • LinAlg
    • FileUtil
  • Main Page
  • Related Pages
  • Classes

InferenceMachine.h

Go to the documentation of this file.
00001 
00010 /* $log$ */
00011 
00012 #ifndef INFERENCEMACHINE_H
00013 #define INFERENCEMACHINE_H
00014 
00015 #include "RuleBase.h"
00016 #include "FuzzySet.h"
00017 #include "FuzzyException.h"
00018 #include "RCPtr.h"
00019 
00020 #include <iostream>
00021 #include <fstream>
00022 #include <vector>
00023 
00024 
00030 class InferenceMachine {
00031 public:
00032     typedef std::vector< RCPtr<FuzzySet> > OutputType;
00033     typedef std::vector<double>    InputType;
00034 
00040     InferenceMachine(RuleBase * const rb = NULL);
00041 
00045     virtual ~InferenceMachine();
00046 
00053     virtual OutputType     computeInference(const InputType it) const;
00054 
00061     virtual OutputType     computeInference(double a)  const;
00062 
00070     virtual OutputType     computeInference(double a, double b)  const;
00071 
00080     virtual OutputType     computeInference(double a, double b, double c)  const;
00081 
00091     virtual OutputType     computeInference(double a, double b, double c, double d)  const;
00092 
00098     inline  void           setRuleBase(RuleBase * const rB);
00099 
00110     void                   characteristicCurve( const std::string fileName = "curve.dat", 
00111                                                 long int resolution = 50 ) const;
00112 protected:
00113     RuleBase*              ruleBasePtr;
00114     virtual OutputType     buildTreeFast( RuleBase::BaseIterator & actual, unsigned int remainingRules, int conclusionNumber, const InputType in) const = 0;
00115 private:
00116 
00117 //Build the tree of FuzzySets, whose evaluation yields the result of the c-th conclusion, starting with the a-th rule, and a ruleBase of length b.
00118 
00119     virtual void             addToFile(double,std::ofstream &) const;
00120     virtual void             addToFile(double,double,std::ofstream &) const;
00121 };
00122 
00123 void InferenceMachine::setRuleBase(RuleBase * const rbp) {
00124     ruleBasePtr = rbp;
00125 };
00126 #endif