openModeller  Version 1.4.0
GarpRule Class Reference

#include <Rule.h>

Inheritance diagram for GarpRule:
Collaboration diagram for GarpRule:

List of all members.

Public Member Functions

 GarpRule ()
virtual ~GarpRule ()
virtual char type () const
 GarpRule ()
 Default constructor.
 GarpRule (const int numGenes)
 Constructor with defined size.
 GarpRule (Scalar prediction, int numGenes, const Sample &chrom1, const Sample &chrom2, const double *performances)
 Constructor with setters.
virtual ~GarpRule ()
 Default destructor.
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 ()

Protected Attributes

Sample _chrom1
 BYTE vector containing the genes (representation of the variables in a Genetic Algorithm.
Sample _chrom2
Scalar _prediction
int _numGenes
 Number of genes stored by the rule.
double _performance [10]
 Vector for storing the performance values for the rule.
bool _needsEvaluation
char _origin

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

Definition at line 492 of file Rule.cpp.

GarpRule::~GarpRule ( ) [virtual]

Definition at line 495 of file Rule.cpp.

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().

const double* GarpRule::getPerformanceArray ( ) const [inline]

Definition at line 161 of file rules_base.hh.

References _performance.

Referenced by Garp::_getConfiguration().

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 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]

Reimplemented in ExtGarpRule.

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 [inline, virtual]
virtual char GarpRule::type ( ) const [inline, virtual]

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

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: