28 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR =
double>
32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 virtual void addIntermediateADTerm(
179 std::shared_ptr<TermBase<STATE_DIM, CONTROL_DIM, SCALAR>>
getFinalTermById(
const size_t id);
183 std::shared_ptr<TermBase<STATE_DIM, CONTROL_DIM, SCALAR>>
getFinalTermByName(
const std::string& name);
CostFunction< STATE_DIM, CONTROL_DIM, SCALAR > BASE
Definition: CostFunctionQuadratic.hpp:41
std::vector< std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > > intermediateCostAnalytical_
Definition: CostFunctionQuadratic.hpp:238
control_state_matrix_t stateControlDerivativeIntermediateBase()
evaluate intermediate analytical control mixed state control derivatives
Definition: CostFunctionQuadratic-impl.hpp:473
control_matrix_t controlSecondDerivativeIntermediateBase()
evaluate intermediate analytical control second derivatives
Definition: CostFunctionQuadratic-impl.hpp:440
virtual state_vector_t stateDerivativeIntermediate()=0
Computes intermediate-cost first-order derivative with respect to state.
SCALAR eps_
stepsize for numerical differentiation
Definition: CostFunctionQuadratic.hpp:232
A base function for cost functions. All cost functions should derive from this.
Definition: CostFunction.hpp:25
SCALAR evaluateIntermediateBase()
evaluate intermediate analytical cost terms
Definition: CostFunctionQuadratic-impl.hpp:310
virtual void updateReferenceControl(const control_vector_t &u_ref)
update the reference control for intermediate cost terms
Definition: CostFunctionQuadratic-impl.hpp:105
Eigen::Matrix< SCALAR, CONTROL_DIM, STATE_DIM > control_state_matrix_t
Definition: CostFunctionQuadratic.hpp:36
core::StateVector< STATE_DIM, SCALAR > state_vector_t
Definition: CostFunctionQuadratic.hpp:38
virtual void updateFinalState(const state_vector_t &x_final)
update the reference state for final cost terms
Definition: CostFunctionQuadratic-impl.hpp:98
virtual void updateReferenceState(const state_vector_t &x_ref)
update the reference state for intermediate cost terms
Definition: CostFunctionQuadratic-impl.hpp:91
virtual void initialize()
initialize the cost function (e.g. to be used in CostFunctionAD)
Definition: CostFunctionQuadratic-impl.hpp:269
virtual control_state_matrix_t stateControlDerivativeTerminal()
Computes final-cost derivative with respect to state and control.
Definition: CostFunctionQuadratic-impl.hpp:85
An interface for a term, supporting both analytical and auto-diff terms.
Definition: TermBase.hpp:30
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< SCALAR, STATE_DIM, STATE_DIM > state_matrix_t
Definition: CostFunctionQuadratic.hpp:34
virtual control_matrix_t controlSecondDerivativeIntermediate()=0
Computes intermediate-cost second-order derivative with respect to input.
state_vector_t stateDerivativeTerminalBase()
evaluate terminal analytical state derivatives
Definition: CostFunctionQuadratic-impl.hpp:361
Describes a cost function with a quadratic approximation, i.e. one that can compute first and second ...
Definition: CostFunctionQuadratic.hpp:29
virtual void loadFromConfigFile(const std::string &filename, bool verbose=false)
Loads cost function from config file.
Definition: CostFunctionQuadratic-impl.hpp:63
state_matrix_t stateSecondDerivativeIntermediateBase()
evaluate intermediate analytical state second derivatives
Definition: CostFunctionQuadratic-impl.hpp:374
control_vector_t controlDerivativeIntermediateBase()
evaluate intermediate analytical control derivatives
Definition: CostFunctionQuadratic-impl.hpp:407
CppAD::AD< CppAD::cg::CG< double > > SCALAR
control_vector_t controlDerivativeTerminalBase()
evaluate terminal analytical control derivatives
Definition: CostFunctionQuadratic-impl.hpp:426
state_matrix_t stateSecondDerivativeTerminalBase()
evaluate terminal analytical state second derivatives
Definition: CostFunctionQuadratic-impl.hpp:393
state_vector_t stateDerivativeIntermediateBase()
evaluate intermediate analytical state derivatives
Definition: CostFunctionQuadratic-impl.hpp:341
SCALAR evaluateTerminalBase()
evaluate terminal analytical cost terms
Definition: CostFunctionQuadratic-impl.hpp:328
virtual size_t addIntermediateTerm(std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR >> term, bool verbose=false)
Adds an intermediate term.
Definition: CostFunctionQuadratic-impl.hpp:279
core::ControlVector< CONTROL_DIM, SCALAR > control_vector_t
Definition: CostFunctionQuadratic.hpp:39
CostFunctionQuadratic()
Definition: CostFunctionQuadratic-impl.hpp:12
std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > getIntermediateTermByName(const std::string &name)
Definition: CostFunctionQuadratic-impl.hpp:153
virtual size_t addFinalTerm(std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR >> term, bool verbose=false)
Adds a final term.
Definition: CostFunctionQuadratic-impl.hpp:294
std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > getIntermediateTermById(const size_t id)
Definition: CostFunctionQuadratic-impl.hpp:139
bool stateDerivativeIntermediateTest(bool verbose=false)
compare the state derivative against numerical differentiation
Definition: CostFunctionQuadratic-impl.hpp:112
Eigen::Matrix< SCALAR, CONTROL_DIM, CONTROL_DIM > control_matrix_t
Definition: CostFunctionQuadratic.hpp:35
virtual state_vector_t stateDerivativeTerminal()=0
virtual state_matrix_t stateSecondDerivativeIntermediate()=0
Computes intermediate-cost second-order derivative with respect to state.
bool doubleSidedDerivative_
use double sided derivatives in numerical differentiation
Definition: CostFunctionQuadratic.hpp:235
bool controlDerivativeIntermediateTest(bool verbose=false)
compare the control derivative against numerical differentiation
Definition: CostFunctionQuadratic-impl.hpp:125
virtual control_vector_t controlDerivativeIntermediate()=0
Computes intermediate-cost first-order derivative with respect to control.
virtual control_vector_t controlDerivativeTerminal()
Computes terminal-cost first-order derivative with respect to control.
Definition: CostFunctionQuadratic-impl.hpp:71
const bool verbose
Definition: ConstraintComparison.h:18
virtual control_state_matrix_t stateControlDerivativeIntermediate()=0
Computes intermediate-cost derivative with respect to state and control.
control_vector_t controlDerivativeIntermediateNumDiff()
compute the control derivative by numerical differentiation (can be used for testing) ...
Definition: CostFunctionQuadratic-impl.hpp:222
control_matrix_t controlSecondDerivativeTerminalBase()
evaluate terminal analytical control second derivatives
Definition: CostFunctionQuadratic-impl.hpp:459
control_state_matrix_t stateControlDerivativeTerminalBase()
evaluate terminal analytical control mixed state control derivatives
Definition: CostFunctionQuadratic-impl.hpp:492
std::vector< std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > > finalCostAnalytical_
Definition: CostFunctionQuadratic.hpp:241
virtual CostFunctionQuadratic< STATE_DIM, CONTROL_DIM, SCALAR > * clone() const =0
virtual state_matrix_t stateSecondDerivativeTerminal()=0
Computes final-cost second-order derivative with respect to state.
virtual control_matrix_t controlSecondDerivativeTerminal()
Computes final-cost second-order derivative with respect to input.
Definition: CostFunctionQuadratic-impl.hpp:78
state_vector_t stateDerivativeIntermediateNumDiff()
compute the state derivative by numerical differentiation (can be used for testing) ...
Definition: CostFunctionQuadratic-impl.hpp:175
virtual ~CostFunctionQuadratic()
Definition: CostFunctionQuadratic-impl.hpp:40
std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > getFinalTermById(const size_t id)
Definition: CostFunctionQuadratic-impl.hpp:146
std::shared_ptr< TermBase< STATE_DIM, CONTROL_DIM, SCALAR > > getFinalTermByName(const std::string &name)
Definition: CostFunctionQuadratic-impl.hpp:164