Skip to content

Constraints‐Removal‐based MPC design

Juraj Holaza edited this page Apr 17, 2026 · 9 revisions

MPT+ wiki: Constraints-Removal-based MPC design

Model predictive control (MPC) requires repeatedly solving a constrained optimization problem online, with computational complexity increasing with the prediction horizon, system order, and number of constraints. As shown in M. Jost et al., Accelerating Linear Model Predictive Control by Constraint Removal (European Journal of Control), constraints can be progressively removed during execution without compromising stability or optimality. The approach uses the MPC cost function to compute, offline, σ-values—lower bounds of the Lyapunov function indicating when constraints may become active. Constraints guaranteed to remain inactive are redundant and can be removed from the optimization problem. For a stable MPC policy, the system converges to the origin (terminal set), where no constraints are active. Along this trajectory, the cost decreases and constraints can be sequentially eliminated, ultimately yielding an unconstrained problem.

MPTplus enables the implementation of this constraint-removal-based MPC (CR-MPC) design according to M. Jost et al., Accelerating Linear Model Predictive Control by Constraint Removal (European Journal of Control). This module allows users to redefine an existing MPC policy (designed in MPT3) to incorporate the constraint removal approach. In the following, we demonstrate how to define CR-MPC via class CRController.

CRMPCController Class

The CRMPCController class extends the standard MPCController by incorporating a constraint removal (CR) strategy to accelerate the online solution of MPC problems. The controller dynamically removes inactive constraints during operation, reducing computational complexity while preserving stability and optimality.

crmpc = CRController(ctrl, options)

where ctrl is an instance of the standard MPCController class from the MPT3 toolbox, and options is an optional structure specifying additional parameters:

Option Values (Default) Description
initializeType 0 / 1 (1) Initialization mode of the CR controller:
1 – initialize with only feasible inequality constraints
0 – initialize with all constraints (including infeasible)
CRfixed 0 / 1 (0) Enables/disables constraint removal:
0 – constraint removal active
1 – constraint removal disabled
SolveType 0 / 1 (1) Method used to measure QP solve time:
1timeit()
0tic-toc or built-in solver timing
SigmaShiftBias ≥ 0 (0) Additive shift of σ-values: σ⁺ = σ + Bias
SigmaShiftGain ≥ 0 (1) Multiplicative shift of σ-values: σ⁺ = σ · Gain

Properties

  • CRparams
    Stores parameters and precomputed data required for constraint removal.

  • InActiveCons
    Number of currently inactive inequality constraints.
    Constraints 1:InActiveCons are considered inactive.

  • Jprev
    Cost value from the previous iteration, used to determine constraint activity.

  • ConStat
    Indicates controller initialization status:

    • 1 – fully initialized (all constraints active)
    • 0 – constraints have been removed (modified state)

DEMO:

Basic MPC controller construction

%% Standard MPC design
model = LTISystem(ss([1 1; 0 1], [1; 0.5], [1 0], 0,'Ts', 0.1));
model.x.max = [5; 5];
model.x.min = [-5; -5];
model.u.max = 1;
model.u.min = -1;
model.x.penalty = QuadFunction(diag([1 1]));
model.u.penalty = QuadFunction(0.1);
model.x.with('terminalPenalty');
model.x.terminalPenalty = model.LQRPenalty();
model.x.with('terminalSet');
model.x.terminalSet = model.LQRSet();

N = 5;
ctrl = MPCController(model,N);

Construction of CR-MPC controller

The CR-MPC controller is obtained from the nominal MPC controller using:

option = {'initializeType',1,...
          'CRfixed',0,...          % Enable constraint removal
          'SolveType',0,...
          'SigmaShiftBias',0,...
          'SigmaShiftGain',1};

crmpc = CRController(ctrl,option);

For comparison, a controller with constraint removal disabled can be constructed as:

option = {'initializeType',1,...
          'CRfixed',1,...          % Disable constraint removal
          'SolveType',0,...
          'SigmaShiftBias',0,...
          'SigmaShiftGain',1};

nocrmpc = CRController(ctrl,option);

Closed-loop simulation and comparison

x0 = [5; -3];
Nsim = 20;

ClosedLoopData  = ctrl.simulate(x0, Nsim);
ClosedLoopData2 = crmpc.simulate(x0, Nsim);
ClosedLoopData3 = nocrmpc.simulate(x0, Nsim);

The CR-MPC controller produces the same closed-loop trajectories as the original MPC while reducing the number of active constraints during optimization.

Visualization of results

figure
subplot(4,1,1)
hold on, box on, grid on
xlabel('Control steps k')
ylabel('System states x(t)')
stairs([0:Nsim],ClosedLoopData.X(1,:),'b','LineWidth',2)
stairs([0:Nsim],ClosedLoopData.X(2,:),'g','LineWidth',2)
stairs([0:Nsim],ClosedLoopData2.X','r--','LineWidth',2)
legend('x1','x2','CRx1','CRx2')

subplot(4,1,2)
hold on, box on, grid on
xlabel('Control steps k')
ylabel('System inputs u(t)')
stairs([0:Nsim-1],ClosedLoopData.U,'LineWidth',2)
stairs([0:Nsim-1],ClosedLoopData2.U,'r--','LineWidth',2)
legend('u','CRu')

subplot(4,1,3)
hold on, box on, grid on
xlabel('Control steps k')
ylabel('Objective value J(t)')
stairs([0:Nsim-1],ClosedLoopData.cost,'LineWidth',2)
stairs([0:Nsim-1],ClosedLoopData2.cost,'r--','LineWidth',2)

subplot(4,1,4)
hold on, box on, grid off
xlabel('Control steps k')
ylabel('No. inactive constraints')
stairs([0:Nsim-1],ClosedLoopData2.ncons,'r--','LineWidth',2)
CR

Sigma-based constraint removal mechanism

The CR-MPC method relies on the values of the parameter sigma, which determine when constraints can be safely removed.

sigmas = crmpc.CRparams.sigma(~isinf(crmpc.CRparams.sigma));

These values can be visualized together with the cost evolution to understand the constraint removal process.

Adjusting sigma values

The aggressiveness of constraint removal can be tuned using SigmaShiftGain and SigmaShiftBias:

option = {'SigmaShiftGain',2,'SolveType',1};
crmpcShifted = CRController(ctrl,option);

Increasing SigmaShiftGain results in more aggressive constraint removal.

Effect of sigma shifting

The aggressiveness of constraint removal can be adjusted using the parameters SigmaShiftGain and SigmaShiftBias. These parameters modify the sigma thresholds that determine when constraints become inactive.

Increasing SigmaShiftGain results in earlier and more aggressive constraint removal. This leads to a reduction in the number of active constraints during optimization, as illustrated in the figure.

The figure compares:

  • the nominal MPC controller,
  • the CR-MPC controller,
  • and the CR-MPC controller with shifted sigma values.
CRshifted

While the closed-loop cost remains similar, the shifted controller typically achieves a lower number of active constraints, improving computational efficiency.

Notes

  • CR-MPC preserves the closed-loop behavior of the nominal MPC controller.
  • The number of inactive constraints during optimization is available in ClosedLoopData.ncons.
  • Use CRfixed = 0 to enable constraint removal and CRfixed = 1 to disable it.
  • The method is particularly beneficial for problems with many constraints where online computational complexity is critical.

Clone this wiki locally