softMax

Purpose

Soft upper bound constraint

Syntax


Description

This filter will soften the upper bound constraint on a selected signal in the MPC setup. Without this filter, upper bounds are hard, i.e., the signal has to satisfy ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax1.png. With this filter added, the upper bound is soft and can be violated by some positive margin ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax2.png, i.e., the new constraint becomes ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax3.png. The slack variables ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax4.png are then penalized in the MPC cost function by adding the term ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax5.png.

To enable this filter, first call model.signal.with('softMax'), where you replace signal by the actual system's signal (typically by x for state variables, u for inputs, and y for outputs).

With the filter enabled, you can set the maximal allowed violation of the constraint in model.signal.softMax.maximalViolation, and specify penalization of the slack variables by setting model.signal.softMax.penalty.

To remove this filter, call model.signal.without('softMax').

Example(s)

Example 1

Specify an LTI system ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax6.png, ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax7.png
sys = LTISystem('A', 0.9, 'B', 1, 'C', 1);
Add unity quadratic penalties on states and inputs (but not
    on the terminal state)
		sys.x.penalty = Penalty(1, 2);
		sys.u.penalty = Penalty(1, 2);
	
===========================================================
The Penalty object is deprecated.
Use obj.penalty = QuadFunction(Q) to define z'*Q*z penalty.
===========================================================
===========================================================
The Penalty object is deprecated.
Use obj.penalty = QuadFunction(Q) to define z'*Q*z penalty.
===========================================================
Define hard state constraints
sys.x.min = -1; sys.x.max = 1;
Make the upper bound soft with maximal violation of ../../../../../fig/mpt/modules/ui/@SystemSignal/filter_softmax8.png
      
		sys.x.with('softMax');
		sys.x.softMax.maximalViolation = 3;
		M = MPCController(sys, 4);
		x0 = 3.5;
		[u, feasible, openloop] = M.evaluate(x0)
	
u =

                     -2.15


feasible =

     1


openloop = 

    cost: 25018.3457016632
       U: [-2.15 -0.525779625779547 -0.168399168399664 -7.04103442217274e-13]
       X: [3.5 0.999999999999999 0.374220374220451 0.168399168398741 0.151559251558165]
       Y: [3.5 1 0.37422037422045 0.168399168398741]


© 2003-2013 Michal Kvasnica: STU Bratislava, michal.kvasnica@stuba.sk