50 frequency = _frequency;
51 printScheme = _printScheme;
60 return addItem( _name );
66 return addItem( _name );
71 const char*
const _label
74 if (items.count(make_pair(_name,
LRT_ENUM)))
85 const char*
const _label
99 LogRecordItems::const_iterator it;
102 char* startString = 0;
106 char* colSeparator = 0;
107 char* rowSeparator = 0;
110 precision, &colSeparator, &rowSeparator);
115 for (it = items.begin(); it != items.end(); ++it)
119 for (
uint i = 0; i < it->second.values.getNumPoints(); ++i)
120 tmp.
appendRows(it->second.values.getMatrix(i));
123 _stream, it->second.label.c_str(),
124 startString, endString, width,
precision,
125 colSeparator, rowSeparator);
127 goto LogRecord_print_exit;
133 for (
unsigned i = 0; i < getMaxNumMatrices(); ++i)
134 for (it = items.begin(); it != items.end(); ++it)
136 if (i >= it->second.values.getNumPoints()
137 || it->second.values.getNumPoints() == 0)
139 if (it->second.values.getMatrix( i ).print(
140 _stream, it->second.label.c_str(),
141 startString, endString, width,
precision,
142 colSeparator, rowSeparator)
144 goto LogRecord_print_exit;
150 for (it = items.begin(); it != items.end(); ++it)
152 if (it->second.values.getNumPoints() == 0)
154 if (it->second.values.getMatrix(getMaxNumMatrices() - 1).print(
155 _stream, it->second.label.c_str(),
156 startString, endString, width,
precision,
158 goto LogRecord_print_exit;
164 LogRecord_print_exit:
166 if ( startString != 0 )
delete[] startString;
167 if ( endString != 0 )
delete[] endString;
168 if ( colSeparator != 0 )
delete[] colSeparator;
169 if ( rowSeparator != 0 )
delete[] rowSeparator;
176 cout <<
"LogRecord having the following items: ";
178 LogRecordItems::const_iterator it;
179 for (it = items.begin(); it != items.end(); ++it)
180 cout << it->first.first <<
", ";
190 unsigned maxNumMatrices = 0;
192 LogRecordItems::const_iterator it;
193 for (it = items.begin(); it != items.end(); ++it)
196 maxNumMatrices = it->second.values.getNumPoints( );
199 return maxNumMatrices;
213 LogRecordItems::const_iterator it = items.find(make_pair(_name, _type));
214 if (it == items.end())
217 values = it->second.
values;
228 LogRecordItems::const_iterator it = items.find(make_pair(_name, _type));
229 if (it == items.end())
232 if (it->second.values.getNumPoints() == 0)
235 firstValue = it->second.values.getMatrix( 0 );
246 LogRecordItems::const_iterator it = items.find(make_pair(_name, _type));
247 if (it == items.end())
250 if (it->second.values.getNumPoints() == 0)
253 lastValue = it->second.values.getMatrix(it->second.values.getNumPoints() - 1);
265 LogRecordItems::iterator it = items.find(make_pair(_name, _type));
266 if (it == items.end())
269 if (it->second.values.getNumPoints( ) == 0)
270 return it->second.values.init( );
275 it->second.values.init();
280 it->second.values.init();
285 it->second.values = values;
298 LogRecordItems::iterator it = items.find(make_pair(_name, _type));
299 if (it == items.end())
302 double logTime = time;
308 if (it->second.values.getNumPoints() == 0)
313 it->second.values.addMatrix(value, logTime);
319 it->second.values.init();
324 it->second.values.addMatrix(value, logTime);
330 logTime = (double)it->second.values.getNumPoints() + 1.0;
332 it->second.values.addMatrix(value, logTime);
341 LogRecordItems::iterator it;
343 for (it = _record.
items.begin(); it != _record.
items.end(); ++it)
345 if (it->second.writeProtection ==
true)
348 LogRecordItems::const_iterator cit = items.find( it->first );
350 if (cit != items.end())
351 it->second = cit->second;
returnValue getGlobalStringDefinitions(PrintScheme _printScheme, char **_startString, char **_endString, uint &_width, uint &_precision, char **_colSeparator, char **_rowSeparator)
returnValue addItem(LogName _name, const char *const _label=DEFAULT_LABEL)
double getFirstTime() const
BooleanType acadoIsEqual(double x, double y, double TOL)
DMatrix getFirstMatrix() const
returnValue operator<<(LogName _name)
Allows to pass back messages to the calling function.
returnValue setAll(LogName _name, const MatrixVariablesGrid &values)
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
GenericMatrix & appendRows(const GenericMatrix &_arg)
uint getMaxNumMatrices() const
#define CLOSE_NAMESPACE_ACADO
GenericMatrix< double > DMatrix
returnValue getLast(LogName _name, DMatrix &lastValue) const
Base class for all variables within the symbolic expressions family.
returnValue printInfo() const
virtual returnValue print(std::ostream &_stream=std::cout, const std::string &_name=DEFAULT_LABEL, const std::string &_startString=DEFAULT_START_STRING, const std::string &_endString=DEFAULT_END_STRING, uint _width=DEFAULT_WIDTH, uint _precision=DEFAULT_PRECISION, const std::string &_colSeparator=DEFAULT_COL_SEPARATOR, const std::string &_rowSeparator=DEFAULT_ROW_SEPARATOR) const
Provides a time grid consisting of matrix-valued optimization variables at each grid point...
DMatrix getLastMatrix() const
LogRecord(LogFrequency _frequency=LOG_AT_EACH_ITERATION, PrintScheme _printScheme=PS_DEFAULT)
uint getComponent(const unsigned int idx) const
Allows to setup and store user-specified log records of algorithmic information.
#define BEGIN_NAMESPACE_ACADO
returnValue print(std::ostream &_stream=std::cout, LogPrintMode _mode=PRINT_ITEM_BY_ITEM) const
returnValue setLast(LogName _name, const DMatrix &value, double time=-INFTY)
returnValue getAll(LogName _name, MatrixVariablesGrid &values) const
returnValue getFirst(LogName _name, DMatrix &firstValue) const
#define ACADOERROR(retval)
returnValue updateLogRecord(LogRecord &_record) const