Gadget
|
This is the class used to store information about the variables that are used in model simulation. More...
#include <keeper.h>
Public Member Functions | |
Keeper () | |
This is the default Keeper constructor. More... | |
~Keeper () | |
This is the default Keeper destructor. More... | |
void | keepVariable (double &value, Parameter &attr) |
This function will register a variable in the internal list, along with an initial value. More... | |
void | deleteParameter (const double &var) |
This function will delete a variable from the internal list. More... | |
void | changeVariable (const double &pre, double &post) |
This function will replace the value of a variable with a new value. More... | |
void | setString (const char *str) |
This function will set the text string that is used to describe a variable. More... | |
void | addString (const char *str) |
This function will add a text string that is used to describe a variable. More... | |
void | addString (const string str) |
This function will add a text string that is used to describe a variable. More... | |
void | clearLast () |
This function will remove the last text string from the list used to describe variables. More... | |
void | clearAll () |
This function will remove all of the text strings from the list used to describe variables. More... | |
void | storeVariables (double likvalue, const DoubleVector &point) |
This function will store the current value of the variables from the optimisation process. More... | |
void | resetVariables () |
This function will reset the variables that have been scaled, to be optimised using the Simulated Annealing optimisation algorithm. More... | |
void | scaleVariables () |
This function will scale the variables to be optimised, for the Hooke & Jeeves and BFGS optimisation algorithms. More... | |
void | getOptFlags (IntVector &opt) const |
This function will return a copy of the flags to denote which variables will be optimsised. More... | |
void | getSwitches (ParameterVector &sw) const |
This function will return a copy of the names of the variables. More... | |
void | getLowerBounds (DoubleVector &lbs) const |
This function will return a copy of the lower bounds of the variables. More... | |
void | getUpperBounds (DoubleVector &ubs) const |
This function will return a copy of the upper bounds of the variables. More... | |
void | getInitialValues (DoubleVector &val) const |
This function will return a copy of the initial value of the variables. More... | |
void | getScaledValues (DoubleVector &val) const |
This function will return a copy of the scaled value of the variables. More... | |
void | getCurrentValues (DoubleVector &val) const |
This function will return a copy of the current value of the variables. More... | |
void | getOptLowerBounds (DoubleVector &lbs) const |
This function will return a copy of the lower bounds of the variables to be optimised. More... | |
void | getOptUpperBounds (DoubleVector &ubs) const |
This function will return a copy of the upper bounds of the variables to be optimised. More... | |
void | getOptInitialValues (DoubleVector &val) const |
This function will return a copy of the initial value of the variables to be optimised. More... | |
void | getOptScaledValues (DoubleVector &val) const |
This function will return a copy of the scaled value of the variables to be optimised. More... | |
int | numVariables () const |
This function will return the number of variables. More... | |
int | numOptVariables () const |
This function will return the number of variables to be optimised. More... | |
void | Update (int pos, double &value) |
This function will update one Keeper variable with a new value. More... | |
void | Update (const DoubleVector &val) |
This function will update the Keeper variables with new values from a vector. More... | |
void | Update (const StochasticData *const Stoch) |
This function will update the Keeper variables with new values from StochasticData. More... | |
void | openPrintFile (const char *const filename) |
This function will open the output file and write header information. More... | |
void | writeInitialInformation (const LikelihoodPtrVector &likevec) |
This function will write header information about the model parameters to file. More... | |
void | writeValues (const LikelihoodPtrVector &likevec, int prec) |
This function will write current information about the model parameters to file. More... | |
void | writeParams (const OptInfoPtrVector &optvec, const char *const filename, int prec, int interrupt) |
This function will write final information about the model parameters to file in a column format (which can then be used as the starting point for a subsequent model run) More... | |
void | writeBestValues () |
This function will display information about the best values of the parameters found so far during an optimisation run. More... | |
void | checkBounds (const LikelihoodPtrVector &likevec) const |
This function will check that the values of the parameters are within the bounds specified in the input file. More... | |
int | boundsGiven () const |
This function will return the flag used to denote whether the bounds of the parameters have been specified or not. More... | |
double | getBestLikelihoodScore () const |
This function will return the best likelihood score found so far by the optimisation process. More... | |
Protected Attributes | |
AddressKeeperMatrix | address |
This is the AddressKeeperMatrix used to store information about the value and name of the parameters. More... | |
DoubleVector | initialvalues |
This is the DoubleVector used to store the initial values of the parameters. More... | |
DoubleVector | scaledvalues |
This is the DoubleVector used to store the scaled values of the parameters. More... | |
DoubleVector | values |
This is the DoubleVector used to store the values of the parameters. More... | |
DoubleVector | bestvalues |
This is the DoubleVector used to store the best values of the parameters that the optimisation process has found so far. More... | |
IntVector | opt |
This is the IntVector used to store information about whether the parameters are to be optimised. More... | |
StrStack * | stack |
This is the StrStack used to store information about the use of the parameters. More... | |
ParameterVector | switches |
This is the ParameterVector used to store information about the names of the parameters. More... | |
DoubleVector | lowerbds |
This is the DoubleVector used to store information about the lower bounds of the parameters. More... | |
DoubleVector | upperbds |
This is the DoubleVector used to store information about the upper bounds of the parameters. More... | |
int | numoptvar |
This is the number of parameters to be optimised. More... | |
int | boundsgiven |
This is the flag used to denote whether the bounds of the parameters have been specified or not. More... | |
double | bestlikelihood |
This is the best likelihood score found so far by the optimisation process. More... | |
int | fileopen |
This is the flag used to denote whether an output file has been specified or not. More... | |
ofstream | outfile |
This ofstream is the file that all the parameter information gets sent to. More... | |
This is the class used to store information about the variables that are used in model simulation.
This class stores all the information about the variables that are used in the model simulation. This includes the current value, the initial value and best value found so far by any optimisation routines, the upper and lower bounds for the variables and a flag to denote whether the variable is to be optimised or not. This class also updates the model parameters with new values for the variables, either as a result of the optimisation routines or when new values for the parameters are received from the network if the simulation is part of a parallel optimisation, using paramin.
Keeper::Keeper | ( | ) |
This is the default Keeper constructor.
Keeper::~Keeper | ( | ) |
This is the default Keeper destructor.
void Keeper::addString | ( | const char * | str | ) |
This function will add a text string that is used to describe a variable.
str | is the text string to be stored |
void Keeper::addString | ( | const string | str | ) |
This function will add a text string that is used to describe a variable.
str | is the text string to be stored |
|
inline |
This function will return the flag used to denote whether the bounds of the parameters have been specified or not.
void Keeper::changeVariable | ( | const double & | pre, |
double & | post | ||
) |
This function will replace the value of a variable with a new value.
pre | is the old value for the variable |
post | is the new value for the variable |
void Keeper::checkBounds | ( | const LikelihoodPtrVector & | likevec | ) | const |
This function will check that the values of the parameters are within the bounds specified in the input file.
likevec | is the LikelihoodPtrVector containing the likelihood components for the current model |
void Keeper::clearAll | ( | ) |
This function will remove all of the text strings from the list used to describe variables.
void Keeper::clearLast | ( | ) |
This function will remove the last text string from the list used to describe variables.
void Keeper::deleteParameter | ( | const double & | var | ) |
This function will delete a variable from the internal list.
var | is the value for the variable |
|
inline |
This function will return the best likelihood score found so far by the optimisation process.
void Keeper::getCurrentValues | ( | DoubleVector & | val | ) | const |
This function will return a copy of the current value of the variables.
val | is the DoubleVector that will contain a copy of the current values |
void Keeper::getInitialValues | ( | DoubleVector & | val | ) | const |
This function will return a copy of the initial value of the variables.
val | is the DoubleVector that will contain a copy of the initial values |
void Keeper::getLowerBounds | ( | DoubleVector & | lbs | ) | const |
This function will return a copy of the lower bounds of the variables.
lbs | is the DoubleVector that will contain a copy of the lower bounds |
void Keeper::getOptFlags | ( | IntVector & | opt | ) | const |
This function will return a copy of the flags to denote which variables will be optimsised.
opt | is the IntVector that will contain a copy of the flags |
void Keeper::getOptInitialValues | ( | DoubleVector & | val | ) | const |
This function will return a copy of the initial value of the variables to be optimised.
val | is the DoubleVector that will contain a copy of the initial values |
void Keeper::getOptLowerBounds | ( | DoubleVector & | lbs | ) | const |
This function will return a copy of the lower bounds of the variables to be optimised.
lbs | is the DoubleVector that will contain a copy of the lower bounds |
void Keeper::getOptScaledValues | ( | DoubleVector & | val | ) | const |
This function will return a copy of the scaled value of the variables to be optimised.
val | is the DoubleVector that will contain a copy of the scaled values |
void Keeper::getOptUpperBounds | ( | DoubleVector & | ubs | ) | const |
This function will return a copy of the upper bounds of the variables to be optimised.
ubs | is the DoubleVector that will contain a copy of the upper bounds |
void Keeper::getScaledValues | ( | DoubleVector & | val | ) | const |
This function will return a copy of the scaled value of the variables.
val | is the DoubleVector that will contain a copy of the scaled values |
void Keeper::getSwitches | ( | ParameterVector & | sw | ) | const |
This function will return a copy of the names of the variables.
sw | is the ParameterVector that will contain a copy of the names |
void Keeper::getUpperBounds | ( | DoubleVector & | ubs | ) | const |
This function will return a copy of the upper bounds of the variables.
ubs | is the DoubleVector that will contain a copy of the upper bounds |
void Keeper::keepVariable | ( | double & | value, |
Parameter & | attr | ||
) |
This function will register a variable in the internal list, along with an initial value.
value | is the value for the variable |
attr | is the name of the Parameter for the variable |
|
inline |
This function will return the number of variables to be optimised.
int Keeper::numVariables | ( | ) | const |
This function will return the number of variables.
void Keeper::openPrintFile | ( | const char *const | filename | ) |
This function will open the output file and write header information.
filename | is the name of the file to write the model information to |
void Keeper::resetVariables | ( | ) |
This function will reset the variables that have been scaled, to be optimised using the Simulated Annealing optimisation algorithm.
void Keeper::scaleVariables | ( | ) |
This function will scale the variables to be optimised, for the Hooke & Jeeves and BFGS optimisation algorithms.
void Keeper::setString | ( | const char * | str | ) |
This function will set the text string that is used to describe a variable.
str | is the text string to be stored |
void Keeper::storeVariables | ( | double | likvalue, |
const DoubleVector & | point | ||
) |
This function will store the current value of the variables from the optimisation process.
likvalue | is the current likelihood value |
point | is the DoubleVector of the current parameter values |
void Keeper::Update | ( | const DoubleVector & | val | ) |
This function will update the Keeper variables with new values from a vector.
val | is the DoubleVector containing the new values of the variables |
void Keeper::Update | ( | const StochasticData *const | Stoch | ) |
This function will update the Keeper variables with new values from StochasticData.
Stoch | is the StochasticData containing the new values of the variables |
void Keeper::Update | ( | int | pos, |
double & | value | ||
) |
This function will update one Keeper variable with a new value.
pos | is the identifier of the variable to update |
value | is the new value of the variable |
void Keeper::writeBestValues | ( | ) |
This function will display information about the best values of the parameters found so far during an optimisation run.
void Keeper::writeInitialInformation | ( | const LikelihoodPtrVector & | likevec | ) |
This function will write header information about the model parameters to file.
likevec | is the LikelihoodPtrVector containing the likelihood components for the current model |
void Keeper::writeParams | ( | const OptInfoPtrVector & | optvec, |
const char *const | filename, | ||
int | prec, | ||
int | interrupt | ||
) |
This function will write final information about the model parameters to file in a column format (which can then be used as the starting point for a subsequent model run)
optvec | is the OptInfoPtrVector containing the optimisation algorithms used for the current model |
filename | is the name of the file to write the model information to |
prec | is the precision to use in the output file |
interrupt | is the flag to denote whether the current run was interrupted by the user or not |
void Keeper::writeValues | ( | const LikelihoodPtrVector & | likevec, |
int | prec | ||
) |
This function will write current information about the model parameters to file.
likevec | is the LikelihoodPtrVector containing the likelihood components for the current model |
prec | is the precision to use in the output file |
|
protected |
This is the AddressKeeperMatrix used to store information about the value and name of the parameters.
|
protected |
This is the best likelihood score found so far by the optimisation process.
|
protected |
This is the DoubleVector used to store the best values of the parameters that the optimisation process has found so far.
|
protected |
This is the flag used to denote whether the bounds of the parameters have been specified or not.
|
protected |
This is the flag used to denote whether an output file has been specified or not.
|
protected |
This is the DoubleVector used to store the initial values of the parameters.
|
protected |
This is the DoubleVector used to store information about the lower bounds of the parameters.
|
protected |
This is the number of parameters to be optimised.
|
protected |
This is the IntVector used to store information about whether the parameters are to be optimised.
|
protected |
This ofstream is the file that all the parameter information gets sent to.
|
protected |
This is the DoubleVector used to store the scaled values of the parameters.
|
protected |
This is the StrStack used to store information about the use of the parameters.
|
protected |
This is the ParameterVector used to store information about the names of the parameters.
|
protected |
This is the DoubleVector used to store information about the upper bounds of the parameters.
|
protected |
This is the DoubleVector used to store the values of the parameters.