openModeller  Version 1.5.0
GarpAlgorithm Class Reference

#include <GarpAlgorithm.h>

Inheritance diagram for GarpAlgorithm:
Inheritance graph
Collaboration diagram for GarpAlgorithm:
Collaboration graph

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)
 
- Public Member Functions inherited from AlgorithmImpl
 AlgorithmImpl (AlgMetadata const *metadata)
 
virtual ~AlgorithmImpl ()
 
void setParameters (int nparam, AlgParameter const *param)
 
void setParameters (const ParamSetType &)
 
std::string const getID () const
 
AlgMetadata const * getMetadata () const
 
AlgorithmPtr getFreshCopy ()
 
virtual int supportsModelProjection () const
 
Model createModel (const SamplerPtr &samp, CallbackWrapper *func=0)
 
void setSampler (const SamplerPtr &samp)
 
virtual int finalize ()
 
virtual int needNormalization ()
 
NormalizergetNormalizer () const
 
void setNormalization (const SamplerPtr &samp) const
 
void setNormalization (const EnvironmentPtr &env) const
 
virtual Model getModel () const
 
ConfigurationPtr getConfiguration () const
 
void setConfiguration (const ConstConfigurationPtr &)
 
- Public Member Functions inherited from Configurable
virtual ~Configurable ()
 

Protected Member Functions

void _getConfiguration (ConfigurationPtr &) const
 
void _setConfiguration (const ConstConfigurationPtr &)
 
- Protected Member Functions inherited from AlgorithmImpl
int dimDomain ()
 
int getParameter (std::string const &name, std::string *value)
 
int getParameter (std::string const &name, double *value)
 
int getParameter (std::string const &name, float *value)
 
int getParameter (std::string const &name, int *value)
 

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
 

Additional Inherited Members

- Public Types inherited from AlgorithmImpl
typedef std::map< icstring,
std::string > 
ParamSetType
 
- Protected Attributes inherited from AlgorithmImpl
SamplerPtr _samp
 
Normalizer_normalizerPtr
 
ParamSetType _param
 

Detailed Description

Definition at line 33 of file GarpAlgorithm.h.

Constructor & Destructor Documentation

GarpAlgorithm::GarpAlgorithm ( )

Definition at line 195 of file GarpAlgorithm.cpp.

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

Here is the call graph for this function:

GarpAlgorithm::~GarpAlgorithm ( )
virtual

Definition at line 212 of file GarpAlgorithm.cpp.

References objTrainSet.

Member Function Documentation

void GarpAlgorithm::_getConfiguration ( ConfigurationPtr config) const
protectedvirtual

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)
protectedvirtual

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:

void GarpAlgorithm::generate ( EnvCellSet objTestDataset)
private
RuleSet* GarpAlgorithm::getBestSet ( )
inline

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:

char * GarpAlgorithm::getSelectedLayersAsString ( )

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::initialize ( )
virtual
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::measure ( )
private
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.

int GarpAlgorithm::saveRule ( int  iIndex)
private
void GarpAlgorithm::select ( )
private
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().

void GarpAlgorithm::updateRuleUsage ( )

Member Data Documentation

float GarpAlgorithm::_maxProgress
mutableprivate

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

int GarpAlgorithm::Adjustflag
private

Definition at line 111 of file GarpAlgorithm.h.

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

int GarpAlgorithm::AtomicRuleFlag
private

Definition at line 117 of file GarpAlgorithm.h.

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

double GarpAlgorithm::Ave_current_perf
private

Definition at line 151 of file GarpAlgorithm.h.

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

double GarpAlgorithm::Best
private

Definition at line 152 of file GarpAlgorithm.h.

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

double GarpAlgorithm::Best_current_perf
private

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

bool GarpAlgorithm::bGeneIsActive[MAX_ENV_LAYERS]
private

Definition at line 120 of file GarpAlgorithm.h.

Referenced by colonize(), initializeProperties(), and setSelectedLayers().

int GarpAlgorithm::BioclimOnlyFlag
private

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

int GarpAlgorithm::Conv
private
double GarpAlgorithm::Conv_limit
private
double GarpAlgorithm::Convergence
private
double GarpAlgorithm::Cutval
private

Definition at line 147 of file GarpAlgorithm.h.

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

bool GarpAlgorithm::Doneflag
mutableprivate
int GarpAlgorithm::Experiment
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().

int GarpAlgorithm::Gen
private
int GarpAlgorithm::Heuristic[2][5]
private
double GarpAlgorithm::I_rate
private

Definition at line 140 of file GarpAlgorithm.h.

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

int GarpAlgorithm::iActiveGenes
private
int GarpAlgorithm::iCPUTime
private

Definition at line 125 of file GarpAlgorithm.h.

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

int GarpAlgorithm::iGeneIndex[MAX_ENV_LAYERS]
private
int GarpAlgorithm::Improvements
private
double GarpAlgorithm::J_rate
private

Definition at line 139 of file GarpAlgorithm.h.

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

int GarpAlgorithm::LogitOnlyFlag
private

Definition at line 114 of file GarpAlgorithm.h.

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

int GarpAlgorithm::LogitRuleFlag
private

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

int GarpAlgorithm::NegatedRuleFlag
private

Definition at line 116 of file GarpAlgorithm.h.

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

RuleSet GarpAlgorithm::objNew
private
EnvCellSet* GarpAlgorithm::objTrainSet
private

Definition at line 43 of file GarpAlgorithm.h.

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

int GarpAlgorithm::Popsize
private
int GarpAlgorithm::Postflag
private

Definition at line 109 of file GarpAlgorithm.h.

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

int GarpAlgorithm::RangeRuleFlag
private

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
int GarpAlgorithm::Totalgens
private
int GarpAlgorithm::Totaltrials
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().

double GarpAlgorithm::Worst_current_perf
private

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: