openModeller  Version 1.4.0
GarpAlgorithm Class Reference

#include <GarpAlgorithm.h>

Inheritance diagram for GarpAlgorithm:
Collaboration diagram for GarpAlgorithm:

List of all members.

Public Member Functions

int initialize ()
int iterate ()
int done () const
float getProgress () const
Scalar getValue (const Sample &x) const
int getConvergence (Scalar *const val) const
int getGeneration ()
 GarpAlgorithm ()
virtual ~GarpAlgorithm ()
RuleSetgetBestSet ()
void getInitialModel (int intSize, EnvCellSet *objTrainSet)
void updateRuleUsage ()
int ruleSetSize ()
char * getParameter2 (char *sParamName)
void setParameter (char *sParamName, char *sParamValue)
char * getSelectedLayersAsString ()
void setSelectedLayers (char *strParamValue)

Protected Member Functions

void _getConfiguration (ConfigurationPtr &) const
void _setConfiguration (const ConstConfigurationPtr &)

Private Member Functions

void initializeProperties ()
void DisplayStatus ()
void colonize (RuleSet *objRules, EnvCellSet *objTrainSet, int intNewRules)
void evaluate (RuleSet *objRules, EnvCellSet *objTrainSet)
int saveRule (int iIndex)
void measure ()
double converge ()
void select ()
void mutate ()
void crossover ()
void join ()
void updateHeuOpPerformance (char chrType)
void generate (EnvCellSet *objTestDataset)
void saveBestRules (RuleSet *toRuleSet, RuleSet *fromRuleSet)
void concatenateRuleSets (RuleSet *toRuleSet, RuleSet *fromRuleSet)

Private Attributes

RuleSet objNew
RuleSet objBest
EnvCellSetobjTrainSet
long lVersion
int Sigflag
int Postflag
int Compflag
int Adjustflag
int BioclimOnlyFlag
int LogitOnlyFlag
int RangeRuleFlag
int NegatedRuleFlag
int AtomicRuleFlag
int LogitRuleFlag
bool bGeneIsActive [MAX_ENV_LAYERS]
int iGeneIndex [MAX_ENV_LAYERS]
int iActiveGenes
int iCPUTime
int Resamples
double Accuracylimit
double MinUsage
double Mortality
int Totalgens
int Totaltrials
int Popsize
double C_rate
double M_rate
double J_rate
double I_rate
double Gapsize
int Trials
int Maxspin
double Resampling_f
double Significance
double Conv_limit
double Cutval
double Ave_current_perf
double Best
double Best_current_perf
int Best_guy
int Conv
bool Doneflag
int Experiment
int Gen
int Lost
int Spin
double Worst
double Worst_current_perf
int Heuristic [2][5]
double Convergence
int Improvements
int Resample
float _maxProgress

Detailed Description

Definition at line 33 of file GarpAlgorithm.h.


Constructor & Destructor Documentation

Definition at line 195 of file GarpAlgorithm.cpp.

References AlgorithmImpl::_normalizerPtr, initializeProperties(), objTrainSet, and GarpUtil::randomize().

Here is the call graph for this function:

Definition at line 212 of file GarpAlgorithm.cpp.

References objTrainSet.


Member Function Documentation

void GarpAlgorithm::_getConfiguration ( ConfigurationPtr config) const [protected, virtual]

Reimplemented from AlgorithmImpl.

Definition at line 1313 of file GarpAlgorithm.cpp.

References Rule::dblPerformance, done(), Rule::Gene, RuleSet::get(), iActiveGenes, Rule::intLength, objBest, RuleSet::size(), and Rule::type().

Here is the call graph for this function:

void GarpAlgorithm::_setConfiguration ( const ConstConfigurationPtr config) [protected, virtual]

Reimplemented from AlgorithmImpl.

Definition at line 1356 of file GarpAlgorithm.cpp.

References RuleSet::add(), RuleSet::clear(), Doneflag, iActiveGenes, iGeneIndex, objBest, Rule::RestoreRule(), and RuleSet::setDimension().

Here is the call graph for this function:

void GarpAlgorithm::colonize ( RuleSet objRules,
EnvCellSet objTrainSet,
int  intNewRules 
) [private]

Definition at line 828 of file GarpAlgorithm.cpp.

