Nonlinear MPC hard constraints

25 visualizaciones (últimos 30 días)
Tristan
Tristan el 25 de Nov. de 2024 a las 16:57
Editada: Ashok el 27 de Nov. de 2024 a las 3:36

Is there a way to make custom inequality constraint functions in the nonlinear mpc functions to be a hard constraint and not a slacked constraint? I have been trying to design a nonlinear mpc that needs a custom constraint but it seems by default this is slacked, and it would be highly infeasible if it was strictly enforced.

Respuestas (1)

Ashok
Ashok el 26 de Nov. de 2024 a las 12:00
Editada: Ashok el 26 de Nov. de 2024 a las 12:12
Hey @Tristan,
In the Model Predictive Control Toolbox, the default implementation of MPC uses slack variables to handle constraints. Setting these slack variables to zero converts the constraints into hard constraints. The constraint violation penalty weight indicates the weightage given to the slack variable in a minimization problem, as detailed here:
Raising this weight to a high value makes the constraints stricter.
Here's how it can be done:
  • If using the standard cost function and the propertynlmpc.Optimization.ReplaceStandardCostis set tofalse, increasing thenlmpc.Weights.ECRvalue raises the weight on the slack variables. More details are available here:
  • When specifying a custom cost function for a nonlinear MPC controller, it's possible to replace or augment the standard quadratic MPC cost function. By default, anlmpccontroller replaces the standard cost function with the custom one, treating all constraints as hard constraints.
  • To combine standard and custom costs, setnlmpc.Optimization.ReplaceStandardCostto false, similar to the first scenario, allowing adjustments to thenlmpc.Weights.ECR property.
The attached file example_R2024b.m contains a simple example with a custom cost function andnlmpc.Optimization.ReplaceStandardCostset totrue, treating the constraint as a hard constraint.
The plot of the states shows that state x remains within 5, even when the reference/desired state is 10.
For more detailed information, check out these pages:
I believe this will assist you!
  2 comentarios
Tristan
Tristan el 26 de Nov. de 2024 a las 15:54
Your example seems to be for a custom cost function. Can you detail the analagous steps for custom inequality constraint function?
Ashok
Ashok el 27 de Nov. de 2024 a las 3:36
Editada: Ashok el 27 de Nov. de 2024 a las 3:36
The attached example specifies a custom cost function named 'customCostFcn' along with a custom inequality constraint funtion named 'customConstraintFcn'. They are added to the nlmpc object, 'nlobj' by the following lines in the attached code.

Iniciar sesión para comentar.

Categorías

Más información sobre Model Predictive Control Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by