How to optimize an objective function with repect to two variables using fmincon?
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to maximize this objective function with respect to a and b using fmincon.
max(-90a-90b+540)
subjected to 3<=a ; b<=8
채택된 답변
Star Strider
2022년 5월 8일
The general approach to maximising a function is to negate it so the minimum that the optimisation functions find is actually the function maximum.
f = @(a,b) (-90*a-90*b+540);
[ab,fv] = fmincon(@(ab) -f(ab(1),ab(2)), rand(2,1), [],[],[],[],[3 -Inf],[inf 8]);
fprintf('\n\ta = %23.15E\n\tb = %23.15E\n\tfv = %23.15E\n\n',ab,fv)
The problem appears to not be well-posed.
.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!