References RuleSet::add(), AtomicRuleFlag, bGeneIsActive, Gen, iActiveGenes, iGeneIndex, Rule::initialize(), Rule::iOrigGen, Rule::lId, LogitRuleFlag, NegatedRuleFlag, and RangeRuleFlag.

Referenced by generate(), and getInitialModel().

Here is the call graph for this function:

void GarpAlgorithm::concatenateRuleSets ( RuleSet toRuleSet,
RuleSet fromRuleSet 
) [private]

Definition at line 1055 of file GarpAlgorithm.cpp.

References RuleSet::add(), Rule::clone(), Rule::copy(), RuleSet::get(), Rule::similar(), RuleSet::size(), and Rule::type().

Here is the call graph for this function:

double GarpAlgorithm::converge ( ) [private]

Definition at line 1164 of file GarpAlgorithm.cpp.

References Conv, Convergence, Heuristic, and Improvements.

Referenced by measure().

void GarpAlgorithm::crossover ( ) [private]

Definition at line 1244 of file GarpAlgorithm.cpp.

References Rule::blnNeedsEvaluation, C_rate, Rule::chrOrigin, Rule::Gene, RuleSet::get(), Rule::intGens, Rule::intLength, objNew, Popsize, and GarpUtil::randint().

Referenced by generate().

Here is the call graph for this function:

void GarpAlgorithm::DisplayStatus ( ) [private]

Definition at line 755 of file GarpAlgorithm.cpp.

References Gen, RuleSet::getOveralPerformance(), and objBest.

Here is the call graph for this function:

int GarpAlgorithm::done ( ) const [virtual]

Return != 0 if algorithm finished.

Reimplemented from AlgorithmImpl.

Definition at line 623 of file GarpAlgorithm.cpp.

References Conv_limit, Convergence, Doneflag, Gen, Maxspin, Spin, and Totalgens.

Referenced by _getConfiguration(), generate(), getProgress(), and iterate().

void GarpAlgorithm::evaluate ( RuleSet objRules,
EnvCellSet objTrainSet 
) [private]

Definition at line 879 of file GarpAlgorithm.cpp.

References Best, BETTER, Rule::blnNeedsEvaluation, Conv, RuleSet::get(), Rule::intGens, Rule::intTrials, Rule::needsEvaluation(), RuleSet::size(), Spin, Rule::testWithData(), and Trials.

Referenced by generate().

Here is the call graph for this function:

Definition at line 60 of file GarpAlgorithm.h.

References objBest.

int GarpAlgorithm::getConvergence ( Scalar *const  val) const [virtual]

Returns the algorithm's convergence value at the moment

Reimplemented from AlgorithmImpl.

Definition at line 318 of file GarpAlgorithm.cpp.

References Convergence.

int GarpAlgorithm::getGeneration ( ) [inline]

Definition at line 54 of file GarpAlgorithm.h.

References Gen.

void GarpAlgorithm::getInitialModel ( int  intSize,
EnvCellSet objTrainSet 
)

Definition at line 1302 of file GarpAlgorithm.cpp.

References colonize(), objNew, and Popsize.

Referenced by initialize().

Here is the call graph for this function:

float GarpAlgorithm::getProgress ( ) const [virtual]

Returns progress so far (between 0.0 and 1.0)

Reimplemented from AlgorithmImpl.

Definition at line 298 of file GarpAlgorithm.cpp.

References _maxProgress, Conv_limit, Convergence, done(), Gen, and Totalgens.

Here is the call graph for this function:

Definition at line 559 of file GarpAlgorithm.cpp.

References iActiveGenes, and iGeneIndex.

Referenced by getParameter2().

Scalar GarpAlgorithm::getValue ( const Sample x) const [virtual]

The algorithm must return the occurrence probability at the given environment conditions.

Parameters:
xEnvironmental conditions.
Returns:
The occurrence probability in the range [0,1].

Implements AlgorithmImpl.

Definition at line 328 of file GarpAlgorithm.cpp.

References RuleSet::getValue(), and objBest.

Here is the call graph for this function:

int GarpAlgorithm::iterate ( ) [virtual]

One step further on the training. Return 0 if something wrong happened.

Reimplemented from AlgorithmImpl.

Definition at line 612 of file GarpAlgorithm.cpp.

References done(), generate(), and objTrainSet.

Here is the call graph for this function:

void GarpAlgorithm::join ( ) [private]

