Linear conditions module

Modelisation of linear relations involved in the optimization problem

pyrotor.linear_conditions.get_endpoints_bounds(endpoints, states)

Compute right-hand side for a linear condition associated with endpoints conditions and involved in the optimization problem.

Input:
  • endpoints: dict

    Initial and final states that the optimized trajectory must satisfy ex: {‘Var 1’: {‘start’: 109, ‘end’: 98, ‘delta’: 10}, …}

  • states: iterable

    State names

Outputs:
  • left_endpoints: list

    List containing the lower conditions (at 0 and T) for each state

  • right_endpoints: list

    List containing the upper conditions (at 0 and T) for each state

pyrotor.linear_conditions.get_endpoints_matrix(basis, basis_dimensions, endpoints)

Compute a matrix modelling the endpoints conditions involved in the optimization problem.

The upper-block of the matrix contains the starting conditions while the lower-blocks contains the ending conditions.

Inputs:
  • basis: string

    Name of the functional basis

  • basis_dimensions: dict

    Give the desired number of basis functions for each state

  • endpoints: dict

    Initial and final states that the optimized trajectory must satisfy ex: {‘Var 1’: {‘start’: 109, ‘end’: 98, ‘delta’: 10}, …}

Output:
  • phi: ndarray

    Matrix modelling the endpoints conditions

pyrotor.linear_conditions.get_implicit_bounds(null_space_sigma_phi, coefficients)

Project coefficients mean onto the intersection of null space of sigma and Im PhiT * Phi.

Provide right-hand side for a linear condition in the optimization problem.

Inputs:
null_space_sigma_phi: ndarray

Matrix whose columns are orthonormal vectors spanning the intersection between null space of sigma and phiT * phi

coefficients: list of ndarray

Each element of the list is an array containing all the coefficients associated with a trajectory

Ouput:
projected_mean_coefficients: ndarray

Vector given by the product between null_space_sigma_phi.T and coefficients mean

pyrotor.linear_conditions.get_implicit_matrix(sigma, phi)

Compute an orthonormal basis spanning the intersection between null space of sigma and phiT * phi. Return a matrix whose columns provide the basis and which is involved in implicit conditions in the optimization problem.

Inputs:
  • sigma: ndarray

    Matrix interpreted as an estimated covariance matrix

  • phi: ndarray

    Matrix modelling the endpoints conditions

Output:
  • null_space_sigma_phi: ndarray

    Matrix whose columns are orthonormal vectors and spanning the intersection between null space of sigma and phiT * phi

pyrotor.linear_conditions.get_linear_conditions(basis, basis_dimensions, endpoints, coefficients, sigma)

Return scipy object containing the linear conditions for the optimization problem.

Inputs:
  • basis: string

    Name of the functional basis

  • basis_dimensions: dict

    Give the desired number of basis functions for each state

  • endpoints: dict

    Initial and final states that the optimized trajectory must satisfy ex: {‘Var 1’: {‘start’: 109, ‘end’: 98, ‘delta’: 10}, …}

coefficients: list of ndarray

Each element of the list is an array containing all the coefficients associated with a trajectory

sigma: ndarray

Matrix interpreted as an estimated covariance matrix

Outputs:
  • linear_conditions: LinearConstraint object

    Scipy object describing the linear conditions

  • linear_conditions_matrix: ndarray

    Matrix modelling the linear conditions