MHESettings#
- class MHESettings(n_horizon=None, t_step=None, meas_from_data=False, state_discretization='collocation', collocation_type='radau', collocation_deg=2, collocation_ni=1, nl_cons_check_colloc_points=False, nl_cons_single_slack=False, cons_check_colloc_points=True, store_full_solution=False, store_lagr_multiplier=True, store_solver_stats=<factory>, nlpsol_opts=<factory>)[source]#
Bases:
EstimatorSettingsSettings for
do_mpc.estimator.MHE.The
do_mpc.estimator.MHEautomatically creates an instance of typeMHESettingsand adds it to its class attributes.Example to change settings:
mhe.settings.n_horizon = 20
Note
Settings cannot be updated after calling
do_mpc.estimator.MHE.setup().- Parameters:
n_horizon (
int)t_step (
float)meas_from_data (
bool)state_discretization (
str)collocation_type (
str)collocation_deg (
int)collocation_ni (
int)nl_cons_check_colloc_points (
bool)nl_cons_single_slack (
bool)cons_check_colloc_points (
bool)store_full_solution (
bool)store_lagr_multiplier (
bool)store_solver_stats (
List[str])nlpsol_opts (
Dict)
Methods#
check_for_mandatory_settings#
- check_for_mandatory_settings(self)#
Method to assert the necessary settings required to design
do_mpc.estimator.MHE
set_linear_solver#
- set_linear_solver(self, solver_name='MA27')#
Method to set the linear solver to
MA27.This method enables to set the linear solver to
MA27. This change in many cases will drastically boost the speed of do-mpc.Example:
mhe.settings.set_linear_solver(solver_name = "MA27")
- Parameters:
solver_name (
str) – Specify the solver name.
supress_ipopt_output#
- supress_ipopt_output(self)#
Method to supress the ipopt solver output.
This method set the revelvant settings in the ipopt solver in order to supress the output log.
Attributes#
collocation_deg#
-
MHESettings.collocation_deg:
int= 2# Choose the collocation degree for continuous models with collocation as state discretization.
collocation_ni#
-
MHESettings.collocation_ni:
int= 1# For orthogonal collocation, choose the number of finite elements for the states within a time-step (and during constant control input).
Note
Can be used to avoid high-order polynomials.
collocation_type#
-
MHESettings.collocation_type:
str= 'radau'# Choose the collocation type for continuous models with collocation as state discretization.
Note
Currently only
'radau'collocation type is available.
cons_check_colloc_points#
-
MHESettings.cons_check_colloc_points:
bool= True# For orthogonal collocation choose whether the linear bounds set with
do_mpc.estimator.MHE.boundsare evaluated once per finite Element or for each collocation point.
meas_from_data#
-
MHESettings.meas_from_data:
bool= False# Default option to retrieve past measurements for the MHE optimization problem.
The
do_mpc.estimator.MHE.set_y_fun()is called during setup.
n_horizon#
-
MHESettings.n_horizon:
int= None# Prediction horizon of the optimal control problem.
Parameter must be set by user.
nl_cons_check_colloc_points#
-
MHESettings.nl_cons_check_colloc_points:
bool= False# For orthogonal collocation choose wether the bounds set with
do_mpc.estimator.MHE.set_nl_cons()are evaluated once per finite Element or for each collocation point.
nl_cons_single_slack#
-
MHESettings.nl_cons_single_slack:
bool= False# If
True, soft-constraints set withdo_mpc.estimator.MHE.set_nl_cons()introduce only a single slack variable for the entire horizon.
state_discretization#
-
MHESettings.state_discretization:
str= 'collocation'# Choose the state discretization for continuous models.
Currently only
'collocation'is available.Note
This attribute has no effect if model is created in
discretetype.
store_full_solution#
-
MHESettings.store_full_solution:
bool= False# Choose whether to store the full solution of the optimization problem.
This is required for animating the predictions in post processing.
Warning
It drastically increases the required storage.
store_lagr_multiplier#
-
MHESettings.store_lagr_multiplier:
bool= True# Choose whether to store the lagrange multipliers of the optimization problem.
Warning
Increases the required storage.
t_step#
-
MHESettings.t_step:
float= None# Timestep of the estimator.
store_solver_stats#
-
MHESettings.store_solver_stats:
List[str]# Choose which solver statistics to store.
Must be a list of valid statistics.