pockit.base.discretizationbase
Compute the left and right indices if the border variables are shared.
The left index is l_c[i]
and the right index is r_c[i]
, which
represents the range of interval i
in a half-open interval [l_c[i],
r_c[i])
.
Arguments:
- num_point: Number of interpolation points of each interval.
Returns:
Left and right index
l_c, r_c
for shared border variables.
Compute the left and right indices if separate variables represent the
common borders. The left index is l_nc[i]
and the right index is
r_nc[i]
, which represents the range of interval i
in a half-open
interval [l_nc[i], r_nc[i])
.
Arguments:
- num_point: Number of interpolation points of each interval.
Returns:
Left and right index
l_nc, r_nc
for separate border variables.
Hold the data of a sparse matrix in COO format.
In the discretization scheme, the state and control variables are represented by values at discrete time points. The scheme requires additional information about whether the vector contains the variable's initial and terminal values to handle boundary conditions.
The data structure is applied to state, control, and middle-stage variables.
Arguments:
- front: The index of the front variable or
None
if the vector does not contain the initial value. - middle: The range of the middle variables.
- back: The index of the back variable or
None
if the vector does not contain the terminal value.
Classify the COO matrix into front, middle, and back parts according to the column index and the index partition.
The data structure is used to generate the Jacobian and Hessian matrices of the discretized problem.
Arguments:
- csr_matrix: The CSR matrix to be classified.
- index: The index partition of the vector.
Essential information for a discretization scheme.
The class contains the information to discretize the continuous-time optimal control problem into a discrete-time problem and generate the derivative matrices.
Arguments:
- mesh: The mesh points of the time interval.
- num_point: The number of interpolation points in each subinterval.
- n_x: The number of state variables.
- n_u: The number of control variables.
The mesh points of the time interval, scaled to [0, 1]
.
The number of interpolation points in each subinterval.
The left index of the state and control variables.
The right index of the state and control variables (exclusive).
Position of all interpolation nodes in the middle stage, scaled to
[0, 1]
.
The left index of subintervals in the middle stage.
The right index of subintervals in the middle stage (exclusive).
The integration weights of the middle stage.
Function turns the state and control variables into the middle stage.
Translation matrix of a state variable to eliminate the integration coefficient.
Translation matrix of a state variable in COO format partitioned by the index.
Integration matrix of a middle-stage variable in COO format partitioned by the index.
The left index of the dynamic constraints of each state variable.
The right index of the dynamic constraints of each state variable (exclusive).
Position of all interpolation nodes in the middle stage, scaled to
[0, 1]
with one additional interpolation point in each
subinterval.
The left index of subintervals in the middle stage, with one additional interpolation point in each subinterval.
The right index of subintervals in the middle stage (exclusive), with one additional interpolation point in each subinterval.
The number of interpolation points in the middle stage, with one additional interpolation point in each subinterval.
The integration weights of each subinterval in the middle stage, with one additional interpolation point in each subinterval.
Function to compute the polynomial matrix given the number of interpolation points.
The value matrix translates all state and control variables to the middle stage with one additional interpolation point in each subinterval.
The translation matrix of all state variables, with one additional interpolation point in each subinterval.
The integration matrix of a middle-stage variable, with one additional interpolation point in each subinterval.
Position of all interpolation nodes of a state variable, scaled to
[0, 1]
.
Position of all interpolation nodes of a control variable, scaled to
[0, 1]
.
The left index of subintervals of a state variable.
The right index of subintervals of a state variable (exclusive).