set_param

Class method.

do_mpc.estimator.MHE.set_param(self, **kwargs)

Method to set the parameters of the MHE class. Parameters must be passed as pairs of valid keywords and respective argument. For example:

mhe.set_param(n_horizon = 20)

It is also possible and convenient to pass a dictionary with multiple parameters simultaneously as shown in the following example:

setup_mhe = {
    'n_horizon': 20,
    't_step': 0.5,
}
mhe.set_param(**setup_mhe)

This makes use of thy python “unpack” operator. See more details here.

Note

The only required parameters are n_horizon and t_step. All other parameters are optional.

Note

set_param() can be called multiple times. Previously passed arguments are overwritten by successive calls.

The following parameters are available:

Parameters:
  • n_horizon (int) – Prediction horizon of the optimal control problem. Parameter must be set by user.
  • t_step (float) – Timestep of the mhe.
  • meas_from_data (bool) – Default option to retrieve past measurements for the MHE optimization problem. The set_y_fun() is called during setup.
  • state_discretization (str) – Choose the state discretization for continuous models. Currently only 'collocation' is available. Defaults to 'collocation'. Has no effect if model is created in discrete type.
  • collocation_type (str) – Choose the collocation type for continuous models with collocation as state discretization. Currently only 'radau' is available. Defaults to 'radau'.
  • collocation_deg (int) – Choose the collocation degree for continuous models with collocation as state discretization. Defaults to 2.
  • collocation_ni (int) – For orthogonal collocation, choose the number of finite elements for the states within a time-step (and during constant control input). Defaults to 1. Can be used to avoid high-order polynomials.
  • nl_cons_check_colloc_points (bool) – For orthogonal collocation choose wether the bounds set with set_nl_cons() are evaluated once per finite Element or for each collocation point. Defaults to False (once per collocation point).
  • cons_check_colloc_points (bool) – For orthogonal collocation choose whether the linear bounds set with bounds are evaluated once per finite Element or for each collocation point. Defaults to True (for all collocation points).
  • nl_cons_single_slack (bool) – If True, soft-constraints set with set_nl_cons() introduce only a single slack variable for the entire horizon. Defaults to False.
  • store_full_solution (bool) – Choose whether to store the full solution of the optimization problem. This is required for animating the predictions in post processing. However, it drastically increases the required storage. Defaults to False.
  • store_lagr_multiplier (bool) – Choose whether to store the lagrange multipliers of the optimization problem. Increases the required storage. Defaults to True.
  • store_solver_stats (dict) – Choose which solver statistics to store. Must be a list of valid statistics. Defaults to ['success','t_wall_S','t_wall_S'].
  • nlpsol_opts – Dictionary with options for the CasADi solver call nlpsol with plugin ipopt. All options are listed here.

Note

We highly suggest to change the linear solver for IPOPT from mumps to MA27. In many cases this will drastically boost the speed of do-mpc. Change the linear solver with:

optimizer.set_param(nlpsol_opts = {'ipopt.linear_solver': 'MA27'})

Note

To suppress the output of IPOPT, please use:

suppress_ipopt = {'ipopt.print_level':0, 'ipopt.sb': 'yes', 'print_time':0}
optimizer.set_param(nlpsol_opts = suppress_ipopt)

This page is auto-generated. Page source is not available on Github.