computeVariableIndices
Computes the indices optimization variables.
Contents
Syntax
Description
To formulate the optimal control problem (OCP) in the generic form of a nonlinear programming problem, i.e., min f(y) s.t. lb <= g(y) <= ub, the variables must be lumped together into a single vector y. To, e.g., easily extract the states or control inputs from the optimal solution, this function computes the indices of the entries of y storing the corresponding OCP variable. These indices are stored in the property idxVars - a structure with the following fields: .x: (nominal) states (integer array of dimension [obj.nx,obj.N+1]) .xVec: vectorized idxVars.x (integer array of dimension [obj.nx*(obj.N+1),1]) .u: (nominal) control inputs (integer array of dimension [obj.nu,obj.N]) .uVec: vectorized idxVars.u (integer array of dimension [obj.nu*obj.N,1]) .slack_bu: slack variables associated with violations of the bounds on control inputs (integer array of dimension [U.dim,obj.N]) .slack_buVec: vectorized idxVars.slack_bu (integer array of dimension [obj.nu*obj.N,1]) .nVars: number of optimization variables (integer)
Input Arguments
|
obj |
instance of class optimalControl |
|
U |
set of admissible control inputs (class: polytope) |
Output Arguments
|
obj |
updated instance of class optimalControl |
See Also
© 2018-2026 I6 Technische Universität München Website License
|
![]() |
![]() |
![]() |


