Specify a terminal cost
To specify a terminal cost, you need to create a function handle and use that to set the TerminalCost property.
Basic usage
The handle must take one input, which represents a cell array containing the state variables
. prob.TerminalCost = @(x) myTerminalCost(x);
Note that you can pass any additional parameters to your function handle. For example, if your terminal cost must somehow depend on a desired terminal state x_final_constraint, which you defined somewhere in your script, you can define TerminalCost as
prob.TerminalCost = @(x) myTerminalCost(x, x_final);
Terminal cost and terminal state constraint
Note that, if a terminal state is specified, DynaProg adds by default a penalty term
to the terminal cost in order to enforce the corresponding terminal state constraints. In other words, the cost-to-go at stage N is initialized to:
.Where
is the cost specified with the TerminalCost property (defaults to empty). If you want to disable this feature to gain full control on your terminal cost, you must set the VFPenalty propery to 'none': which will set
to zero. Example