Gadget
|
This is the class used to control the model simulation. More...
#include <ecosystem.h>
Public Member Functions | |
Ecosystem () | |
This is the default Ecosystem constructor. More... | |
Ecosystem (const MainInfo &main) | |
This is the Ecosystem constructor specifying details about the model. More... | |
~Ecosystem () | |
This is the default Ecosystem destructor. More... | |
void | readMain (CommentStream &infile, const MainInfo &main) |
This function will read the model data from the main input file. More... | |
void | readLikelihood (CommentStream &infile) |
This function will read the likelihood data from the input file. More... | |
void | readPrinters (CommentStream &infile) |
This function will read the printer data from the input file. More... | |
void | readFleet (CommentStream &infile) |
This function will read the fleet data from the input file. More... | |
void | readTagging (CommentStream &infile) |
This function will read the tagging data from the input file. More... | |
void | readOtherFood (CommentStream &infile) |
This function will read the otherfood data from the input file. More... | |
void | readStock (CommentStream &infile) |
This function will read the stock data from the input file. More... | |
void | readOptimisation (CommentStream &infile) |
This function will read in the optimisation parameters from the input file. More... | |
void | writeStatus (const char *filename) const |
This function will write the current model status to file. More... | |
void | writeInitialInformation (const char *const filename) |
This function will write header information about the model parameters to file. More... | |
void | writeValues () |
This function will write current information about the model parameters to file. More... | |
void | writeParams (const char *const filename, int prec) const |
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 | writeOptValues () |
This function will display information about the optimised values of the parameters. More... | |
void | Optimise () |
This is the function that will optimise the likelihood score. More... | |
void | Initialise () |
This function will initialise the Ecosystem parameters. More... | |
void | Update (const StochasticData *const Stochastic) const |
This function will update the Ecosystem parameters with new values from StochasticData. More... | |
void | Reset () |
This function will reset the Ecosystem information. 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 | 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... | |
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 | checkBounds () const |
This function will check that the values of the parameters are within the specified bounds. 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 | Simulate (int print) |
This function will simulate the population in the model. More... | |
void | updatePredationOneArea (int area=0) |
This function will calculate the predation, and update the population, on an area. More... | |
void | updatePopulationOneArea (int area=0) |
This function will update the population numbers on an area. More... | |
void | updateAgesOneArea (int area=0) |
This function will update the ages of the population on an area. More... | |
double | SimulateAndUpdate (const DoubleVector &x) |
This function will update the model parameters, run the model and calculate a likelihood score. More... | |
double | getLikelihood () const |
This function will return the likelihood score from the current simulation. More... | |
int | getFuncEval () const |
This function will return the total number of iterations completed. More... | |
int | getCurrentTime () const |
This function will return the current time in the simulation. More... | |
int | getCurrentYear () const |
This function will return the current year in the simulation. More... | |
int | getCurrentStep () const |
This function will return the current step in the simulation. More... | |
int | numTotalSteps () const |
This function will return the total number of timestep in the simulation. More... | |
LikelihoodPtrVector & | getModelLikelihoodVector () |
This function will return the likelihood components used in the simulation. More... | |
PrinterPtrVector & | getModelPrinterVector () |
This function will return the printer components used in the simulation. More... | |
FleetPtrVector & | getModelFleetVector () |
This function will return the fleets used in the simulation. More... | |
StockPtrVector & | getModelStockVector () |
This function will return the stocks used in the simulation. More... | |
Public Attributes | |
volatile int | interrupted |
This is the flag used to denote whether the user has interrupted the current model run. More... | |
Protected Attributes | |
double | likelihood |
This is the value of the likelihood score for the current simulation. More... | |
int | funceval |
This is the current iteration. More... | |
BaseClassPtrVector | basevec |
This is the BaseClassPtrVector of the stocks, fleets and otherfood classes for the current model. More... | |
LikelihoodPtrVector | likevec |
This is the LikelihoodPtrVector of the likelihood components for the current model. More... | |
PrinterPtrVector | printvec |
This is the PrinterPtrVector of the printer classes for the current model. More... | |
OptInfoPtrVector | optvec |
This is the OptInfoPtrVector of the optimisation algorithms for the current model. More... | |
TimeClass * | TimeInfo |
This is the TimeClass for the current model. More... | |
AreaClass * | Area |
This is the AreaClass for the current model. More... | |
Keeper * | keeper |
This is the Keeper for the current model. More... | |
StockPtrVector | stockvec |
This is the StockPtrVector of the stocks for the current model. More... | |
TagPtrVector | tagvec |
This is the TagPtrVector of the tagging experiments for the current model. More... | |
OtherFoodPtrVector | otherfoodvec |
This is the OtherFoodPtrVector of the otherfood for the current model. More... | |
FleetPtrVector | fleetvec |
This is the FleetPtrVector of the fleets for the current model. More... | |
PrintInfo | printinfo |
This is the PrintInfo specifying the parameter output from the current model. More... | |
int | printcount |
This is the counter for the printing interval for the -o output from the simualtion. More... | |
DoubleVector | initialval |
This is the DoubleVector used to store the initial values of the parameters. More... | |
DoubleVector | currentval |
This is the DoubleVector used to store the current values of the parameters. More... | |
IntVector | optflag |
This is the IntVector used to store information about whether the parameters are to be optimised. More... | |
This is the class used to control the model simulation.
This is the main class for the model simulation. This class contains pointers to all the objects that are to be used in the model simulation - the stocks and fleets, the model variables, any printer classes used to output the modelled population and any likelihood classes used to compare the modelled population to data. This class controls the model simulation, from the reading of the input files, simulating the modelled population on each timestep and printing the results, and finally calculating an overall likelihood score. This class is also used during an optimising run to update the variables to new values from the optimisation algorithm and calculating a new likelihood score based on these new values.
|
inline |
This is the default Ecosystem constructor.
Ecosystem::Ecosystem | ( | const MainInfo & | main | ) |
Ecosystem::~Ecosystem | ( | ) |
This is the default Ecosystem destructor.
|
inline |
This function will check that the values of the parameters are within the specified bounds.
|
inline |
This function will return the current step in the simulation.
|
inline |
This function will return the current time in the simulation.
|
inline |
This function will return the current year in the simulation.
|
inline |
This function will return the total number of iterations completed.
|
inline |
This function will return the likelihood score from the current simulation.
|
inline |
This function will return the fleets used in the simulation.
|
inline |
This function will return the likelihood components used in the simulation.
|
inline |
This function will return the printer components used in the simulation.
|
inline |
This function will return the stocks used in the simulation.
|
inline |
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 |
|
inline |
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 |
|
inline |
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 |
|
inline |
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 Ecosystem::Initialise | ( | ) |
This function will initialise the Ecosystem parameters.
|
inline |
This function will return the number of variables to be optimised.
|
inline |
This function will return the total number of timestep in the simulation.
|
inline |
This function will return the number of variables.
void Ecosystem::Optimise | ( | ) |
This is the function that will optimise the likelihood score.
void Ecosystem::readFleet | ( | CommentStream & | infile | ) |
This function will read the fleet data from the input file.
infile | is the CommentStream to read the fleet data from |
void Ecosystem::readLikelihood | ( | CommentStream & | infile | ) |
This function will read the likelihood data from the input file.
infile | is the CommentStream to read the likelihood data from |
void Ecosystem::readMain | ( | CommentStream & | infile, |
const MainInfo & | main | ||
) |
This function will read the model data from the main input file.
infile | is the CommentStream to read the likelihood data from |
main | is the MainInfo specifying the command line options for the model run |
void Ecosystem::readOptimisation | ( | CommentStream & | infile | ) |
This function will read in the optimisation parameters from the input file.
infile | is the CommentStream to read the optimisation parameters from |
void Ecosystem::readOtherFood | ( | CommentStream & | infile | ) |
This function will read the otherfood data from the input file.
infile | is the CommentStream to read the otherfood data from |
void Ecosystem::readPrinters | ( | CommentStream & | infile | ) |
This function will read the printer data from the input file.
infile | is the CommentStream to read the printer data from |
void Ecosystem::readStock | ( | CommentStream & | infile | ) |
This function will read the stock data from the input file.
infile | is the CommentStream to read the stock data from |
void Ecosystem::readTagging | ( | CommentStream & | infile | ) |
This function will read the tagging data from the input file.
infile | is the CommentStream to read the tagging data from |
void Ecosystem::Reset | ( | ) |
This function will reset the Ecosystem information.
|
inline |
This function will reset the variables that have been scaled, to be optimised using the Simulated Annealing optimisation algorithm.
|
inline |
This function will scale the variables to be optimised, for the Hooke & Jeeves and BFGS optimisation algorithms.
void Ecosystem::Simulate | ( | int | ) |
This function will simulate the population in the model.
is the flag to denote whether the model output should be printed or not |
double Ecosystem::SimulateAndUpdate | ( | const DoubleVector & | x | ) |
This function will update the model parameters, run the model and calculate a likelihood score.
x | is the DoubleVector containing the updated values for the parameters |
|
inline |
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 |
|
inline |
This function will update the Ecosystem parameters with new values from StochasticData.
Stochastic | is the StochasticData containing the new values of the parameters |
void Ecosystem::updateAgesOneArea | ( | int | area = 0 | ) |
This function will update the ages of the population on an area.
area | is the area to update the population on (default value 0) |
void Ecosystem::updatePopulationOneArea | ( | int | area = 0 | ) |
This function will update the population numbers on an area.
area | is the area to update the population on (default value 0) |
void Ecosystem::updatePredationOneArea | ( | int | area = 0 | ) |
This function will calculate the predation, and update the population, on an area.
area | is the area to calculate the predation on (default value 0) |
|
inline |
This function will display information about the best values of the parameters found so far during an optimisation run.
void Ecosystem::writeInitialInformation | ( | const char *const | filename | ) |
This function will write header information about the model parameters to file.
filename | is the name of the file to write the model information to |
void Ecosystem::writeOptValues | ( | ) |
This function will display information about the optimised values of the parameters.
void Ecosystem::writeParams | ( | const char *const | filename, |
int | prec | ||
) | const |
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)
filename | is the name of the file to write the model information to |
prec | is the precision to use in the output file |
void Ecosystem::writeStatus | ( | const char * | filename | ) | const |
This function will write the current model status to file.
filename | is the name of the file to write the model information to |
void Ecosystem::writeValues | ( | ) |
This function will write current information about the model parameters to file.
|
protected |
This is the BaseClassPtrVector of the stocks, fleets and otherfood classes for the current model.
|
protected |
This is the DoubleVector used to store the current values of the parameters.
|
protected |
This is the FleetPtrVector of the fleets for the current model.
|
protected |
This is the current iteration.
|
protected |
This is the DoubleVector used to store the initial values of the parameters.
volatile int Ecosystem::interrupted |
This is the flag used to denote whether the user has interrupted the current model run.
|
protected |
This is the value of the likelihood score for the current simulation.
|
protected |
This is the LikelihoodPtrVector of the likelihood components for the current model.
|
protected |
This is the IntVector used to store information about whether the parameters are to be optimised.
|
protected |
This is the OptInfoPtrVector of the optimisation algorithms for the current model.
|
protected |
This is the OtherFoodPtrVector of the otherfood for the current model.
|
protected |
This is the counter for the printing interval for the -o output from the simualtion.
|
protected |
This is the PrintInfo specifying the parameter output from the current model.
|
protected |
This is the PrinterPtrVector of the printer classes for the current model.
|
protected |
This is the StockPtrVector of the stocks for the current model.
|
protected |
This is the TagPtrVector of the tagging experiments for the current model.