openModeller  Version 1.5.0
GarpRule Class Referenceabstract

#include <Rule.h>

Inheritance diagram for GarpRule:
Inheritance graph
Collaboration diagram for GarpRule:
Collaboration graph

Public Member Functions

 GarpRule ()
 
virtual ~GarpRule ()
 
virtual char type () const
 
 GarpRule ()
 Default constructor. More...
 
 GarpRule (const int numGenes)
 Constructor with defined size. More...
 
 GarpRule (Scalar prediction, int numGenes, const Sample &chrom1, const Sample &chrom2, const double *performances)
 Constructor with setters. More...
 
virtual ~GarpRule ()
 Default destructor. More...
 
virtual GarpRuleclone () const
 
virtual GarpRuleobjFactory () const =0
 
virtual int copy (const GarpRule *fromRule)
 
int numGenes () const
 
virtual char type () const
 
bool needsEvaluation () const
 
void forceEvaluation ()
 
void evaluated ()
 
void setPrediction (double pred)
 
Scalar getPrediction () const
 
const SamplegetChrom1 () const
 
const SamplegetChrom2 () const
 
const double * getPerformanceArray () const
 
double getPerformance (PerfIndex perfIndex) const
 
virtual int getStrength (const Sample &sample) const =0
 
virtual int getCertainty (const Scalar pred) const
 
virtual double getError (const Scalar predefinedValue, const Scalar prediction) const
 
virtual bool similar (const GarpRule *compareToRule) const
 
virtual void mutate (double temperature)
 
virtual void crossover (GarpRule *rule, int xpt1, int xpt2)
 
void adjustRange (Scalar &v1, Scalar &v2) const
 
virtual bool applies (const Sample &sample) const =0
 
double evaluate (const OccurrencesPtr &occs)
 
virtual void log ()
 
- Public Member Functions inherited from Rule
 Rule ()
 Default constructor. More...
 
virtual ~Rule ()
 Default destructor. More...
 
virtual RuleobjFactory ()=0
 
virtual Ruleclone ()
 
virtual void copy (Rule *fromRule)
 
void RestoreRule (double *perf, unsigned char *genes, int arry_len, int *gene_index)
 Restore Model. More...
 
virtual char * toString ()
 
virtual void fromString (char *strRule)=0
 
virtual char * toXML ()
 
virtual void initialize (EnvCellSet *objEnvCellSet, const RuleSet *objRuleSet, bool *geneIsActivePtr, int *geneIndexPtr, int iActGenes)=0
 
virtual bool applyToCell (EnvCell *cell)=0
 
virtual double getCertainty (EnvCell *cell)
 
virtual double getError (BYTE pred, EnvCell *cell)
 
virtual double getStrength (EnvCell *cell)=0
 
virtual bool similar (Rule *objOtherRule)
 
virtual void mutate (int intTemperature)
 
double testWithData (EnvCellSet *objTrainSet)
 
bool needsEvaluation ()
 

Protected Attributes

