GA for Mixed-Integer Nonlinear Programing
Mostrar comentarios más antiguos
Dear all,
I am having a problem with solving a MINLP with GA solver. It keeps having the message of "Constraint function must return real value". I have double checked all the constraints and they should be fine. But this message still appeared. May I ask whether Matlab 2018b can show the contraint that has a problem? I would really appreciate your help.
Thank you so much,
Kind Regards,
Hoang Trinh,
8 comentarios
Ameer Hamza
el 28 de Abr. de 2020
Can you share the code for the optimization problem? Alternatively, you can add a breakpoint inside nonlcon and find out if there is some issue with return values.
Hoang Trinh
el 29 de Abr. de 2020
Walter Roberson
el 29 de Abr. de 2020
You have problems if some of your variables such as x(5) or x(44) or x(45) can be 0, or your x(32) can be sufficiently negative, or if your x(2) can be negative, or your x(1) can be 53, or any of several combinations of values could just happen to cause a division by 0.
It would be easier to debug if we had the rest of your code.
Hoang Trinh
el 29 de Abr. de 2020
Editada: Walter Roberson
el 29 de Abr. de 2020
Walter Roberson
el 29 de Abr. de 2020
Your x(53), x(55), and x(56) all become 5. That gives you division by 0 in entries 106 and 107 of your nonlinear constraints, where you divide by the difference between some of those.
You need to add constraints to ensure relative order of those and that they are never equal.
Hoang Trinh
el 29 de Abr. de 2020
Editada: Walter Roberson
el 29 de Abr. de 2020
Walter Roberson
el 29 de Abr. de 2020
A(51,55) = 1;
A(51,53) = -1;
That expresses that (1) * x(55) + (-1) * x(53) <= b(51) . b(51) is 0, so you are expressing that x(55)-x(53) <= 0, which is to say that x(55) <= x(53) . But that still allows them to be equal, and when they are equal, you get the division by 0.
Linear constraints are A*x' <= b not A*x' < b.
If you want < then you need to make b(51) negative, even if it is only -realmin()
Hoang Trinh
el 30 de Abr. de 2020
Respuestas (0)
Categorías
Más información sobre Linear Predictive Coding en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!