openModeller
Version 1.4.0
|
#include <GarpAlgorithm.h>
Definition at line 33 of file GarpAlgorithm.h.
Definition at line 195 of file GarpAlgorithm.cpp.
References AlgorithmImpl::_normalizerPtr, initializeProperties(), objTrainSet, and GarpUtil::randomize().
GarpAlgorithm::~GarpAlgorithm | ( | ) | [virtual] |
Definition at line 212 of file GarpAlgorithm.cpp.
References objTrainSet.
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().
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().
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().
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().
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().
void GarpAlgorithm::DisplayStatus | ( | ) | [private] |
Definition at line 755 of file GarpAlgorithm.cpp.
References Gen, RuleSet::getOveralPerformance(), and objBest.
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().
void GarpAlgorithm::generate | ( | EnvCellSet * | objTestDataset | ) | [private] |
Definition at line 632 of file GarpAlgorithm.cpp.
References colonize(), Conv, crossover(), RuleSet::discardRules(), done(), Doneflag, evaluate(), Gen, join(), measure(), Mortality, mutate(), objBest, objNew, Popsize, Resample, EnvCellSet::resampleInPlace(), saveRule(), select(), Significance, RuleSet::size(), Spin, and RuleSet::trim().
Referenced by iterate().
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().
char * GarpAlgorithm::getParameter2 | ( | char * | sParamName | ) |
Definition at line 416 of file GarpAlgorithm.cpp.
References Accuracylimit, Adjustflag, AtomicRuleFlag, Ave_current_perf, Best, Best_current_perf, Best_guy, BioclimOnlyFlag, C_rate, Compflag, Conv, Conv_limit, Convergence, Cutval, Doneflag, Experiment, Gapsize, Gen, getSelectedLayersAsString(), Heuristic, I_rate, iCPUTime, Improvements, J_rate, LogitOnlyFlag, LogitRuleFlag, Lost, lVersion, M_rate, Maxspin, MinUsage, Mortality, NegatedRuleFlag, Popsize, Postflag, RangeRuleFlag, Resample, Resamples, Resampling_f, Sigflag, Significance, Spin, Totalgens, Totaltrials, Trials, Worst, and Worst_current_perf.
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.
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.
x | Environmental conditions. |
Implements AlgorithmImpl.
Definition at line 328 of file GarpAlgorithm.cpp.
References RuleSet::getValue(), and objBest.
int GarpAlgorithm::initialize | ( | ) | [virtual] |
Initiate a new training.
Implements AlgorithmImpl.
Definition at line 224 of file GarpAlgorithm.cpp.
References AlgorithmImpl::_samp, EnvCellSet::add(), Conv_limit, EnvCellSet::createBioclimHistogram(), Log::error(), getInitialModel(), AlgorithmImpl::getParameter(), iActiveGenes, EnvCellSet::initialize(), Log::instance(), objBest, objNew, objTrainSet, Popsize, Resamples, RuleSet::setDimension(), and Totalgens.
void GarpAlgorithm::initializeProperties | ( | ) | [private] |
Definition at line 334 of file GarpAlgorithm.cpp.
References _maxProgress, Accuracylimit, Adjustflag, AtomicRuleFlag, Ave_current_perf, Best, Best_current_perf, Best_guy, bGeneIsActive, BioclimOnlyFlag, C_rate, Compflag, Conv, Conv_limit, Convergence, Cutval, Doneflag, Experiment, Gapsize, Gen, Heuristic, I_rate, iActiveGenes, iCPUTime, iGeneIndex, Improvements, J_rate, LogitOnlyFlag, LogitRuleFlag, Lost, lVersion, M_rate, MAX_ENV_LAYERS, Maxspin, MinUsage, Mortality, NegatedRuleFlag, Popsize, Postflag, RangeRuleFlag, Resample, Resamples, Resampling_f, Sigflag, Significance, Spin, Totalgens, Totaltrials, Trials, Worst, and Worst_current_perf.
Referenced by GarpAlgorithm().
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.
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().
void GarpAlgorithm::measure | ( | ) | [private] |
Definition at line 691 of file GarpAlgorithm.cpp.
References Adjustflag, Ave_current_perf, Best_current_perf, Best_guy, BETTER, C_rate, converge(), Convergence, Rule::dblPerformance, Gapsize, RuleSet::get(), Heuristic, I_rate, J_rate, M_rate, objBest, Popsize, RuleSet::size(), and Worst_current_perf.
Referenced by generate().
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().
int GarpAlgorithm::ruleSetSize | ( | ) | [inline] |
Definition at line 64 of file GarpAlgorithm.h.
References objBest, and RuleSet::size().
void GarpAlgorithm::saveBestRules | ( | RuleSet * | toRuleSet, |
RuleSet * | fromRuleSet | ||
) | [private] |
Definition at line 1030 of file GarpAlgorithm.cpp.
int GarpAlgorithm::saveRule | ( | int | iIndex | ) | [private] |
Definition at line 921 of file GarpAlgorithm.cpp.
References RuleSet::add(), Rule::chrOrigin, Rule::clone(), Rule::dblPerformance, RuleSet::get(), Rule::intGenes, RuleSet::intRules, Rule::intTrials, objBest, objNew, RuleSet::objRules, Popsize, Rule::similar(), RuleSet::size(), Rule::type(), and updateHeuOpPerformance().
Referenced by generate().
void GarpAlgorithm::select | ( | ) | [private] |
Definition at line 1089 of file GarpAlgorithm.cpp.
References RuleSet::add(), Ave_current_perf, Rule::blnNeedsEvaluation, RuleSet::clear(), Rule::clone(), Rule::dblPerformance, Gapsize, RuleSet::get(), MAX_RULES, Maxflag, objBest, objNew, RuleSet::objRules, Popsize, GarpUtil::randint(), GarpUtil::random(), RuleSet::size(), and Worst.
Referenced by generate().
void GarpAlgorithm::setParameter | ( | char * | sParamName, |
char * | sParamValue | ||
) |
Definition at line 496 of file GarpAlgorithm.cpp.
References Accuracylimit, Adjustflag, AtomicRuleFlag, Ave_current_perf, Best, Best_current_perf, Best_guy, BioclimOnlyFlag, C_rate, Compflag, Conv, Conv_limit, Convergence, Cutval, Doneflag, Experiment, Gapsize, Gen, Heuristic, I_rate, iCPUTime, Improvements, J_rate, LogitOnlyFlag, LogitRuleFlag, Lost, lVersion, M_rate, Maxspin, MinUsage, Mortality, NegatedRuleFlag, Popsize, Postflag, RangeRuleFlag, Resample, Resamples, Resampling_f, setSelectedLayers(), Sigflag, Significance, Spin, Totalgens, Totaltrials, Trials, Worst, and Worst_current_perf.
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 | ( | ) |
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().
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] |
Definition at line 137 of file GarpAlgorithm.h.
Referenced by crossover(), getParameter2(), initializeProperties(), measure(), and setParameter().
int GarpAlgorithm::Compflag [private] |
Definition at line 110 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
int GarpAlgorithm::Conv [private] |
Definition at line 155 of file GarpAlgorithm.h.
Referenced by converge(), evaluate(), generate(), getParameter2(), initializeProperties(), and setParameter().
double GarpAlgorithm::Conv_limit [private] |
Definition at line 146 of file GarpAlgorithm.h.
Referenced by done(), getParameter2(), getProgress(), initialize(), initializeProperties(), and setParameter().
double GarpAlgorithm::Convergence [private] |
Definition at line 164 of file GarpAlgorithm.h.
Referenced by converge(), done(), getConvergence(), getParameter2(), getProgress(), initializeProperties(), measure(), 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 156 of file GarpAlgorithm.h.
Referenced by _setConfiguration(), done(), generate(), getParameter2(), initializeProperties(), and setParameter().
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] |
Definition at line 158 of file GarpAlgorithm.h.
Referenced by colonize(), DisplayStatus(), done(), generate(), getGeneration(), getParameter2(), getProgress(), initializeProperties(), mutate(), and setParameter().
int GarpAlgorithm::Heuristic[2][5] [private] |
Definition at line 163 of file GarpAlgorithm.h.
Referenced by converge(), getParameter2(), initializeProperties(), measure(), setParameter(), and updateHeuOpPerformance().
double GarpAlgorithm::I_rate [private] |
Definition at line 140 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
int GarpAlgorithm::iActiveGenes [private] |
Definition at line 122 of file GarpAlgorithm.h.
Referenced by _getConfiguration(), _setConfiguration(), colonize(), getSelectedLayersAsString(), initialize(), initializeProperties(), and setSelectedLayers().
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] |
Definition at line 121 of file GarpAlgorithm.h.
Referenced by _setConfiguration(), colonize(), getSelectedLayersAsString(), initializeProperties(), and setSelectedLayers().
int GarpAlgorithm::Improvements [private] |
Definition at line 165 of file GarpAlgorithm.h.
Referenced by converge(), getParameter2(), initializeProperties(), setParameter(), and updateHeuOpPerformance().
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::objBest [private] |
Definition at line 40 of file GarpAlgorithm.h.
Referenced by _getConfiguration(), _setConfiguration(), DisplayStatus(), generate(), getBestSet(), getValue(), initialize(), measure(), ruleSetSize(), saveRule(), and select().
RuleSet GarpAlgorithm::objNew [private] |
Definition at line 37 of file GarpAlgorithm.h.
Referenced by crossover(), generate(), getInitialModel(), initialize(), join(), mutate(), saveRule(), and select().
EnvCellSet* GarpAlgorithm::objTrainSet [private] |
Definition at line 43 of file GarpAlgorithm.h.
Referenced by GarpAlgorithm(), initialize(), iterate(), and ~GarpAlgorithm().
int GarpAlgorithm::Popsize [private] |
Definition at line 136 of file GarpAlgorithm.h.
Referenced by crossover(), generate(), getInitialModel(), getParameter2(), initialize(), initializeProperties(), join(), measure(), mutate(), saveRule(), select(), and setParameter().
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] |
Definition at line 160 of file GarpAlgorithm.h.
Referenced by done(), evaluate(), generate(), getParameter2(), initializeProperties(), and setParameter().
int GarpAlgorithm::Totalgens [private] |
Definition at line 134 of file GarpAlgorithm.h.
Referenced by done(), getParameter2(), getProgress(), initialize(), initializeProperties(), and setParameter().
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().