discrete values of optimization variable using fmincon.
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i am trying to solve non-linear constrained optimisation problem for non-linear model predictive Control.
The optimization function I am using is fmincon.
My system is a train and i am trying to find optimal trajectory subject to limits on the maximum allowable velocity which are variable at different space instants and maximum travel time, which must be fulfilled.
The fmincon works fine but i need to find discretized values, which means my fminon should can take values just from this set [-1,0,0.5,0.75,1].
I know that fmincon is limited in this regard but is there any way to make my fmincon optimisation to just choose among these values?
Now it chooses any value between -1 and 1 and that makes the controller very slow.
Secondly my input cannot assume values like 0.001, 0.003, 0.75666, they need to be among the above mentioned values?
Any help in this regard will be really appreciated, I have been stuck for long on this issue.
Thank you
1 commentaire
Torsten
le 5 Fév 2016
If you mean that a certain variable can only take one of the five values during the complete optimization, call fmincon five times, setting the variable to -1 during the first run, to 0 during the second run and so on. Then compare the values you get for the objective function for these five runs.
Best wishes
Torsten.
Réponse acceptée
Matt J
le 5 Fév 2016
Modifié(e) : Matt J
le 5 Fév 2016
There's no reason to use FMINCON for a problem it wasn't built for. Try using ga() instead, with the IntCon option. You would, of course, remap your dictionary of values [-1,0,0.5,0.75,1] to integers, but that should be simple.
2 commentaires
houda mejri
le 13 Avr 2017
Hello, i have the same problem as you with fmincon which can't deal with discrete variables. And i tried ga but didn't get best results. Can you please show me the ga code you use it ? thanks
Plus de réponses (1)
John D'Errico
le 5 Fév 2016
Modifié(e) : John D'Errico
le 5 Fév 2016
Fmincon cannot work with a discrete variable. It assumes the function is a continuous, everywhere differentiable function of the variables. If your variable is discrete, that assumption fails. Period.
Your best option for the simple case like this is to simply use a loop over each possible value of that variable, while using fmincon to solve for the other continuous variables. Then take the best solution overall. Since there are only 5 possible cases for that variable, no problem here.
Were it more complex, with more possible cases to worry about, you can use tools on the file exchange, which do allow for a mixed problem, with some discrete and some continuous variables.
If ALL of your variables are discrete, then again, you have two options. Just use a complete sampling of all possible cases, or use a tool that can handle discrete variables. Fmincon is NOT an option.
1 commentaire
houda mejri
le 13 Avr 2017
Hello, please can you mention some Tools in the file exchange which allow me to treat a mixed problem with discrete and continuous variables ? i have the same problem about fmincon which can't treat discrete variables Cheers
Voir également
Catégories
En savoir plus sur Simulation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!