cvxpy_variables
CVXPy variables and parameters dataclass for the optimal control problem.
CVXPyVariables
dataclass
¶
CVXPy variables and parameters for the optimal control problem.
This dataclass holds all CVXPy Variable and Parameter objects needed to construct and solve the optimal control problem. It replaces the previous untyped dictionary approach with a typed, self-documenting structure.
The variables are organized into logical groups
- SCP weights: Parameters controlling trust region and penalty weights
- State: Variables and parameters for the state trajectory
- Control: Variables and parameters for the control trajectory
- Dynamics: Parameters for the discretized dynamics constraints
- Nodal constraints: Parameters for linearized non-convex nodal constraints
- Cross-node constraints: Parameters for linearized cross-node constraints
- Scaling: Affine scaling matrices and offset vectors
- Scaled expressions: CVXPy expressions for scaled state/control at each node
Attributes:
| Name | Type | Description |
|---|---|---|
w_tr |
Parameter
|
Trust region weight parameter (scalar, nonneg) |
lam_cost |
Parameter
|
Cost function weight parameter (scalar, nonneg) |
lam_vc |
Parameter
|
Virtual control penalty weights (N-1 x n_states, nonneg) |
lam_vb |
Parameter
|
Virtual buffer penalty weight (scalar, nonneg) |
x |
Variable
|
State variable (N x n_states) |
dx |
Variable
|
State error variable (N x n_states) |
x_bar |
Parameter
|
Previous SCP state parameter (N x n_states) |
x_init |
Parameter
|
Initial state parameter (n_states,) |
x_term |
Parameter
|
Terminal state parameter (n_states,) |
u |
Variable
|
Control variable (N x n_controls) |
du |
Variable
|
Control error variable (N x n_controls) |
u_bar |
Parameter
|
Previous SCP control parameter (N x n_controls) |
A_d |
Parameter
|
Discretized state Jacobian parameter (N-1 x n_states*n_states) |
B_d |
Parameter
|
Discretized control Jacobian parameter (N-1 x n_states*n_controls) |
C_d |
Parameter
|
Discretized control Jacobian (next node) parameter |
x_prop |
Parameter
|
Propagated state parameter (N-1 x n_states) |
nu |
Variable
|
Virtual control variable (N-1 x n_states) |
g |
List[Parameter]
|
List of constraint value parameters (one per nodal constraint) |
grad_g_x |
List[Parameter]
|
List of state gradient parameters (one per nodal constraint) |
grad_g_u |
List[Parameter]
|
List of control gradient parameters (one per nodal constraint) |
nu_vb |
List[Variable]
|
List of virtual buffer variables (one per nodal constraint) |
g_cross |
List[Parameter]
|
List of cross-node constraint value parameters |
grad_g_X_cross |
List[Parameter]
|
List of trajectory state gradient parameters |
grad_g_U_cross |
List[Parameter]
|
List of trajectory control gradient parameters |
nu_vb_cross |
List[Variable]
|
List of cross-node virtual buffer variables |
S_x |
ndarray
|
State scaling matrix (n_states x n_states) |
inv_S_x |
ndarray
|
Inverse state scaling matrix |
c_x |
ndarray
|
State offset vector (n_states,) |
S_u |
ndarray
|
Control scaling matrix (n_controls x n_controls) |
inv_S_u |
ndarray
|
Inverse control scaling matrix |
c_u |
ndarray
|
Control offset vector (n_controls,) |
x_nonscaled |
List
|
List of scaled state expressions at each node |
u_nonscaled |
List
|
List of scaled control expressions at each node |
dx_nonscaled |
List
|
List of scaled state error expressions at each node |
du_nonscaled |
List
|
List of scaled control error expressions at each node |
Source code in openscvx/lowered/cvxpy_variables.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |