# set_default_objective¶

Class method.

do_mpc.estimator.MHE.set_default_objective(self, P_x, P_v=None, P_p=None, P_w=None)

Configure the suggested default MHE formulation.

Use this method to pass tuning matrices for the MHE optimization problem:

\begin{split}\underset{ \begin{array}{c} \mathbf{x}_{0:N+1}, \mathbf{u}_{0:N}, p,\\ \mathbf{w}_{0:N}, \mathbf{v}_{0:N} \end{array} }{\mathrm{min}} &m(x_0,\tilde{x}_0, p,\tilde{p}) +\sum_{k=0}^{N-1} l(v_k, w_k, p, p_{\text{tv},k}),\\ &\left.\begin{aligned} \mathrm{s.t.}\quad x_{k+1} &= f(x_k,u_k,z_k,p,p_{\text{tv},k})+ w_k,\\ y_k &= h(x_k,u_k,z_k,p,p_{\text{tv},k}) + v_k, \\ &g(x_k,u_k,z_k,p_k,p_{\text{tv},k}) \leq 0 \end{aligned}\right\} k=0,\dots, N\end{split}

where we introduce the bold letter notation, e.g. $$\mathbf{x}_{0:N+1}=[x_0, x_1, \dots, x_{N+1}]^T$$ to represent sequences and where $$\|x\|_P^2=x^T P x$$ denotes the $$P$$ weighted squared norm.

Pass the weighting matrices $$P_x$$, $$P_p$$ and $$P_v$$ and $$P_w$$. The matrices must be of appropriate dimension and array-like.

Note

It is possible to pass parameters or time-varying parameters defined in the do_mpc.model.Model as weighting. You’ll probably choose time-varying parameters (_tvp) for P_v and P_w and parameters (_p) for P_x and P_p. Use set_p_fun() and set_tvp_fun() to configure how these values are determined at each time step.

General remarks:

The respective terms are not present in the MHE formulation in that case.

Note

Use set_objective() as a low-level alternative for this method, if you want to use a custom objective function.

Parameters: P_x (numpy.ndarray, casadi.SX, casadi.DM) – Tuning matrix $$P_x$$ of dimension $$n \times n$$ $$(x \in \mathbb{R}^{n})$$ P_v (numpy.ndarray, casadi.SX, casadi.DM) – Tuning matrix $$P_v$$ of dimension $$m \times m$$ $$(v \in \mathbb{R}^{m})$$ P_p (numpy.ndarray, casadi.SX, casadi.DM) – Tuning matrix $$P_p$$ of dimension $$l \times l$$ $$(p_{\text{est}} \in \mathbb{R}^{l})$$) P_w (numpy.ndarray, casadi.SX, casadi.DM) – Tuning matrix $$P_w$$ of dimension $$k \times k$$ $$(w \in \mathbb{R}^{k})$$