ACADO Toolkit
1.2.0beta
Toolkit for Automatic Control and Dynamic Optimization
|
Allows to conveniently handle (one-dimensional) grids consisting of time points. More...
#include <grid.hpp>
Public Member Functions | |
Grid () | |
Default constructor. | |
Grid (uint nPoints_, double *times_=0) | |
Constructor that takes the number of grid points along with with an optional double array containing the initialization of the times. | |
Grid (const Vector ×_) | |
Constructor that takes the number of grid points along with with a initialization of the times in form of a vector. | |
Grid (double _firstTime, double _lastTime, uint _nPoints=2) | |
Constructor that takes the number of grid points as well as as the time of the first and the last grid point. | |
Grid (const Grid &rhs) | |
Copy constructor (deep copy). | |
~Grid () | |
Destructor. | |
Grid & | operator= (const Grid &rhs) |
Assignment operator (deep copy). | |
returnValue | init (uint _nPoints=0, const double *const _times=0) |
Initializes grid with given number of grid points and given times. | |
returnValue | init (const Vector ×_) |
Initializes grid with given number of grid points and given times in form of a vector. | |
returnValue | init (double _firstTime, double _lastTime, uint _nPoints=2) |
Initializes grid with given number of grid points and an equidistant grid of time points between given time of the first and last grid point. | |
returnValue | init (const Grid &rhs) |
Initializes grid with given grid. | |
BooleanType | operator== (const Grid &arg) const |
Tests for equality, i.e. | |
BooleanType | operator!= (const Grid &arg) const |
Tests for non-equality. | |
BooleanType | operator< (const Grid &arg) const |
Tests if left-hand side grid is a strict subset of the right-hand side one, i.e. | |
BooleanType | operator<= (const Grid &arg) const |
Tests if left-hand side grid is a subset of the right-hand side one, i.e. | |
BooleanType | operator> (const Grid &arg) const |
Tests if right-hand side grid is a strict subset of the left-hand side one, i.e. | |
BooleanType | operator>= (const Grid &arg) const |
Tests if right-hand side grid is a subset of the left-hand side one, i.e. | |
Grid & | operator& (const Grid &arg) |
Constructs the set union of two grids. | |
returnValue | equalizeGrids (Grid &arg) |
Constructs the set union of two grids and replaces both grids by this union grid. | |
returnValue | setTime (double _time) |
Assigns next unintialized time point. | |
returnValue | setTime (uint pointIdx, double _time) |
Assigns new time to grid point with given index. | |
returnValue | addTime (double _time) |
Adds a new grid point with given time to grid. | |
returnValue | merge (const Grid &arg, MergeMethod _mergeMethod=MM_DUPLICATE, BooleanType keepOverlap=BT_TRUE) |
Constructs the set union in time of current and given grid. | |
BooleanType | isEmpty () const |
Returns whether the grid is empty (i.e. | |
uint | getNumPoints () const |
Returns number of grid points. | |
uint | getNumIntervals () const |
Returns number of grid intervals. | |
double | getFirstTime () const |
Returns time of first grid point. | |
double | getLastTime () const |
Returns time of last grid point. | |
double | getTime (uint pointIdx) const |
Returns time of grid point with given index. | |
Grid & | shiftTimes (double timeShift) |
Shifts times at all grid points by a given offset. | |
BooleanType | isEquidistant () const |
Returns whether the grid has equally spaced grid points or not. | |
double | getIntervalLength () const |
Returns total interval length of grid. | |
double | getIntervalLength (uint pointIdx) const |
Returns interval length between given grid point and next one. | |
returnValue | scaleTimes (double scaling) |
Scales times at all grid points by a given positive factor. | |
returnValue | refineGrid (uint factor) |
Refines grid by a given factor by adding equally spaced additional time points in between existing ones. | |
returnValue | coarsenGrid (uint factor) |
Coarsens grid by a given factor by equally leaving out time points from the existing ones. | |
BooleanType | hasTime (double _time) const |
Returns whether the grid contains a given time point. | |
int | findTime (double _time, uint startIdx=0) const |
Returns index of an grid point at given time, starting at startIdx. | |
int | findFirstTime (double _time, uint startIdx=0) const |
Returns index of first grid point at given time, starting at startIdx. | |
int | findLastTime (double _time, uint startIdx=0) const |
Returns index of last grid point at given time, starting at startIdx. | |
uint | getFloorIndex (double time) const |
Returns index of grid point with greatest time smaller or equal to given time. | |
uint | getCeilIndex (double time) const |
Returns index of grid point with smallest time greater or equal to given time. | |
uint | getLastIndex () const |
Returns largest index of grid (note the difference to getNumPoints()). | |
BooleanType | isLast (uint pointIdx) const |
Returns whether given index is the last one of the grid. | |
BooleanType | isInInterval (double _time) const |
Returns whether given time lies within the total interval of the grid. | |
BooleanType | isInInterval (uint pointIdx, double _time) const |
Returns whether given time lies within the interval between given grid point and next one. | |
BooleanType | isInUpperHalfOpenInterval (uint pointIdx, double _time) const |
Returns whether given time lies within the half-open interval between given grid point and next one (next one not included). | |
BooleanType | isInLowerHalfOpenInterval (uint pointIdx, double _time) const |
Returns whether given time lies within the half-open interval between given grid point (given grid point not included) and next one. | |
returnValue | getSubGrid (double tStart, double tEnd, Grid &_subGrid) const |
Returns a sub-grid of current grid starting a given start time end ending at given end time. | |
returnValue | print () const |
Prints times of all grid points to screen. | |
Protected Member Functions | |
returnValue | setupEquidistant (double _firstTime, double _lastTime) |
Sets-up all times in an equidistant manner, starting at given start time and ending at given end time. | |
int | findNextIndex () const |
Returns index of next unintialized grid point. | |
Protected Attributes | |
uint | nPoints |
Number of grid points. | |
double * | times |
Time values at grid points. |
The class Grid allows to conveniently handle (one-dimensional) grids consisting of time points, as they usually occur when discretizing optimal control problems.
Grid::Grid | ( | uint | nPoints_, |
double * | times_ = 0 |
||
) |
Grid::Grid | ( | const Vector & | times_ | ) |
Grid::Grid | ( | double | _firstTime, |
double | _lastTime, | ||
uint | _nPoints = 2 |
||
) |
Grid::Grid | ( | const Grid & | rhs | ) |
Grid::~Grid | ( | ) |
References times.
returnValue Grid::addTime | ( | double | _time | ) |
[in] | _time | Time point to be added. |
References ACADOERROR, acadoIsGreater(), BT_FALSE, getLastTime(), getNumPoints(), nPoints, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and times.
Referenced by MatrixVariablesGrid::addMatrix(), TransferDevice::generateNoise(), PlotWindow::getDataGrids(), Actuator::getDelayedInputGrids(), Sensor::getDelayedOutputGrid(), and merge().
returnValue Grid::coarsenGrid | ( | uint | factor | ) |
[in] | factor | Coarsening factor. |
References ACADOERROR, getNumIntervals(), RET_INVALID_ARGUMENTS, RET_NOT_YET_IMPLEMENTED, and SUCCESSFUL_RETURN.
returnValue Grid::equalizeGrids | ( | Grid & | arg | ) |
Note that both the original as well as the argument grid is changed!
[in] | arg | Right-hand side object. |
References SUCCESSFUL_RETURN.
int Grid::findFirstTime | ( | double | _time, |
uint | startIdx = 0 |
||
) | const |
[in] | _time | Time to be found. |
[in] | startIdx | Start index for searching for time point. |
References acadoIsEqual(), BT_TRUE, getNumPoints(), times, and uint.
Referenced by findTime().
int Grid::findLastTime | ( | double | _time, |
uint | startIdx = 0 |
||
) | const |
[in] | _time | Time to be found. |
[in] | startIdx | Start index for searching for time point. |
References acadoIsEqual(), BT_TRUE, getNumPoints(), times, and uint.
Referenced by MatrixVariablesGrid::getCoarsenedGrid().
int Grid::findNextIndex | ( | ) | const [protected] |
References getNumPoints(), INFTY, times, and uint.
Referenced by setTime().
int Grid::findTime | ( | double | _time, |
uint | startIdx = 0 |
||
) | const |
[in] | _time | Time to be found. |
[in] | startIdx | Start index for searching for time point. |
References findFirstTime().
Referenced by hasTime(), operator<(), and operator>().
uint Grid::getCeilIndex | ( | double | time | ) | const |
[in] | _time | Time smaller or equal than that of the time point to be found. |
References acadoIsGreater(), acadoIsSmaller(), BT_TRUE, getLastIndex(), getTime(), isInLowerHalfOpenInterval(), and uint.
Referenced by VariablesGrid::getTimeSubGrid(), and MatrixVariablesGrid::linearInterpolation().
double Grid::getFirstTime | ( | ) | const [inline] |
Referenced by Actuator::addActuatorNoise(), Sensor::addSensorNoise(), VariablesGrid::appendTimes(), MatrixVariablesGrid::appendTimes(), OCPiterate::areGridsConsistent(), Actuator::checkInputConsistency(), Process::checkInputConsistency(), Actuator::delayActuatorInput(), Sensor::delaySensorOutput(), IntegratorBDF::evaluate(), IntegratorRK::evaluate(), IntegratorLYAPUNOV::evaluate(), ImplicitRungeKuttaExport::evaluateDerivedPolynomial(), ImplicitRungeKuttaExport::evaluatePolynomial(), IntegratorLYAPUNOV::evaluateSensitivities(), IntegratorBDF::evaluateSensitivities(), IntegratorRK::evaluateSensitivities(), DiagonallyImplicitRKExport::formMatrix(), ImplicitRungeKuttaExport::formMatrix(), ImplicitRungeKuttaExport::generateOutput(), AdjointIRKExport::getCode(), ForwardIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), IntegratorExport::getIntegrationInterval(), PeriodicReferenceTrajectory::getReference(), StaticReferenceTrajectory::getReference(), OCP::getStartTime(), Curve::getTimeDomain(), Curve::isInTimeDomain(), ShootingMethod::logTrajectory(), VariablesGrid::merge(), MatrixVariablesGrid::merge(), DiagonallyImplicitRKExport::prepareInputSystem(), ImplicitRungeKuttaExport::prepareOutputEvaluation(), DiagonallyImplicitRKExport::prepareOutputSystem(), IntegratorBDF::relaxAlgebraic(), Process::run(), AdjointIRKExport::sensitivitiesOutputs(), ForwardIRKExport::sensitivitiesOutputs(), LogRecordItem::setAllValues(), ModelData::setIntegrationGrid(), LSQTerm::setReference(), ExplicitRungeKuttaExport::setup(), Sensor::step(), Process::step(), and Actuator::step().
uint Grid::getFloorIndex | ( | double | time | ) | const |
[in] | _time | Time greater or equal than that of the time point to be found. |
References acadoIsGreater(), acadoIsSmaller(), acadoIsStrictlyGreater(), BT_TRUE, getLastIndex(), getTime(), isInUpperHalfOpenInterval(), and uint.
Referenced by Actuator::delayActuatorInput(), Sensor::delaySensorOutput(), Curve::evaluate(), PointConstraint::getBounds(), VariablesGrid::getTimeSubGrid(), IntegratorBDF::interpolate(), MatrixVariablesGrid::linearInterpolation(), IntegratorBDF::rk_start(), IntegratorDiscretizedODE::step(), IntegratorBDF::step(), IntegratorLYAPUNOV::step(), IntegratorRK::step(), and OCPiterate::update().
double Grid::getIntervalLength | ( | ) | const [inline] |
References nPoints, and times.
Referenced by IntegratorBDF::evaluate(), VariablesGrid::getIntegral(), isEquidistant(), refineGrid(), IntegratorBDF::relaxAlgebraic(), and OCPiterate::shift().
double Grid::getIntervalLength | ( | uint | pointIdx | ) | const [inline] |
[in] | pointIdx | Index of grid point at beginning of interval. |
References ACADOERROR, getLastIndex(), getNumPoints(), INFTY, RET_INDEX_OUT_OF_BOUNDS, and times.
uint Grid::getLastIndex | ( | ) | const [inline] |
References getNumPoints().
Referenced by VariablesGrid::appendTimes(), MatrixVariablesGrid::appendTimes(), Actuator::delayActuatorInput(), Sensor::delaySensorOutput(), BoundaryConstraint::evaluate(), CoupledPathConstraint::evaluate(), PathConstraint::evaluate(), MayerTerm::evaluate(), LSQEndTerm::evaluate(), AlgebraicConsistencyConstraint::evaluate(), getCeilIndex(), getFloorIndex(), getIntervalLength(), getNumIntervals(), StaticReferenceTrajectory::getReference(), isInInterval(), isInUpperHalfOpenInterval(), isLast(), and OCP::subjectTo().
double Grid::getLastTime | ( | ) | const [inline] |
References ASSERT, nPoints, and times.
Referenced by Curve::add(), Actuator::addActuatorNoise(), MatrixVariablesGrid::addMatrix(), Sensor::addSensorNoise(), addTime(), VariablesGrid::appendTimes(), MatrixVariablesGrid::appendTimes(), OCPiterate::areGridsConsistent(), Actuator::checkInputConsistency(), Process::checkInputConsistency(), Actuator::delayActuatorInput(), Sensor::delaySensorOutput(), Curve::evaluate(), IntegratorBDF::evaluate(), IntegratorRK::evaluate(), IntegratorLYAPUNOV::evaluate(), ImplicitRungeKuttaExport::evaluateDerivedPolynomial(), ImplicitRungeKuttaExport::evaluatePolynomial(), IntegratorBDF::evaluateSensitivities(), DiagonallyImplicitRKExport::formMatrix(), ImplicitRungeKuttaExport::formMatrix(), ImplicitRungeKuttaExport::generateOutput(), ForwardIRKExport::getCode(), AdjointIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), PlotWindow::getDataGrids(), Actuator::getDelayedInputGrids(), Sensor::getDelayedOutputGrid(), OCP::getEndTime(), IntegratorExport::getIntegrationInterval(), PeriodicReferenceTrajectory::getReference(), StaticReferenceTrajectory::getReference(), getTime(), Curve::getTimeDomain(), Integrator::integrate(), Curve::isInTimeDomain(), ShootingMethod::logTrajectory(), merge(), VariablesGrid::merge(), MatrixVariablesGrid::merge(), DiagonallyImplicitRKExport::prepareInputSystem(), ImplicitRungeKuttaExport::prepareOutputEvaluation(), DiagonallyImplicitRKExport::prepareOutputSystem(), refineGrid(), IntegratorBDF::rk_start(), Process::run(), AdjointIRKExport::sensitivitiesOutputs(), ForwardIRKExport::sensitivitiesOutputs(), ModelData::setIntegrationGrid(), ExplicitRungeKuttaExport::setup(), IntegratorDiscretizedODE::step(), IntegratorBDF::step(), IntegratorLYAPUNOV::step(), IntegratorRK::step(), Sensor::step(), Process::step(), and Actuator::step().
uint Grid::getNumIntervals | ( | ) | const [inline] |
References getLastIndex(), and nPoints.
Referenced by ModelData::addOutput(), ShootingMethod::addStage(), coarsenGrid(), ShootingMethod::deleteAllSeeds(), ImplicitRungeKuttaExport::divideMeasurements(), ShootingMethod::evaluate(), DiagonallyImplicitRKExport::formMatrix(), ImplicitRungeKuttaExport::formMatrix(), ImplicitRungeKuttaExport::generateOutput(), AdjointIRKExport::getCode(), ForwardIRKExport::getCode(), ExplicitRungeKuttaExport::getCode(), DiscreteTimeExport::getCode(), ImplicitRungeKuttaExport::getCode(), ForwardIRKExport::getDataDeclarations(), AdjointIRKExport::getDataDeclarations(), VariablesGrid::getIntegral(), IntegratorExport::getIntegrationInterval(), DynamicDiscretization::getNumEvaluationPoints(), Curve::getTimeDomain(), isEquidistant(), OCP::OCP(), DiagonallyImplicitRKExport::prepareInputSystem(), ImplicitRungeKuttaExport::prepareOutputEvaluation(), DiagonallyImplicitRKExport::prepareOutputSystem(), refineGrid(), AdjointIRKExport::sensitivitiesInputSystem(), ForwardIRKExport::sensitivitiesInputSystem(), AdjointIRKExport::sensitivitiesOutputs(), ForwardIRKExport::sensitivitiesOutputs(), DiagonallyImplicitRKExport::sensitivitiesOutputSystem(), AdjointIRKExport::sensitivitiesOutputSystem(), ForwardIRKExport::sensitivitiesOutputSystem(), ModelData::setIntegrationGrid(), NARXExport::setup(), ExplicitRungeKuttaExport::setup(), DiscreteTimeExport::setup(), ForwardIRKExport::setup(), AdjointIRKExport::setup(), OCP::setupGrid(), MatrixVariablesGrid::shiftBackwards(), and ShootingMethod::unfreeze().
uint Grid::getNumPoints | ( | ) | const [inline] |
References nPoints.
Referenced by acadoPlot(), CoupledPathConstraint::add(), PathConstraint::add(), Curve::add(), Constraint::add(), MatrixVariablesGrid::addMatrix(), addTime(), VariablesGrid::appendTimes(), MatrixVariablesGrid::appendTimes(), VariablesGrid::appendValues(), MatrixVariablesGrid::appendValues(), BoxConstraint::BoxConstraint(), Actuator::checkInputConsistency(), Process::checkInputConsistency(), ClippingFunctionality::clipSignals(), Constraint::Constraint(), Constraint::deleteAll(), MatrixVariablesGrid::determineStringLength(), MatrixVariablesGrid::disableAutoInit(), Curve::discretize(), MatrixVariablesGrid::enableAutoInit(), ShootingMethod::evaluate(), LSQTerm::evaluate(), Constraint::evaluate(), BoxConstraint::evaluateBounds(), PointConstraint::evaluateSensitivities(), BoundaryConstraint::evaluateSensitivities(), CoupledPathConstraint::evaluateSensitivities(), PathConstraint::evaluateSensitivities(), MayerTerm::evaluateSensitivities(), LSQTerm::evaluateSensitivities(), AlgebraicConsistencyConstraint::evaluateSensitivities(), Constraint::evaluateSensitivities(), LSQTerm::evaluateSensitivitiesGN(), LSQEndTerm::evaluateSensitivitiesGN(), findFirstTime(), findLastTime(), findNextIndex(), TransferDevice::generateNoise(), MatrixVariablesGrid::getAutoInit(), Constraint::getBackwardSensitivities(), Constraint::getBlockDim(), Constraint::getBoundResiduum(), BoxConstraint::getBounds(), Constraint::getBounds(), MatrixVariablesGrid::getCoarsenedGrid(), Constraint::getConstraintResiduum(), PlotWindow::getDataGrids(), PathConstraint::getDim(), MatrixVariablesGrid::getDim(), MatrixVariablesGrid::getFirstMatrix(), VariablesGrid::getFirstVector(), Constraint::getForwardSensitivities(), MatrixVariablesGrid::getGrid(), getIntervalLength(), getLastIndex(), MatrixVariablesGrid::getLastMatrix(), VariablesGrid::getLastVector(), MatrixVariablesGrid::getLowerBound(), MatrixVariablesGrid::getLowerBounds(), MatrixVariablesGrid::getMatrix(), MatrixVariablesGrid::getMax(), MatrixVariablesGrid::getMean(), MatrixVariablesGrid::getMin(), MatrixVariablesGrid::getName(), PathConstraint::getNC(), Constraint::getNC(), Constraint::getNP(), Constraint::getNU(), Constraint::getNumberOfBlocks(), MatrixVariablesGrid::getNumCols(), OCPiterate::getNumPoints(), LogRecordItem::getNumPoints(), MatrixVariablesGrid::getNumRows(), MatrixVariablesGrid::getNumValues(), Constraint::getNW(), Constraint::getNX(), Constraint::getNXA(), SimulationEnvironment::getProcessAlgebraicStates(), SimulationEnvironment::getProcessDifferentialStates(), SimulationEnvironment::getProcessIntermediateStates(), MatrixVariablesGrid::getRefinedGrid(), SimulationEnvironment::getSampledProcessOutput(), MatrixVariablesGrid::getScaling(), getSubGrid(), VariablesGrid::getSum(), getTime(), VariablesGrid::getTimeSubGrid(), MatrixVariablesGrid::getTimeSubGrid(), MatrixVariablesGrid::getType(), MatrixVariablesGrid::getUnit(), MatrixVariablesGrid::getUpperBound(), MatrixVariablesGrid::getUpperBounds(), VariablesGrid::getValuesSubGrid(), MatrixVariablesGrid::getValuesSubGrid(), VariablesGrid::getVector(), Integrator::getX(), Integrator::getXA(), MatrixVariablesGrid::hasLowerBounds(), MatrixVariablesGrid::hasNames(), MatrixVariablesGrid::hasScaling(), MatrixVariablesGrid::hasUnits(), MatrixVariablesGrid::hasUpperBounds(), BoxConstraint::init(), Constraint::init(), PIDcontroller::init(), VariablesGrid::initializeFromBounds(), OptimizationAlgorithmBase::initializeOCPiterate(), Constraint::isAffine(), Constraint::isBoxConstraint(), isInInterval(), isInLowerHalfOpenInterval(), isInUpperHalfOpenInterval(), MatrixVariablesGrid::linearInterpolation(), ShootingMethod::logTrajectory(), LSQTerm::LSQTerm(), Matrix::Matrix(), merge(), VariablesGrid::merge(), MatrixVariablesGrid::merge(), OCP::OCP(), MatrixVariablesGrid::operator()(), VariablesGrid::operator()(), MatrixVariablesGrid::operator+(), MatrixVariablesGrid::operator+=(), MatrixVariablesGrid::operator-(), MatrixVariablesGrid::operator-=(), operator<(), BoxConstraint::operator=(), LSQTerm::operator=(), Constraint::operator=(), operator==(), VariablesGrid::operator==(), operator>(), MatrixVariablesGrid::operator[](), VariablesGrid::operator[](), print(), MatrixVariablesGrid::printToString(), Process::projectToComponents(), Process::run(), GnuplotWindow::sendDataToGnuplot(), MatrixVariablesGrid::setAll(), MatrixVariablesGrid::setAllMatrices(), LogRecordItem::setAllValues(), VariablesGrid::setAllVectors(), MatrixVariablesGrid::setAutoInit(), ExportNLPSolver::setConstraints(), Constraint::setForwardSeed(), LSQTerm::setGrid(), MatrixVariablesGrid::setLowerBound(), MatrixVariablesGrid::setMatrix(), MatrixVariablesGrid::setName(), LSQTerm::setReference(), MatrixVariablesGrid::setScaling(), setTime(), MatrixVariablesGrid::setType(), MatrixVariablesGrid::setUnit(), Constraint::setUnitBackwardSeed(), Constraint::setUnitForwardSeed(), ExportGaussNewtonForces::setupConstraintsEvaluation(), OptimizationAlgorithmBase::setupDifferentialEquation(), setupEquidistant(), MatrixVariablesGrid::setUpperBound(), MatrixVariablesGrid::setUpperBounds(), VariablesGrid::setVector(), MatrixVariablesGrid::setZero(), MatrixVariablesGrid::shiftBackwards(), Process::simulate(), MatrixVariablesGrid::sprintf(), LinearStateFeedback::step(), PIDcontroller::step(), Sensor::step(), UniformNoise::step(), GaussianNoise::step(), Process::step(), LogCollection::updateLogRecord(), and LSQTerm::~LSQTerm().
returnValue Grid::getSubGrid | ( | double | tStart, |
double | tEnd, | ||
Grid & | _subGrid | ||
) | const |
[in] | tStart | Start time of sub-grid. |
[in] | tEnd | End time of sub-grid. |
[out] | _subGrid | Desired sub-grid. |
References ACADOERROR, acadoIsGreater(), acadoIsSmaller(), BT_FALSE, BT_TRUE, getNumPoints(), getTime(), hasTime(), init(), isInInterval(), RET_INVALID_ARGUMENTS, setTime(), SUCCESSFUL_RETURN, and uint.
Referenced by ShootingMethod::evaluate(), and Curve::evaluate().
double Grid::getTime | ( | uint | pointIdx | ) | const [inline] |
[in] | pointIdx | Index of grid point. |
References ASSERT, getLastTime(), getNumPoints(), and times.
Referenced by acadoPlot(), Curve::add(), Constraint::add(), VariablesGrid::appendTimes(), MatrixVariablesGrid::appendTimes(), Curve::discretize(), ShootingMethod::evaluate(), ImplicitRungeKuttaExport::evaluateDerivedPolynomial(), ImplicitRungeKuttaExport::evaluatePolynomial(), PointConstraint::getBounds(), getCeilIndex(), MatrixVariablesGrid::getCoarsenedGrid(), PlotWindow::getDataGrids(), getFloorIndex(), IntegratorExport::getIntegrationInterval(), MatrixVariablesGrid::getRefinedGrid(), getSubGrid(), OCPiterate::getTime(), Curve::getTimeDomain(), VariablesGrid::getTimeSubGrid(), MatrixVariablesGrid::getTimeSubGrid(), VariablesGrid::getValuesSubGrid(), MatrixVariablesGrid::getValuesSubGrid(), OptimizationAlgorithmBase::initializeOCPiterate(), IntegratorRK::interpolate(), IntegratorLYAPUNOV::interpolate(), IntegratorBDF::interpolate(), isInInterval(), isInLowerHalfOpenInterval(), isInUpperHalfOpenInterval(), MatrixVariablesGrid::linearInterpolation(), Matrix::Matrix(), merge(), VariablesGrid::merge(), MatrixVariablesGrid::merge(), operator==(), MatrixVariablesGrid::operator[](), VariablesGrid::operator[](), print(), MatrixVariablesGrid::printToString(), refineGrid(), ShootingMethod::rescale(), GnuplotWindow::sendDataToGnuplot(), ModelData::setIntegrationGrid(), LSQTerm::setReference(), and MatrixVariablesGrid::sprintf().
BooleanType Grid::hasTime | ( | double | _time | ) | const |
[in] | _time | Time point to be checked for existence. |
References BT_FALSE, BT_TRUE, and findTime().
Referenced by MatrixVariablesGrid::getRefinedGrid(), getSubGrid(), VariablesGrid::getTimeSubGrid(), and OCPiterate::update().
returnValue Grid::init | ( | uint | _nPoints = 0 , |
const double *const | _times = 0 |
||
) |
[in] | _nPoints | Number of grid points. |
[in] | _times | Initialization of times. |
References INFTY, nPoints, SUCCESSFUL_RETURN, times, and uint.
Referenced by ShootingMethod::deleteAll(), ShootingMethod::evaluate(), TransferDevice::generateNoise(), PlotWindow::getDataGrids(), MatrixVariablesGrid::getGrid(), getSubGrid(), PlotWindow::getVariableDataGrids(), Grid(), GnuplotWindow::sendDataToGnuplot(), and OCP::setupGrid().
returnValue Grid::init | ( | const Vector & | times_ | ) |
[in] | times | Initialization of times. |
References VectorspaceElement::getDim(), nPoints, SUCCESSFUL_RETURN, times, and uint.
returnValue Grid::init | ( | double | _firstTime, |
double | _lastTime, | ||
uint | _nPoints = 2 |
||
) |
[in] | _firstTime | Time of first grid point. |
[in] | _lastTime | Time of last grid point. |
[in] | _nPoints | Number of grid points. |
References nPoints, setupEquidistant(), and times.
returnValue Grid::init | ( | const Grid & | rhs | ) |
[in] | rhs | Grid to be taken for initialization. |
References operator=(), and SUCCESSFUL_RETURN.
BooleanType Grid::isEmpty | ( | ) | const [inline] |
no grid points) or not.
References BT_FALSE, BT_TRUE, and nPoints.
Referenced by Actuator::addActuatorNoise(), OCPiterate::areGridsConsistent(), Actuator::checkInputConsistency(), Process::checkInputConsistency(), MatrixVariablesGrid::coarsenGrid(), Actuator::delayActuatorInput(), MultiObjectiveAlgorithm::evaluateObjectives(), MatrixVariablesGrid::getCoarsenedGrid(), Controller::getCurrentReference(), Actuator::getDelayedInputGrids(), PlotWindow::getExpressionDataGrids(), MatrixVariablesGrid::getRefinedGrid(), ConstraintComponent::hasLBgrid(), ConstraintComponent::hasUBgrid(), RealTimeAlgorithm::init(), Controller::init(), OptimizationAlgorithmBase::initializeAlgebraicStates(), SimulationEnvironment::initializeAlgebraicStates(), Controller::initializeAlgebraicStates(), OptimizationAlgorithmBase::initializeControls(), OptimizationAlgorithmBase::initializeDifferentialStates(), OptimizationAlgorithmBase::initializeDisturbances(), OptimizationAlgorithmBase::initializeParameters(), OCP::minimizeLSQ(), ConstraintComponent::operator()(), RealTimeAlgorithm::performPreparationStep(), MatrixVariablesGrid::refineGrid(), ModelData::setIntegrationGrid(), Process::setProcessDisturbance(), MultiObjectiveAlgorithm::solveSingleObjective(), StaticReferenceTrajectory::StaticReferenceTrajectory(), and Process::step().
BooleanType Grid::isEquidistant | ( | ) | const [inline] |
References acadoIsEqual(), BT_FALSE, BT_TRUE, getIntervalLength(), getNumIntervals(), and uint.
Referenced by ModelData::setIntegrationGrid().
BooleanType Grid::isInInterval | ( | double | _time | ) | const [inline] |
[in] | _time | Time point to be checked. |
References acadoIsGreater(), acadoIsSmaller(), BT_FALSE, BT_TRUE, getLastIndex(), getTime(), and times.
Referenced by getSubGrid(), VariablesGrid::getTimeSubGrid(), merge(), VariablesGrid::merge(), and MatrixVariablesGrid::merge().
BooleanType Grid::isInInterval | ( | uint | pointIdx, |
double | _time | ||
) | const [inline] |
[in] | pointIdx | Index of grid point at beginning of interval. |
[in] | _time | Time point to be checked. |
References ACADOERROR, acadoIsGreater(), acadoIsSmaller(), BT_FALSE, BT_TRUE, getLastIndex(), getNumPoints(), getTime(), RET_INDEX_OUT_OF_BOUNDS, times, and uint.
BooleanType Grid::isInLowerHalfOpenInterval | ( | uint | pointIdx, |
double | _time | ||
) | const [inline] |
[in] | pointIdx | Index of grid point at beginning of interval. |
[in] | _time | Time point to be checked. |
References ACADOERROR, acadoIsGreater(), acadoIsStrictlySmaller(), BT_FALSE, BT_TRUE, getNumPoints(), getTime(), RET_INDEX_OUT_OF_BOUNDS, times, and uint.
Referenced by getCeilIndex().
BooleanType Grid::isInUpperHalfOpenInterval | ( | uint | pointIdx, |
double | _time | ||
) | const [inline] |
[in] | pointIdx | Index of grid point at beginning of interval. |
[in] | _time | Time point to be checked. |
References ACADOERROR, acadoIsSmaller(), acadoIsStrictlyGreater(), BT_FALSE, BT_TRUE, getLastIndex(), getNumPoints(), getTime(), RET_INDEX_OUT_OF_BOUNDS, times, and uint.
Referenced by getFloorIndex().
BooleanType Grid::isLast | ( | uint | pointIdx | ) | const [inline] |
[in] | pointIdx | Index of grid point. |
References BT_FALSE, BT_TRUE, and getLastIndex().
returnValue Grid::merge | ( | const Grid & | arg, |
MergeMethod | _mergeMethod = MM_DUPLICATE , |
||
BooleanType | keepOverlap = BT_TRUE |
||
) |
A merge method defines the way duplicate entries are handled. Moreover, it can be specified whether an overlap in time of both grids shall be kept or if only the entries of one of them shall be kept according to the merge method.
[in] | arg | Grid to append. |
[in] | _mergeMethod | Merge method, see documentation of MergeMethod for details. |
[in] | keepOverlap | Flag indicating whether overlap shall be kept. |
References ACADOERROR, acadoIsEqual(), acadoIsStrictlyGreater(), acadoIsStrictlySmaller(), addTime(), BT_FALSE, BT_TRUE, getLastTime(), getNumPoints(), getTime(), isInInterval(), MM_DUPLICATE, MM_KEEP, MM_REPLACE, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, and uint.
Referenced by Sensor::addSensorNoise(), Sensor::getDelayedOutputGrid(), and operator&().
BooleanType Grid::operator!= | ( | const Grid & | arg | ) | const [inline] |
BooleanType Grid::operator< | ( | const Grid & | arg | ) | const [inline] |
if each the rhs grid contains all time points of the lhs (but is not equal).
[in] | rhs | Object of comparison. |
References BT_FALSE, BT_TRUE, findTime(), getNumPoints(), times, and uint.
BooleanType Grid::operator<= | ( | const Grid & | arg | ) | const [inline] |
BEGIN_NAMESPACE_ACADO BooleanType Grid::operator== | ( | const Grid & | arg | ) | const [inline] |
if number of grid points AND time values at all grid points are equal.
[in] | rhs | Object of comparison. |
References acadoIsEqual(), BT_FALSE, BT_TRUE, getNumPoints(), getTime(), and uint.
BooleanType Grid::operator> | ( | const Grid & | arg | ) | const [inline] |
if each the lhs grid contains all time points of the rhs (but is not equal).
[in] | rhs | Object of comparison. |
References BT_FALSE, BT_TRUE, findTime(), getNumPoints(), times, and uint.
BooleanType Grid::operator>= | ( | const Grid & | arg | ) | const [inline] |
returnValue Grid::print | ( | ) | const |
References acadoPrintf(), getNumPoints(), getTime(), SUCCESSFUL_RETURN, and uint.
returnValue Grid::refineGrid | ( | uint | factor | ) |
[in] | factor | Refinement factor. |
References ACADOERROR, getIntervalLength(), getLastTime(), getNumIntervals(), getTime(), nPoints, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, times, and uint.
returnValue Grid::scaleTimes | ( | double | scaling | ) |
[in] | scaling | Positive scaling factor. |
References acadoIsStrictlyGreater(), ACADOWARNING, BT_FALSE, nPoints, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, times, and uint.
Referenced by ShootingMethod::rescale().
returnValue Grid::setTime | ( | double | _time | ) |
[in] | _time | New time point. |
References ACADOERROR, acadoIsStrictlyGreater(), BT_TRUE, findNextIndex(), RET_GRIDPOINT_HAS_INVALID_TIME, RET_GRIDPOINT_SETUP_FAILED, SUCCESSFUL_RETURN, and times.
Referenced by Actuator::delayActuatorInput(), Sensor::delaySensorOutput(), StaticReferenceTrajectory::getReference(), getSubGrid(), TransferDevice::init(), Process::init(), MatrixVariablesGrid::operator=(), SimulationEnvironment::step(), and VariablesGrid::VariablesGrid().
returnValue Grid::setTime | ( | uint | pointIdx, |
double | _time | ||
) |
[in] | pointIdx | Index of grid point. |
[in] | _time | New time. |
References ACADOERROR, getNumPoints(), RET_INDEX_OUT_OF_BOUNDS, SUCCESSFUL_RETURN, and times.
returnValue Grid::setupEquidistant | ( | double | _firstTime, |
double | _lastTime | ||
) | [protected] |
[in] | _firstTime | Time of first grid point. |
[in] | _lastTime | Time of last grid point. |
References ACADOERROR, getNumPoints(), nPoints, RET_INVALID_ARGUMENTS, SUCCESSFUL_RETURN, times, and uint.
Referenced by init().
Grid & Grid::shiftTimes | ( | double | timeShift | ) |
[in] | timeShift | Time offset for shifting. |
Reimplemented in MatrixVariablesGrid, and VariablesGrid.
References nPoints, times, and uint.
Referenced by TransferDevice::generateNoise(), Actuator::getDelayedInputGrids(), and Sensor::getDelayedOutputGrid().
uint Grid::nPoints [protected] |
Referenced by MatrixVariablesGrid::addMatrix(), addTime(), MatrixVariablesGrid::clearValues(), getIntervalLength(), getLastTime(), getNumIntervals(), getNumPoints(), Grid(), init(), MatrixVariablesGrid::init(), MatrixVariablesGrid::initMatrixVariables(), isEmpty(), MatrixVariablesGrid::MatrixVariablesGrid(), operator=(), MatrixVariablesGrid::operator=(), refineGrid(), scaleTimes(), MatrixVariablesGrid::setLowerBounds(), setupEquidistant(), and shiftTimes().
double* Grid::times [protected] |
Referenced by addTime(), findFirstTime(), findLastTime(), findNextIndex(), getFirstTime(), MatrixVariablesGrid::getGrid(), getIntervalLength(), getLastTime(), getTime(), Grid(), init(), isInInterval(), isInLowerHalfOpenInterval(), isInUpperHalfOpenInterval(), operator<(), operator=(), operator>(), refineGrid(), scaleTimes(), setTime(), setupEquidistant(), shiftTimes(), MatrixVariablesGrid::sprintf(), and ~Grid().