set_param¶
Class method.

do_mpc.controller.MPC.
set_param
(self, **kwargs)¶ Set the parameters of the
MPC
class. Parameters must be passed as pairs of valid keywords and respective argument. For example:mpc.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_mpc = { 'n_horizon': 20, 't_step': 0.5, } mpc.set_param(**setup_mpc)
This makes use of thy python “unpack” operator. See more details here.
Note
The only required parameters are
n_horizon
andt_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.
 n_robust (int , optional) – Robust horizon for robust scenariotree MPC, defaults to
0
. Optimization problem grows exponentially withn_robust
.  open_loop (bool , optional) – Setting for scenariotree MPC: If the parameter is
False
, for each timestep AND scenario an individual control input is computed. If set toTrue
, the same control input is used for each scenario. Defaults to False.  t_step (float) – Timestep of the mpc.
 use_terminal_bounds (bool) – Choose if terminal bounds for the states are used. Defaults to
True
. Set terminal bounds withterminal_bounds
.  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 indiscrete
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 timestep (and during constant control input). Defaults to
1
. Can be used to avoid highorder polynomials.  nl_cons_check_colloc_points (bool) – For orthogonal collocation choose whether the nonlinear bounds set with
set_nl_cons()
are evaluated once per finite Element or for each collocation point. Defaults toFalse
(once per collocation point).  nl_cons_single_slack (bool) – If
True
, softconstraints set withset_nl_cons()
introduce only a single slack variable for the entire horizon. Defaults toFalse
.  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 toTrue
(for all collocation points).  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_total']
.  nlpsol_opts – Dictionary with options for the CasADi solver call
nlpsol
with pluginipopt
. 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 dompc. Change the linear solver with:
MPC.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} MPC.set_param(nlpsol_opts = suppress_ipopt)
This page is autogenerated. Page source is not available on Github.