maximization nonlinear problem and local maximum solution
1 view (last 30 days)
Show older comments
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 ?
0 Comments
Accepted Answer
Matt J
on 10 Jan 2023
Edited: Matt J
on 10 Jan 2023
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');
xlabel X1; ylabel X2; view(10,25)
0 Comments
More Answers (1)
John D'Errico
on 10 Jan 2023
Edited: John D'Errico
on 10 Jan 2023
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))
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...
0 Comments
See Also
Categories
Find more on Nonlinear Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!