Sample _chrom1
 BYTE vector containing the genes (representation of the variables in a Genetic Algorithm. More...
 
Sample _chrom2
 
Scalar _prediction
 
int _numGenes
 Number of genes stored by the rule. More...
 
double _performance [10]
 Vector for storing the performance values for the rule. More...
 
bool _needsEvaluation
 
char _origin
 
- Protected Attributes inherited from Rule
BYTEGene
 BYTE vector containing the genes (representation of the variables in a Genetic Algorithm. More...
 
int intGenes
 Number of genes stored by the rule. More...
 
double dblPerformance [10]
 Vector for storing the performance values for the rule. More...
 
bool blnNeedsEvaluation
 
int intGens
 
int intTrials
 
int intScreener
 
int intScreen
 
int intLength
 
int intNumber
 
int intConclusion
 
char chrOrigin
 
char chrPad
 
int lId
 
int iOrigGen
 
double _pXYs
 
int _no
 
double _dA
 
double _dSig
 
bool * bGeneIsActive
 
int * iGeneIndex
 
int iActiveGenes
 

Detailed Description

Base class for specific Garp rules. Provides the basic interface for methods that all kinds of Garp rules should provide.

Definition at line 116 of file Rule.h.

Constructor & Destructor Documentation

GarpRule::GarpRule ( )

Definition at line 492 of file Rule.cpp.

GarpRule::~GarpRule ( )
virtual

Definition at line 495 of file Rule.cpp.

GarpRule::GarpRule ( )

Default constructor.

GarpRule::GarpRule ( const int  numGenes)

Constructor with defined size.

Definition at line 99 of file rules_base.cpp.

References _origin, _performance, and type().

Here is the call graph for this function:

GarpRule::GarpRule ( Scalar  prediction,
int  numGenes,
const Sample chrom1,
const Sample chrom2,
const double *  performances 
)

Constructor with setters.

Definition at line 113 of file rules_base.cpp.

References _performance.

virtual GarpRule::~GarpRule ( )
virtual

Default destructor.

Member Function Documentation

void GarpRule::adjustRange ( Scalar v1,
Scalar v2 
) const

Definition at line 195 of file rules_base.cpp.

Referenced by mutate().

virtual bool GarpRule::applies ( const Sample sample) const
pure virtual
GarpRule * GarpRule::clone ( ) const
virtual

Returns a copy of the rule. Caller is responsible for deallocating memory for this object when it is done using it.

Definition at line 134 of file rules_base.cpp.

References _chrom1, _chrom2, _needsEvaluation, _numGenes, _origin, _performance, _prediction, and objFactory().

Referenced by Garp::keepFittest(), Garp::select(), and TEST().

Here is the call graph for this function:

int GarpRule::copy ( const GarpRule fromRule)
virtual

Copy data from another rule to the current rule.

Parameters
fromRulePointer to source rule providing data to set current rule.
Returns
1 on success or 0 on failure (if types are different).

Definition at line 157 of file rules_base.cpp.

References _chrom1, _chrom2, _needsEvaluation, _origin, _performance, _prediction, and type().

Referenced by TEST().

Here is the call graph for this function:

void GarpRule::crossover ( GarpRule rule,
int  xpt1,
int  xpt2 
)
virtual

Definition at line 212 of file rules_base.cpp.

References _chrom1, _chrom2, _origin, forceEvaluation(), and OriginCrossover.

Referenced by Garp::crossover().

Here is the call graph for this function:

double GarpRule::evaluate ( const OccurrencesPtr occs)

Definition at line 297 of file rules_base.cpp.

References _performance, error, Log::error(), getCertainty(), getError(), getStrength(), Log::instance(), and MIN_SIG_NO.

Referenced by Garp::evaluate().

Here is the call graph for this function:

void GarpRule::evaluated ( )
inline

Definition at line 155 of file rules_base.hh.

References _needsEvaluation.

void GarpRule::forceEvaluation ( )
inline

Definition at line 154 of file rules_base.hh.

References _needsEvaluation.

Referenced by crossover(), and Garp::select().

int GarpRule::getCertainty ( const Scalar  pred) const
virtual

Definition at line 183 of file rules_base.cpp.

References _prediction.

Referenced by evaluate(), and TEST().

const Sample& GarpRule::getChrom1 ( ) const
inline

Definition at line 159 of file rules_base.hh.

References _chrom1.

Referenced by Garp::_getConfiguration(), and TEST().

const Sample& GarpRule::getChrom2 ( ) const
inline

Definition at line 160 of file rules_base.hh.

References _chrom2.

Referenced by Garp::_getConfiguration(), and TEST().

double GarpRule::getError ( const Scalar  predefinedValue,
const Scalar  prediction 
) const
virtual

Definition at line 189 of file rules_base.cpp.

Referenced by evaluate(), and TEST().

double GarpRule::getPerformance ( PerfIndex  perfIndex) const
const double* GarpRule::getPerformanceArray ( ) const
inline

Definition at line 161 of file rules_base.hh.

References _performance.

Referenced by Garp::_getConfiguration().

Scalar GarpRule::getPrediction ( ) const
inline
virtual int GarpRule::getStrength ( const Sample sample) const
pure virtual

Implemented in RangeRule, NegatedRangeRule, LogitRule, ExtGarpRule, and DummyRule.

Referenced by evaluate().

void GarpRule::log ( )
virtual

Reimplemented from Rule.

Reimplemented in RangeRule, NegatedRangeRule, and LogitRule.

Definition at line 469 of file rules_base.cpp.

References _chrom1, _chrom2, _numGenes, _prediction, getPerformance(), Log::info(), Log::instance(), and PerfSig.

Referenced by NegatedRangeRule::log(), RangeRule::log(), and GarpRuleSet::log().

Here is the call graph for this function:

void GarpRule::mutate ( double  temperature)
virtual

Definition at line 250 of file rules_base.cpp.

References _chrom1, _chrom2, _needsEvaluation, _numGenes, _origin, adjustRange(), Random::get(), and OriginMutation.

Referenced by Garp::mutate().

Here is the call graph for this function:

bool GarpRule::needsEvaluation ( ) const
inline

Definition at line 153 of file rules_base.hh.

References _needsEvaluation.

int GarpRule::numGenes ( ) const
inline

Definition at line 150 of file rules_base.hh.

References _numGenes.

Referenced by ExtGarpRule::setGenes().

virtual GarpRule* GarpRule::objFactory ( ) const
pure virtual

Implemented in RangeRule, NegatedRangeRule, LogitRule, ExtGarpRule, and DummyRule.

Referenced by clone().

void GarpRule::setPrediction ( double  pred)
inline

Definition at line 156 of file rules_base.hh.

References _prediction.

Referenced by Garp::colonize().

bool GarpRule::similar ( const GarpRule compareToRule) const
virtual

Reimplemented in LogitRule.

Definition at line 271 of file rules_base.cpp.

References _chrom1, _chrom2, _numGenes, _prediction, equalEps(), and type().

Referenced by TEST().

Here is the call graph for this function:

virtual char GarpRule::type ( ) const
inlinevirtual
virtual char GarpRule::type ( ) const
inlinevirtual

Reimplemented from Rule.

Reimplemented in LogitRule, AtomicRule, NegatedRangeRule, RangeRule, RangeRule, NegatedRangeRule, and LogitRule.

Definition at line 152 of file rules_base.hh.

Member Data Documentation

Sample GarpRule::_chrom1
protected
bool GarpRule::_needsEvaluation
protected

Definition at line 189 of file rules_base.hh.

Referenced by clone(), copy(), evaluated(), forceEvaluation(), mutate(), and needsEvaluation().

char GarpRule::_origin
protected

Definition at line 190 of file rules_base.hh.

Referenced by clone(), copy(), crossover(), GarpRule(), and mutate().

double GarpRule::_performance[10]
protected

Vector for storing the performance values for the rule.

Definition at line 188 of file rules_base.hh.

Referenced by clone(), copy(), evaluate(), GarpRule(), getPerformance(), getPerformanceArray(), and DummyRule::setPerformance().


The documentation for this class was generated from the following files: