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!