Pyrotor class¶
- class pyrotor.pyrotor.Pyrotor(model, reference_trajectories, endpoints, constraints, basis, basis_features, independent_variable, n_best_trajectory_to_use=10, opti_factor=2, sigma=None, derivative=False, quadratic_model=False, use_quadratic_programming=True, n_jobs=None, verbose=True)¶
Main interface of PyRotor, an optimization package based on data.
Create a new PyPotor class.
- Inputs:
- model: str or list or sklearn model
if str then it is the path to the folder containing the pickle model; else if list, the first element of the list is the constant c, the second one is the linear part w and the third one is the quadratic part q Ex: (8, np.array([2, 1]), np.array([[1, 0], [2, 3]]))
- reference_trajectories: list of DataFrame
List of reference trajectories
- endpoints: dict
Initial and final states that the optimized trajectory must satisfy ex: {‘Var 1’: {‘start’: 109, ‘end’: 98, ‘delta’: 10},
…}
- constraints: list
Constraints the trajectory must complain with. Each constraint is model as a function; if the function is negative when applied on the right variable, then the constraint is considered as not satisfied. ex: [f1, f2] and if f1(trajectory) < 0 then the constraint is not satisfied
- basis: string
Name of the functional basis
- basis_features: dict
Contain information on the basis for each state
- independent_variable: dict
Describe the time-interval on which are defined the trajectories ex: {‘start’: 0, ‘end’: 1, ‘frequency’:.1}
- n_best_trajectory_to_use: int, default=10
Number of trajectories to keep
- opti_factor: float, default=2
Optimisation factor
- sigma: ndarray, default=None
Matrix interpreted as an estimated covariance matrix
- derivative: boolean, default=False
Compute the derivative or not
- quadratic_model: bool
Indicate if the model is quadratic
- use_quadratic_programming: boolean, default=True
Use or not quadratic programming solver
- n_jobs: int, default=None
Number of process to use - If None, sequential
- verbose: boolean, default=True
Display the verbose or not
- compute_gains()¶
Compute gains/savings with respect to reference trajectories.
- compute_one_iteration()¶
Compute an optimised trajectory which must satisfy the constraints.
- compute_optimal_trajectory()¶
Compute the optimized trajectory.
- compute_relative_gains()¶
Compute relative gains/savings with respect to reference trajectories.