Azzera filtri
Azzera filtri

How to use the quadprog function for solving non-convex quadratic optimization problems in Simulink?

24 visualizzazioni (ultimi 30 giorni)

Hi,
I used a user-defined Matlab function in Simulink in which a quadprog function is called, but it kept telling me to use the active-set algorithm. However, this algorithm does not apply to non-convex quadratic problems. How can I solve this problem?
Thanks

Risposte (2)

Raghav
Raghav il 2 Ago 2023
Hi Yichuan,
If you are encountering issues with the “quadprog” function in Simulink suggesting the use of the active-set algorithm, which is not suitable for non-convex quadratic problems, you can try an alternative approach to solve your problem. Here are a few suggestions:
  1. Optimization Toolbox: Simulink provides integration with the Optimization Toolbox, which offers various optimization algorithms suitable for non-convex problems. You can use the “fmincon” function from the Optimization Toolbox to solve your non-convex quadratic optimization problem within Simulink. This function supports both constrained and unconstrained optimization. Please refer to the below documentation for using the same: https://www.mathworks.com/help/optim/ug/fmincon.html
  2. Custom MATLAB Function: Instead of using the “quadprog” function directly in the MATLAB Function block, you can create a custom MATLAB function that implements a non-convex optimization algorithm suitable for your problem. This function can be called from within the MATLAB Function block in Simulink.
  3. External Optimization Software: If the non-convex optimization problem is complex and requires specialized solvers, you can consider using external optimization software. You can create a standalone MATLAB script or function that calls the external optimization software and then integrate it into Simulink using the MATLAB System block or the System object.
Remember to carefully evaluate and choose an optimization algorithm that is appropriate for your specific non-convex quadratic problem. It is also important to ensure that the chosen algorithm is compatible with Simulink and can be seamlessly integrated into your model.
Hope it helps,
Best Regards,
Raghav Bansal
MathWorks Technical Support

Bruno Luong
Bruno Luong il 2 Ago 2023
Modificato: Bruno Luong il 2 Ago 2023
I'm not sure about simulink, but for MATLAB , you have only limited support for non-convex by quadprog:
  • "The 'interior-point-convex' algorithm handles only convex problems.
  • The 'trust-region-reflective' algorithm handles problems with only bounds or only linear equality constraints, but not both.
  • The 'active-set' algorithm handles indefinite problems provided that the projection of H onto the nullspace of Aeq is positive semidefinite. For details, see Choosing the Algorithm."
I'm not sure how reliable when quadprog verifies those assumptions in the specific algorithm and whereas it verifies at all to select appropriate default algorithm is user does not specify.
So if you are NOT in these cases you have to use other algoritm such as fmincon.

Categorie

Scopri di più su Quadratic Programming and Cone Programming in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by