Definition at line 1175 of file GarpAlgorithm.cpp.

References Rule::blnNeedsEvaluation, Rule::chrOrigin, Rule::Gene, RuleSet::get(), Rule::intGens, Rule::intLength, J_rate, MAX_BYTE, objNew, Popsize, and GarpUtil::randint().

Referenced by generate().

Here is the call graph for this function:

void GarpAlgorithm::mutate ( ) [private]

Definition at line 1230 of file GarpAlgorithm.cpp.

References Gen, RuleSet::get(), MAX_MUTATION_TEMPERATURE, Rule::mutate(), objNew, and Popsize.

Referenced by generate().

Here is the call graph for this function:

int GarpAlgorithm::ruleSetSize ( ) [inline]

Definition at line 64 of file GarpAlgorithm.h.

References objBest, and RuleSet::size().

Here is the call graph for this function:

void GarpAlgorithm::saveBestRules ( RuleSet toRuleSet,
RuleSet fromRuleSet 
) [private]

Definition at line 1030 of file GarpAlgorithm.cpp.

void GarpAlgorithm::setSelectedLayers ( char *  strParamValue)

Definition at line 585 of file GarpAlgorithm.cpp.

References bGeneIsActive, iActiveGenes, iGeneIndex, and MAX_ENV_LAYERS.

Referenced by setParameter().

void GarpAlgorithm::updateHeuOpPerformance ( char  chrType) [private]

Definition at line 812 of file GarpAlgorithm.cpp.

References Heuristic, and Improvements.

Referenced by saveRule().


Member Data Documentation

float GarpAlgorithm::_maxProgress [mutable, private]

Definition at line 169 of file GarpAlgorithm.h.

Referenced by getProgress(), and initializeProperties().

double GarpAlgorithm::Accuracylimit [private]

Definition at line 130 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

Definition at line 111 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().

Definition at line 117 of file GarpAlgorithm.h.

Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Best [private]

Definition at line 152 of file GarpAlgorithm.h.

Referenced by evaluate(), getParameter2(), initializeProperties(), and setParameter().

Definition at line 153 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().

int GarpAlgorithm::Best_guy [private]

Definition at line 154 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().

Definition at line 113 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::C_rate [private]
int GarpAlgorithm::Compflag [private]

Definition at line 110 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Cutval [private]

Definition at line 147 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

bool GarpAlgorithm::Doneflag [mutable, private]

Definition at line 157 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Gapsize [private]

Definition at line 141 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), select(), and setParameter().

double GarpAlgorithm::I_rate [private]

Definition at line 140 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().

int GarpAlgorithm::iCPUTime [private]

Definition at line 125 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::J_rate [private]

Definition at line 139 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), join(), measure(), and setParameter().

Definition at line 114 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

Definition at line 118 of file GarpAlgorithm.h.

Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Lost [private]

Definition at line 159 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

long GarpAlgorithm::lVersion [private]

Definition at line 105 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::M_rate [private]

Definition at line 138 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().

int GarpAlgorithm::Maxspin [private]

Definition at line 143 of file GarpAlgorithm.h.

Referenced by done(), getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::MinUsage [private]

Definition at line 131 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Mortality [private]

Definition at line 132 of file GarpAlgorithm.h.

Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().

Definition at line 43 of file GarpAlgorithm.h.

Referenced by GarpAlgorithm(), initialize(), iterate(), and ~GarpAlgorithm().

int GarpAlgorithm::Postflag [private]

Definition at line 109 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

Definition at line 115 of file GarpAlgorithm.h.

Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Resample [private]

Definition at line 167 of file GarpAlgorithm.h.

Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Resamples [private]

Definition at line 128 of file GarpAlgorithm.h.

Referenced by getParameter2(), initialize(), initializeProperties(), and setParameter().

double GarpAlgorithm::Resampling_f [private]

Definition at line 144 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Sigflag [private]

Definition at line 108 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Significance [private]

Definition at line 145 of file GarpAlgorithm.h.

Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Spin [private]

Definition at line 135 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), and setParameter().

int GarpAlgorithm::Trials [private]

Definition at line 142 of file GarpAlgorithm.h.

Referenced by evaluate(), getParameter2(), initializeProperties(), and setParameter().

double GarpAlgorithm::Worst [private]

Definition at line 161 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), select(), and setParameter().

Definition at line 162 of file GarpAlgorithm.h.

Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().


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