# checkConstraint

check if the solution to the optimal control problems satisfies all constraints

## Contents

- Syntax
- Description
- Input Arguments
- Output Arguments
- See Also

## Syntax

[res,L_,J_] = checkConstraint(x,u,L,J,Opts)

## Description

This function checks if the solution that was determined with the optimal control problems satisfies all constraints. This is necessary because due to the limited computation time the optimal control problems might be terminated before totoal convergence is achieved. Further, the function checks if the cost for the new solution is lower than the cost for the previous solution

## Input Arguments

x | Center trajectory determined by the optimal control problem (dimension: [nx,N])
u | Control inputs determined by the optimal control problem (dimension: [nu,N])
L | Value of the objective function (=cost) of the previous solution
J | Summed distance of the points from the previous solution to the terminal region
Opts | a structure containing following options
.dT | time step. Prediction horizon: Opts.N * Opts.dT
.Q | state weighting matrix for the cost function (center trajectory)
.R | input weighting matrix for the cost function (center trajectory)
.termReg | terminal region around the steady state xf (class: mptPolytope)
.alpha | contraction rate for the contraction constraint [{0.1} / alpha > 0]

## Output Arguments

res | Flag that specifies if all constraints are satisfied and the cost of the new solution is lower than the one for the previous solution (0 or 1)
L_ | Value of the objective function (=cost) of the new solution
J_ | Summed distances of the points from the new solution to the terminal region

## See Also

`reachsetMPC`

© 2018-2023 I6 Technische Universität München `•` Website `•` License