필터 지우기
필터 지우기

maximization nonlinear problem and local maximum solution

조회 수: 2 (최근 30일)
Az.Sa
Az.Sa 2023년 1월 10일
편집: John D'Errico 2023년 1월 10일
Hi,
I have the following code to solve nonlinear maximization problem
objective = @(x) ( -1.167*x(1)-.03127*x(2)- 1.645*sqrt(0.8495263*x(1).^2 + 0.2517729*x(1)*x(2) +0.3102907*x(2).^2 ) );
Aeq = [1,1];
beq = 1;
lb = [0,0];
ub = ones(1,2);
x0 = ones(1,2)/2;
x = fmincon(@(x) - objective(x),x0,[],[],Aeq,beq,lb,ub)
After runing the above code I received :
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
x =
0.0000 1.0000
Can I find global solution not a local? the results in not satisfying because I don't want my x to have 0 and 1 only, I want it to be inbetween 0 and 1. Any advice to improve my solution ?

채택된 답변

Matt J
Matt J 2023년 1월 10일
편집: Matt J 2023년 1월 10일
It is pretty clear from the surface plot that, with the constraints you have, the solution you have found is indeed the global minimum. You need more constraints (or a different objective), if you want a different solution.
objective = @(x) ( -1.167*x(1)-.03127*x(2)- 1.645*sqrt(0.8495263*x(1).^2 + 0.2517729*x(1)*x(2) +0.3102907*x(2).^2 ) );
fsurf(@(x,y) -objective([x,y]),[0 1 0 1],'EdgeColor','none');
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
xlabel X1; ylabel X2; view(10,25)

추가 답변 (1개)

John D'Errico
John D'Errico 2023년 1월 10일
편집: John D'Errico 2023년 1월 10일
Whenever I try to squeeze blood from a rock, all I ever do is get my hands all bloody with my own blood from my own fingers. The darn rocks never seem to bleed!
We can look more carefully at your function.
syms x [1 2]
f = ( -1.167*x(1)-.03127*x(2)- 1.645*sqrt(0.8495263*x(1).^2 + 0.2517729*x(1)*x(2) +0.3102907*x(2).^2 ) );
% The constraint is x(1) + x(2) == 1
fx = subs(f,x(2),1-x(1))
fx = 
fplot(fx,[0 1])
xlabel 'x'
ylabel 'objective(x,1-x)')
You are trying to MAXIMIZE the objective, where x and y live on the interval [0,1].
Do you see the maximum occurs at the point (x,y) = (0,1)? fmincon found the global solution that lies within the bounds you supplied. How much better could it possibly do?
Wanting fmincon to find some other solution is a task of futility. And it will just tend to get your hands all bloody. Honestly, I've tried many times. But, maybe I should try squeezing some garnets (rubies are too expensive for this.) At least they are already red. Next time...

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by