Optimization module

File containing optimization solvers.

pyrotor.optimization.compute_optimized_coefficients(format_model, phi, lin_const, sigma_inverse, c_weight, kappa, quadratic_model, extra_info, use_quadratic_programming=True)

Depending on quadratic_model and use_quadratic_programming, decide which solver to use.

Inputs:
  • format_model: list of arrays or sklearn model

    Model of the cost; if list, the first element of the list is the integrated linear part W and the second one is the integrated quadratic part q

  • phi: ndarray

    Matrix representing the initial and final linear conditions

  • lin_const: scipy.optimize.LinearConstraint

    Object containing the initial and final conditions

  • sigma_inverse: ndarray

    Pseudoinverse of the covariance matrix of the reference coefficients

  • c_weight: ndarray

    Coefficients of a weighted trajectory

  • kappa: float

    Optimisation hyperparameter

  • quadratic_model: bool

    Indicate if the model is quadratic

  • extra_info: dict

    Contains independent_variable, basis, basis_features and basis_dimension dictionaries

  • use_quadratic_programming: Boolean

    Use or not quadratic programming solver

Return:
  • c_opt: list of arrays

    Coefficients of the optimized trajectory

pyrotor.optimization.minimize_cvx(Q, W, phi, lin_const, sigma_inverse, c_weight, kappa)

Minimize a quadratic function using CVXOPT library.

The associated matrix must be positive semidefinite.

Inputs:
Q: ndarray

Matrix from the quadratic term of the quadratic model

W: ndarray

Vector from the linear term of the quadratic model

phi: ndarray

Matrix representing the initial and final linear conditions

lin_const: scipy.optimize.LinearConstraint

Object containing the initial and final conditions

sigma_inverse: ndarray

Pseudoinverse of the covariance matrix of the reference coefficients

c_weight: ndarray

Coefficients of a weighted trajectory

kappa: float

Optimisation hyperparameter

Output:
c_optimized: ndarray

Coefficients of the optimized trajectory

pyrotor.optimization.minimize_trust_constr(model, lin_const, sigma_inverse, c_weight, kappa, quadratic_model, extra_info)

Minimize a function using scipy.optimize.

Inputs:
  • model: list of arrays or sklearn model

    Model of the cost; if list, the first element of the list is the integrated linear part W and the second one is the integrated quadratic part q

  • lin_const: scipy.optimize.LinearConstraint

    Object containing the initial and final conditions

  • sigma_inverse: ndarray

    Pseudoinverse of the covariance matrix of the reference coefficients

  • c_weight: ndarray

    Coefficients of a weighted trajectory

  • kappa: float

    Optimisation hyperparameter

  • quadratic_model: bool

    Indicate if the model is quadratic

  • extra_info: dict

    Contains independent_variable, basis, basis_features and basis_dimension dictionaries

Output:
c_optimized: ndarray

Coefficients of the optimized trajectory