Public Member Functions | Protected Attributes

Base class for all algorithmic modules within the ACADO Toolkit providing some basic functionality. More...

#include <algorithmic_base.hpp>

Inheritance diagram for AlgorithmicBase:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int addLogRecord (LogRecord &_record)
returnValue addOption (OptionsName name, int value)
returnValue addOption (OptionsName name, double value)
returnValue addOption (uint idx, OptionsName name, int value)
returnValue addOption (uint idx, OptionsName name, double value)
returnValue addOptionsList ()
 AlgorithmicBase ()
 AlgorithmicBase (UserInteraction *_userInteraction)
 AlgorithmicBase (const AlgorithmicBase &rhs)
returnValue get (OptionsName name, int &value) const
returnValue get (OptionsName name, double &value) const
returnValue get (OptionsName name, std::string &value) const
returnValue get (uint idx, OptionsName name, int &value) const
returnValue get (uint idx, OptionsName name, double &value) const
returnValue getAll (LogName _name, MatrixVariablesGrid &values) const
returnValue getFirst (LogName _name, DMatrix &firstValue) const
returnValue getFirst (LogName _name, VariablesGrid &firstValue) const
returnValue getLast (LogName _name, DMatrix &lastValue) const
returnValue getLast (LogName _name, VariablesGrid &lastValue) const
Options getOptions (uint idx) const
BooleanType haveOptionsChanged () const
BooleanType haveOptionsChanged (uint idx) const
AlgorithmicBaseoperator= (const AlgorithmicBase &rhs)
returnValue plot (PlotFrequency _frequency=PLOT_IN_ANY_CASE)
returnValue printLogRecord (std::ostream &_stream, int idx, LogPrintMode _mode=PRINT_ITEM_BY_ITEM) const
returnValue replot (PlotFrequency _frequency=PLOT_IN_ANY_CASE)
returnValue set (OptionsName name, int value)
returnValue set (OptionsName name, double value)
returnValue set (OptionsName name, const std::string &value)
returnValue set (uint idx, OptionsName name, int value)
returnValue set (uint idx, OptionsName name, double value)
returnValue setAll (LogName _name, const MatrixVariablesGrid &values)
returnValue setLast (LogName _name, int lastValue, double time=-INFTY)
returnValue setLast (LogName _name, double lastValue, double time=-INFTY)
returnValue setLast (LogName _name, const DVector &lastValue, double time=-INFTY)
returnValue setLast (LogName _name, const DMatrix &lastValue, double time=-INFTY)
returnValue setLast (LogName _name, const VariablesGrid &lastValue, double time=-INFTY)
returnValue setOptions (const Options &arg)
returnValue setOptions (uint idx, const Options &arg)
virtual ~AlgorithmicBase ()

Protected Attributes

int outputLoggingIdx
BooleanType useModuleStandalone
UserInteractionuserInteraction

Detailed Description

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.

Note:
This class tunnels parts of the public functionality of the Options/OptionsList, Logging/LogCollection and Plotting/PlotCollection classes, respectively. In case their public functionality is modified, the AlgorithmicBase class has to be adapted accordingly.
Author:
Hans Joachim Ferreau, Boris Houska

Definition at line 78 of file algorithmic_base.hpp.


Constructor & Destructor Documentation

Default constructor for using the algorithmic module stand-alone.

Definition at line 44 of file algorithmic_base.cpp.

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.

Parameters:
[in]_userInteractionPointer to top-level user interface.

Definition at line 53 of file algorithmic_base.cpp.

Copy constructor (deep copy).

Parameters:
[in]rhsRight-hand side object.

Definition at line 71 of file algorithmic_base.cpp.

Destructor.

Definition at line 88 of file algorithmic_base.cpp.


Member Function Documentation

int AlgorithmicBase::addLogRecord ( LogRecord _record) [inline]

Adds a record to the log collection.

Parameters:
[in]recordRecord to be added.
Returns:
>= 0: index of added record,
-RET_LOG_COLLECTION_CORRUPTED
returnValue AlgorithmicBase::addOption ( OptionsName  name,
int  value 
) [inline]

Add an option item with a given integer default value to the all option lists.

Parameters:
[in]nameName of new option item.
[in]valueDefault value of new option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_ALREADY_EXISTS,
RET_OPTIONS_LIST_CORRUPTED
returnValue AlgorithmicBase::addOption ( OptionsName  name,
double  value 
) [inline]

Add an option item with a given double default value to the all option lists.

Parameters:
[in]nameName of new option item.
[in]valueDefault value of new option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_ALREADY_EXISTS,
RET_OPTIONS_LIST_CORRUPTED
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.

Parameters:
[in]idxIndex of option list.
[in]nameName of new option item.
[in]valueDefault value of new option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_ALREADY_EXISTS,
RET_OPTIONS_LIST_CORRUPTED,
RET_INDEX_OUT_OF_BOUNDS
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.

Parameters:
[in]idxIndex of option list.
[in]nameName of new option item.
[in]valueDefault value of new option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_ALREADY_EXISTS,
RET_OPTIONS_LIST_CORRUPTED,
RET_INDEX_OUT_OF_BOUNDS

