fmincon with full multiple
7 ビュー (過去 30 日間)
古いコメントを表示
Hey guys,
is there a way to get only whole numbers with fmincon? I want only full multiples of 1 as a result.
ceq = mod(x1,1);
I tried modulo, but fmincon will give me my starting position as a result.
0 件のコメント
採用された回答
John D'Errico
2017 年 6 月 2 日
編集済み: John D'Errico
2017 年 6 月 2 日
FMINCON REQUIRES a continuous, differentiable objective function (and constraints).
If you use mod inside the objective function, or discretize something inside like that in any way (perhaps using round or floor), then your function is not at all continuous nor is it differentiable. So FMINCON must fail on your objective.
FMINCON has no capability to allow integer valued parameters in any way.
If you insist on the use of FMINCON, at best you could remove the mod from inside your function, then round the result afterwards. There is no assurance the result will be truly optimal then, but that is the best you can do using FMINCON.
You cannot use FMINCON to solve your problem. I believe some other tools, such as GA from the Global optimization toolbox, can do what you wish.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surrogate Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!