discrete values of optimization variable using fmincon.
10 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Torsten
2016 年 2 月 5 日
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.
採用された回答
Matt J
2016 年 2 月 5 日
編集済み: Matt J
2016 年 2 月 5 日
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 件のコメント
houda mejri
2017 年 4 月 13 日
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
その他の回答 (1 件)
John D'Errico
2016 年 2 月 5 日
編集済み: John D'Errico
2016 年 2 月 5 日
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 件のコメント
houda mejri
2017 年 4 月 13 日
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
参考
カテゴリ
Help Center および File Exchange で Simulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!