Adds an additional OptionsList to internal array.

Returns:
SUCCESSFUL_RETURN

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.

Parameters:
[in]nameName of option item.
[out]valueValue of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS
returnValue AlgorithmicBase::get ( OptionsName  name,
double &  value 
) const [inline]

Returns value of an existing option item of double type.

Parameters:
[in]nameName of option item.
[out]valueValue of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS
returnValue AlgorithmicBase::get ( OptionsName  name,
std::string &  value 
) const [inline]

Returns value of an existing option item of string type.

Parameters:
[in]nameName of option item.
[out]valueValue of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS
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.

Parameters:
[in]idxIndex of option list.
[in]nameName of option item.
[out]valueValue of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_INDEX_OUT_OF_BOUNDS
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.

Parameters:
[in]idxIndex of option list.
[in]nameName of option item.
[out]valueValue of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_INDEX_OUT_OF_BOUNDS
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.

Parameters:
[in]_nameInternal name of item.
[out]valuesAll numerical values at all time instants of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[out]firstValueNumerical value at first time instant of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[out]lastValueNumerical value at last time instant of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

Returns an Options object containing exactly the option list with given index.

Parameters:
[in]idxIndex of option list.
Returns:
Options object containing exactly the option list with given index

Definition at line 181 of file algorithmic_base.cpp.

Determines whether options of at least one option list have been modified.

Returns:
BT_TRUE iff options have been modified,
BT_FALSE otherwise

Determines whether options of option list with given index have been modified.

Parameters:
[in]idxIndex of option list.
Returns:
BT_TRUE iff options have been modified,
BT_FALSE otherwise
AlgorithmicBase & AlgorithmicBase::operator= ( const AlgorithmicBase rhs)

Assignment operator (deep copy).

Parameters:
[in]rhsRight-hand side object.

Definition at line 98 of file algorithmic_base.cpp.

Plots all windows of the plot collection, each one into a new figure.

Parameters:
[in]_frequencyFrequency determining at which time instants the window is to be plotted.
Returns:
SUCCESSFUL_RETURN
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.

Parameters:
[in]idxIndex of record to be printed.
[in]_modePrint mode: see documentation of LogPrintMode of details.
Returns:
SUCCESSFUL_RETURN,
RET_INDEX_OUT_OF_BOUNDS,
RET_INVALID_ARGUMENTS,
RET_UNKNOWN_BUG

Plots all windows of the plot collection, each one into the corresponding existing figure, if possible.

Parameters:
[in]_frequencyFrequency determining at which time instants the window is to be plotted.
Returns:
SUCCESSFUL_RETURN
returnValue AlgorithmicBase::set ( OptionsName  name,
int  value 
)

Sets value of an existing option item of integer type to a given value.

Parameters:
[in]nameName of option item.
[in]valueNew value of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_OPTIONS_LIST_CORRUPTED

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.

Parameters:
[in]nameName of option item.
[in]valueNew value of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_OPTIONS_LIST_CORRUPTED

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.

Parameters:
[in]nameName of option item.
[in]valueNew value of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_OPTIONS_LIST_CORRUPTED

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.

Parameters:
[in]idxIndex of option list.
[in]nameName of option item.
[in]valueNew value of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_OPTIONS_LIST_CORRUPTED,
RET_INDEX_OUT_OF_BOUNDS

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.

Parameters:
[in]idxIndex of option list.
[in]nameName of option item.
[in]valueNew value of option.
Returns:
SUCCESSFUL_RETURN,
RET_OPTION_DOESNT_EXISTS,
RET_OPTIONS_LIST_CORRUPTED,
RET_INDEX_OUT_OF_BOUNDS

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.

Parameters:
[in]_nameInternal name of item.
[in]valuesAll numerical values at all time instants of given item.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_COLLECTION_CORRUPTED
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST
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.

Parameters:
[in]_nameInternal name of item.
[in]lastValueNumerical value at last time instant of given item.
[in]timeTime label of the instant.
Returns:
SUCCESSFUL_RETURN,
RET_LOG_ENTRY_DOESNT_EXIST

Assigns a given Options object to this object.

Parameters:
[in]argNew Options object to be assigned.
Note:
This routine is introduced only for convenience and is equivalent to the assignment operator.
Returns:
SUCCESSFUL_RETURN

Definition at line 167 of file algorithmic_base.cpp.

Assigns the option list with given index of a given Options object to option list with given index of this object.

Parameters:
[in]idxIndex of option list.
[in]argOptions object containing the option list to be assigned.
Returns:
SUCCESSFUL_RETURN

Definition at line 173 of file algorithmic_base.cpp.


Member Data Documentation

Index of log record for algorithmic standard output to be optionally used within derived classes.

Definition at line 600 of file algorithmic_base.hpp.

Flag indicating whether algorithmic module is used stand-alone.

Definition at line 598 of file algorithmic_base.hpp.

Pointer to top-level user interface..

Definition at line 597 of file algorithmic_base.hpp.


The documentation for this class was generated from the following files:


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:23