Say you want to find the optimal value of {$x$} as a function of the parameter {$\theta$} which solves the following parametric linear problem: {$$ \min \ (c + D \theta)^T x \\ \text{s.t.} \ A x \le b,\\ \ x \ge 0,\\ \ 0 \le \theta \le u, $$} where {$A$}, {$b$}, {$c$}, {$d$}, {$u$} are fixed problem data, e.g.:
We first formulate the problem in YALMIP:
Then we convert the problem into the MPT format:
and tell MPT to constuct the parametric solution:
The parametric solution maps the parameters onto optimization variables. For the case of a parametric linear problem, such a map takes a form of a piecewise affine function {$ x^{\star} = F_i \theta + g_i $} if {$ \theta \in \mathcal{R}_i $}, where {$ \mathcal{R}_i $}, {$i = 1, \ldots, N$} are so-called critical regions. The function can be plotted using the fplot() method:
We can also plot the value function versus the parameter by
To plot just the critical regions, use solution.xopt.plot().
Finally, the parametric solution can be used to easily obtain the values of the optimization variables for a particular value of the parameter using the feval() method: