openModeller
Version 1.5.0
|
#include <GarpAlgorithm.h>
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 () |
RuleSet * | getBestSet () |
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 () |
Normalizer * | getNormalizer () 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 |
EnvCellSet * | objTrainSet |
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 |
Definition at line 33 of file GarpAlgorithm.h.
GarpAlgorithm::GarpAlgorithm | ( | ) |
Definition at line 195 of file GarpAlgorithm.cpp.
References AlgorithmImpl::_normalizerPtr, initializeProperties(), objTrainSet, and GarpUtil::randomize().
|
virtual |
Definition at line 212 of file GarpAlgorithm.cpp.
References objTrainSet.
|
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().
|
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().
|
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().
Definition at line 1055 of file GarpAlgorithm.cpp.
References RuleSet::add(), Rule::clone(), Rule::copy(), RuleSet::get(), Rule::similar(), RuleSet::size(), and Rule::type().
|
private |
Definition at line 1164 of file GarpAlgorithm.cpp.
References Conv, Convergence, Heuristic, and Improvements.
Referenced by measure().
|
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().
|
private |
Definition at line 755 of file GarpAlgorithm.cpp.
References Gen, RuleSet::getOveralPerformance(), and objBest.
|
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().
|
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().
|
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().
|
inline |
Definition at line 60 of file GarpAlgorithm.h.
References objBest.
|
virtual |
Returns the algorithm's convergence value at the moment
Reimplemented from AlgorithmImpl.
Definition at line 318 of file GarpAlgorithm.cpp.
References Convergence.
|
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.
|
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().
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.
|
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.
|
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().
|
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.
|
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().
|
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().
|
private |
Definition at line 1230 of file GarpAlgorithm.cpp.
References Gen, RuleSet::get(), MAX_MUTATION_TEMPERATURE, Rule::mutate(), objNew, and Popsize.
Referenced by generate().
|
inline |
Definition at line 64 of file GarpAlgorithm.h.
References objBest, and RuleSet::size().
Definition at line 1030 of file GarpAlgorithm.cpp.
|
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().
|
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().
|
private |
Definition at line 812 of file GarpAlgorithm.cpp.
References Heuristic, and Improvements.
Referenced by saveRule().
void GarpAlgorithm::updateRuleUsage | ( | ) |
|
mutableprivate |
Definition at line 169 of file GarpAlgorithm.h.
Referenced by getProgress(), and initializeProperties().
|
private |
Definition at line 130 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 111 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 117 of file GarpAlgorithm.h.
Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 151 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), select(), and setParameter().
|
private |
Definition at line 152 of file GarpAlgorithm.h.
Referenced by evaluate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 153 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 154 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 120 of file GarpAlgorithm.h.
Referenced by colonize(), initializeProperties(), and setSelectedLayers().
|
private |
Definition at line 113 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 137 of file GarpAlgorithm.h.
Referenced by crossover(), getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 110 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 155 of file GarpAlgorithm.h.
Referenced by converge(), evaluate(), generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 146 of file GarpAlgorithm.h.
Referenced by done(), getParameter2(), getProgress(), initialize(), initializeProperties(), and setParameter().
|
private |
Definition at line 164 of file GarpAlgorithm.h.
Referenced by converge(), done(), getConvergence(), getParameter2(), getProgress(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 147 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
mutableprivate |
Definition at line 156 of file GarpAlgorithm.h.
Referenced by _setConfiguration(), done(), generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 157 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 141 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), select(), and setParameter().
|
private |
Definition at line 158 of file GarpAlgorithm.h.
Referenced by colonize(), DisplayStatus(), done(), generate(), getGeneration(), getParameter2(), getProgress(), initializeProperties(), mutate(), and setParameter().
|
private |
Definition at line 163 of file GarpAlgorithm.h.
Referenced by converge(), getParameter2(), initializeProperties(), measure(), setParameter(), and updateHeuOpPerformance().
|
private |
Definition at line 140 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 122 of file GarpAlgorithm.h.
Referenced by _getConfiguration(), _setConfiguration(), colonize(), getSelectedLayersAsString(), initialize(), initializeProperties(), and setSelectedLayers().
|
private |
Definition at line 125 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 121 of file GarpAlgorithm.h.
Referenced by _setConfiguration(), colonize(), getSelectedLayersAsString(), initializeProperties(), and setSelectedLayers().
|
private |
Definition at line 165 of file GarpAlgorithm.h.
Referenced by converge(), getParameter2(), initializeProperties(), setParameter(), and updateHeuOpPerformance().
|
private |
Definition at line 139 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), join(), measure(), and setParameter().
|
private |
Definition at line 114 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 118 of file GarpAlgorithm.h.
Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 159 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 105 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 138 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().
|
private |
Definition at line 143 of file GarpAlgorithm.h.
Referenced by done(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 131 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 132 of file GarpAlgorithm.h.
Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 116 of file GarpAlgorithm.h.
Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 40 of file GarpAlgorithm.h.
Referenced by _getConfiguration(), _setConfiguration(), DisplayStatus(), generate(), getBestSet(), getValue(), initialize(), measure(), ruleSetSize(), saveRule(), and select().
|
private |
Definition at line 37 of file GarpAlgorithm.h.
Referenced by crossover(), generate(), getInitialModel(), initialize(), join(), mutate(), saveRule(), and select().
|
private |
Definition at line 43 of file GarpAlgorithm.h.
Referenced by GarpAlgorithm(), initialize(), iterate(), and ~GarpAlgorithm().
|
private |
Definition at line 136 of file GarpAlgorithm.h.
Referenced by crossover(), generate(), getInitialModel(), getParameter2(), initialize(), initializeProperties(), join(), measure(), mutate(), saveRule(), select(), and setParameter().
|
private |
Definition at line 109 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 115 of file GarpAlgorithm.h.
Referenced by colonize(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 167 of file GarpAlgorithm.h.
Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 128 of file GarpAlgorithm.h.
Referenced by getParameter2(), initialize(), initializeProperties(), and setParameter().
|
private |
Definition at line 144 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 108 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 145 of file GarpAlgorithm.h.
Referenced by generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 160 of file GarpAlgorithm.h.
Referenced by done(), evaluate(), generate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 134 of file GarpAlgorithm.h.
Referenced by done(), getParameter2(), getProgress(), initialize(), initializeProperties(), and setParameter().
|
private |
Definition at line 135 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 142 of file GarpAlgorithm.h.
Referenced by evaluate(), getParameter2(), initializeProperties(), and setParameter().
|
private |
Definition at line 161 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), select(), and setParameter().
|
private |
Definition at line 162 of file GarpAlgorithm.h.
Referenced by getParameter2(), initializeProperties(), measure(), and setParameter().