How to solve an optimization problem over two variables using fmincon?
Afficher commentaires plus anciens
Hello, I'm trying to solve an optimization problem in which there is a decision variable in its objective function, and some constraints with afformentioned variable and also another decision variable that must be calculated. this problem could be depicted as below:
Minimize Z=f(x)
subject to: g(x,y)<=0
x and y are both decision variables that in particular y is a binary variable that gonna choose an additional constraint to make it continues.
3 commentaires
David Hill
le 5 Avr 2021
After reviewing the documentation, https://www.mathworks.com/help/optim/ug/fmincon.html, if you have a specific question, show us your code and ask.
Bill Masters
le 6 Avr 2021
Bill Masters
le 7 Avr 2021
Réponses (1)
John D'Errico
le 5 Avr 2021
Modifié(e) : John D'Errico
le 5 Avr 2021
0 votes
You CANNOT use fmincon on a problem with binary variables or any form of discrete variables.
However, IF y is indeed binary, then you have only two cases to consider. So solve the problem to minimize f(x), given y == 0, and then repeat, solving it for the minimum over x of f(x), given y == 1.
Take the better of the two results and you are done. There really is little more than that to do here. You still need to choose intelligent starting values for x of course. Note that if there are multiple disjoint regions for x that satisfy the constraints, thus g(x,y)<=0, then you need to search within EACH of them. Fmincon cannot intelligently jump from one such region to another to search among them all.
If you had a more complicated case where you had multiple binary variables, then you would be forced to use a code like GA, which can handle the fully general problem. But that is apparently not the case here.
1 commentaire
Bill Masters
le 6 Avr 2021
Modifié(e) : Bill Masters
le 6 Avr 2021
Catégories
En savoir plus sur Problem-Based Optimization Setup dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!