Base class for all algorithmic modules within the ACADO Toolkit providing some basic functionality. More...
#include <algorithmic_base.hpp>
Base class for all algorithmic modules within the ACADO Toolkit providing some basic functionality.
The class AlgorithmicBase is a base class for all algorithmic modules within the ACADO Toolkit. It provides a number of basic functionality such as routines to cope with options, logging and plotting objects.
The class AlgorithmicBase only tunnels this functionality to a pointer of the UserInteraction class. There are two different possibilities for using this class:
(i) Using this class stand-alone: if no pointer to an instance of the UserInteraction class is provided, an object of this class is automatically allocated (with default options and logging information as specified within each algorithmic module).
(ii) Using this class as (possibly nested) member of a top-level user interface: Usually an user interacts with a top-level user interface derived from the class UserInteraction. This interface does always have algorithmic modules as members for doing the actual computations. For ensuring that options, logging and plotting information specified by the user is actually handled by the algorithmic modules, they are provided with a pointer to this top-level user interface.
Definition at line 78 of file algorithmic_base.hpp.
Default constructor for using the algorithmic module stand-alone.
Definition at line 44 of file algorithmic_base.cpp.
AlgorithmicBase::AlgorithmicBase | ( | UserInteraction * | _userInteraction | ) |
Constructor which takes a pointer to an instance of the UserInterface class. If this pointer is NULL, this constructor is equivalent to the default constructor.
[in] | _userInteraction | Pointer to top-level user interface. |
Definition at line 53 of file algorithmic_base.cpp.
AlgorithmicBase::AlgorithmicBase | ( | const AlgorithmicBase & | rhs | ) |
Copy constructor (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 71 of file algorithmic_base.cpp.
AlgorithmicBase::~AlgorithmicBase | ( | ) | [virtual] |
Destructor.
Definition at line 88 of file algorithmic_base.cpp.
int AlgorithmicBase::addLogRecord | ( | LogRecord & | _record | ) | [inline] |
Adds a record to the log collection.
[in] | record | Record to be added. |
returnValue AlgorithmicBase::addOption | ( | OptionsName | name, |
int | value | ||
) | [inline] |
Add an option item with a given integer default value to the all option lists.
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
returnValue AlgorithmicBase::addOption | ( | OptionsName | name, |
double | value | ||
) | [inline] |
Add an option item with a given double default value to the all option lists.
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
returnValue AlgorithmicBase::addOption | ( | uint | idx, |
OptionsName | name, | ||
int | value | ||
) | [inline] |
Add an option item with a given integer default value to option list with given index.
[in] | idx | Index of option list. |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
returnValue AlgorithmicBase::addOption | ( | uint | idx, |
OptionsName | name, | ||
double | value | ||
) | [inline] |
Add an option item with a given double default value to option list with given index.
[in] | idx | Index of option list. |
[in] | name | Name of new option item. |
[in] | value | Default value of new option. |
Adds an additional OptionsList to internal array.
Definition at line 120 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::get | ( | OptionsName | name, |
int & | value | ||
) | const [inline] |
Returns value of an existing option item of integer type.
[in] | name | Name of option item. |
[out] | value | Value of option. |
returnValue AlgorithmicBase::get | ( | OptionsName | name, |
double & | value | ||
) | const [inline] |
Returns value of an existing option item of double type.
[in] | name | Name of option item. |
[out] | value | Value of option. |
returnValue AlgorithmicBase::get | ( | OptionsName | name, |
std::string & | value | ||
) | const [inline] |
Returns value of an existing option item of string type.
[in] | name | Name of option item. |
[out] | value | Value of option. |
returnValue AlgorithmicBase::get | ( | uint | idx, |
OptionsName | name, | ||
int & | value | ||
) | const [inline] |
Returns value of an existing option item of integer type within the option list of given index.
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[out] | value | Value of option. |
returnValue AlgorithmicBase::get | ( | uint | idx, |
OptionsName | name, | ||
double & | value | ||
) | const [inline] |
Returns value of an existing option item of double type within the option list of given index.
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[out] | value | Value of option. |
returnValue AlgorithmicBase::getAll | ( | LogName | _name, |
MatrixVariablesGrid & | values | ||
) | const [inline] |
Gets all numerical values at all time instants of the item with given name. If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | values | All numerical values at all time instants of given item. |
returnValue AlgorithmicBase::getFirst | ( | LogName | _name, |
DMatrix & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name. If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue AlgorithmicBase::getFirst | ( | LogName | _name, |
VariablesGrid & | firstValue | ||
) | const [inline] |
Gets numerical value at first time instant of the item with given name (converts internally used DMatrix into VariablesGrid). If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | firstValue | Numerical value at first time instant of given item. |
returnValue AlgorithmicBase::getLast | ( | LogName | _name, |
DMatrix & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name. If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
returnValue AlgorithmicBase::getLast | ( | LogName | _name, |
VariablesGrid & | lastValue | ||
) | const [inline] |
Gets numerical value at last time instant of the item with given name (converts internally used DMatrix into VariablesGrid). If this item exists in more than one record, the first one is choosen as they are expected to have identical values anyhow.
[in] | _name | Internal name of item. |
[out] | lastValue | Numerical value at last time instant of given item. |
Options AlgorithmicBase::getOptions | ( | uint | idx | ) | const |
Returns an Options object containing exactly the option list with given index.
[in] | idx | Index of option list. |
Definition at line 181 of file algorithmic_base.cpp.
BooleanType AlgorithmicBase::haveOptionsChanged | ( | ) | const [inline] |
Determines whether options of at least one option list have been modified.
BooleanType AlgorithmicBase::haveOptionsChanged | ( | uint | idx | ) | const [inline] |
Determines whether options of option list with given index have been modified.
[in] | idx | Index of option list. |
AlgorithmicBase & AlgorithmicBase::operator= | ( | const AlgorithmicBase & | rhs | ) |
Assignment operator (deep copy).
[in] | rhs | Right-hand side object. |
Definition at line 98 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::plot | ( | PlotFrequency | _frequency = PLOT_IN_ANY_CASE | ) | [inline] |
Plots all windows of the plot collection, each one into a new figure.
[in] | _frequency | Frequency determining at which time instants the window is to be plotted. |
returnValue AlgorithmicBase::printLogRecord | ( | std::ostream & | _stream, |
int | idx, | ||
LogPrintMode | _mode = PRINT_ITEM_BY_ITEM |
||
) | const [inline] |
Prints whole record with specified index; all items are printed according to the output format settings.
[in] | idx | Index of record to be printed. |
[in] | _mode | Print mode: see documentation of LogPrintMode of details. |
returnValue AlgorithmicBase::replot | ( | PlotFrequency | _frequency = PLOT_IN_ANY_CASE | ) | [inline] |
Plots all windows of the plot collection, each one into the corresponding existing figure, if possible.
[in] | _frequency | Frequency determining at which time instants the window is to be plotted. |
returnValue AlgorithmicBase::set | ( | OptionsName | name, |
int | value | ||
) |
Sets value of an existing option item of integer type to a given value.
[in] | name | Name of option item. |
[in] | value | New value of option. |
Definition at line 126 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::set | ( | OptionsName | name, |
double | value | ||
) |
Sets value of an existing option item of double type to a given value.
[in] | name | Name of option item. |
[in] | value | New value of option. |
Definition at line 134 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::set | ( | OptionsName | name, |
const std::string & | value | ||
) |
Sets value of an existing option item of double type to a string value.
[in] | name | Name of option item. |
[in] | value | New value of option. |
Definition at line 141 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::set | ( | uint | idx, |
OptionsName | name, | ||
int | value | ||
) |
Sets value of an existing option item of integer type within the option list of given index to a given value.
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[in] | value | New value of option. |
Definition at line 149 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::set | ( | uint | idx, |
OptionsName | name, | ||
double | value | ||
) |
Sets value of an existing option item of double type within the option list of given index to a given value.
[in] | idx | Index of option list. |
[in] | name | Name of option item. |
[in] | value | New value of option. |
Definition at line 158 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::setAll | ( | LogName | _name, |
const MatrixVariablesGrid & | values | ||
) | [inline] |
Sets all numerical values at all time instants of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | values | All numerical values at all time instants of given item. |
returnValue AlgorithmicBase::setLast | ( | LogName | _name, |
int | lastValue, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue AlgorithmicBase::setLast | ( | LogName | _name, |
double | lastValue, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue AlgorithmicBase::setLast | ( | LogName | _name, |
const DVector & | lastValue, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue AlgorithmicBase::setLast | ( | LogName | _name, |
const DMatrix & | lastValue, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue AlgorithmicBase::setLast | ( | LogName | _name, |
const VariablesGrid & | lastValue, | ||
double | time = -INFTY |
||
) | [inline] |
Sets numerical value at last time instant of all items with given name within all records.
[in] | _name | Internal name of item. |
[in] | lastValue | Numerical value at last time instant of given item. |
[in] | time | Time label of the instant. |
returnValue AlgorithmicBase::setOptions | ( | const Options & | arg | ) |
Assigns a given Options object to this object.
[in] | arg | New Options object to be assigned. |
Definition at line 167 of file algorithmic_base.cpp.
returnValue AlgorithmicBase::setOptions | ( | uint | idx, |
const Options & | arg | ||
) |
Assigns the option list with given index of a given Options object to option list with given index of this object.
[in] | idx | Index of option list. |
[in] | arg | Options object containing the option list to be assigned. |
Definition at line 173 of file algorithmic_base.cpp.
int AlgorithmicBase::outputLoggingIdx [protected] |
Index of log record for algorithmic standard output to be optionally used within derived classes.
Definition at line 600 of file algorithmic_base.hpp.
BooleanType AlgorithmicBase::useModuleStandalone [protected] |
Flag indicating whether algorithmic module is used stand-alone.
Definition at line 598 of file algorithmic_base.hpp.
UserInteraction* AlgorithmicBase::userInteraction [protected] |
Pointer to top-level user interface..
Definition at line 597 of file algorithmic_base.hpp.