openModeller
Version 1.4.0
|
#include <Rule.h>
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 GarpRule * | clone () const |
virtual GarpRule * | objFactory () 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 Sample & | getChrom1 () const |
const Sample & | getChrom2 () 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 |
Base class for specific Garp rules. Provides the basic interface for methods that all kinds of Garp rules should provide.
GarpRule::~GarpRule | ( | ) | [virtual] |
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().
GarpRule::GarpRule | ( | Scalar | prediction, |
int | numGenes, | ||
const Sample & | chrom1, | ||
const Sample & | chrom2, | ||
const double * | performances | ||
) |
virtual GarpRule::~GarpRule | ( | ) | [virtual] |
Default destructor.
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] |
Implemented in RangeRule, NegatedRangeRule, LogitRule, ExtGarpRule, and DummyRule.
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().
int GarpRule::copy | ( | const GarpRule * | fromRule | ) | [virtual] |
Copy data from another rule to the current rule.
fromRule | Pointer to source rule providing data to set current rule. |
Definition at line 157 of file rules_base.cpp.
References _chrom1, _chrom2, _needsEvaluation, _origin, _performance, _prediction, and type().
Referenced by TEST().
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().
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().
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 |
Definition at line 177 of file rules_base.cpp.
References _performance.
Referenced by GarpRuleSet::gatherRuleSetStats(), GarpRuleSet::insert(), Garp::keepFittest(), LogitRule::log(), log(), GarpRuleSet::performanceSummary(), printPerfs(), and Garp::select().
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] |
Definition at line 158 of file rules_base.hh.
References _prediction.
Referenced by Garp::_getConfiguration(), GarpRuleSet::gatherRuleSetStats(), and GarpRuleSet::getValue().
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().
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().
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().
virtual char GarpRule::type | ( | ) | const [inline, virtual] |
Reimplemented from Rule.
Reimplemented in LogitRule, AtomicRule, NegatedRangeRule, RangeRule, RangeRule, NegatedRangeRule, and LogitRule.
Definition at line 122 of file Rule.h.
Referenced by Garp::_getConfiguration(), copy(), GarpRule(), GarpRuleSet::gatherRuleSetStats(), LogitRule::similar(), and similar().
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.
Sample GarpRule::_chrom1 [protected] |
BYTE vector containing the genes (representation of the variables in a Genetic Algorithm.
Definition at line 180 of file rules_base.hh.
Referenced by NegatedRangeRule::applies(), RangeRule::applies(), clone(), copy(), crossover(), getChrom1(), LogitRule::getStrength(), RangeRule::getStrength(), LogitRule::initialize(), RangeRule::initialize(), LogitRule::log(), log(), mutate(), ExtGarpRule::setGenes(), LogitRule::similar(), and similar().
Sample GarpRule::_chrom2 [protected] |
Definition at line 181 of file rules_base.hh.
Referenced by NegatedRangeRule::applies(), RangeRule::applies(), clone(), copy(), crossover(), getChrom2(), LogitRule::getStrength(), RangeRule::getStrength(), LogitRule::initialize(), RangeRule::initialize(), LogitRule::log(), log(), mutate(), ExtGarpRule::setGenes(), and similar().
bool GarpRule::_needsEvaluation [protected] |
Definition at line 189 of file rules_base.hh.
Referenced by clone(), copy(), evaluated(), forceEvaluation(), mutate(), and needsEvaluation().
int GarpRule::_numGenes [protected] |
Number of genes stored by the rule.
Definition at line 185 of file rules_base.hh.
Referenced by NegatedRangeRule::applies(), RangeRule::applies(), clone(), RangeRule::getStrength(), LogitRule::initialize(), RangeRule::initialize(), LogitRule::log(), log(), mutate(), numGenes(), ExtGarpRule::setGenes(), LogitRule::similar(), and similar().
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().
Scalar GarpRule::_prediction [protected] |
Definition at line 182 of file rules_base.hh.
Referenced by clone(), copy(), getCertainty(), getPrediction(), RangeRule::initialize(), LogitRule::log(), log(), ExtGarpRule::setPrediction(), setPrediction(), LogitRule::similar(), and similar().