Finding all local/global minima of an Optimization Problem

9 views (last 30 days)
Is there a way of finding all local/global minima of an Optimization Problem with Matlab?
For example:
f= [-1,-1]
x0 = [0,0];
ub = [5,5];
lb = [0,0];
A = [1 1];
b = 9;
Aeq = [];
beq = [];
[x,fval] = linprog(f,A,b,Aeq,beq,lb,ub)
Here i get the solution x = (4,5) but i would like to get the solution (5,4) too.
(I want to iterate over all local/global solutions after)
Thank you

Accepted Answer

John D'Errico
John D'Errico on 20 Jan 2022
Edited: John D'Errico on 20 Jan 2022
Do you understand there are infinitely many such equivalent solutions to that problem, not just TWO? And, while I'd like to write code that will generate infinitely many solutions, it tends to take a long time to run. You seems to be choosing the two soutions at the extremes (not surprising for LP solutions) but if you want to generate more than just one solution, then you need to accept that the rest of them are equally valid. So if [5,4] and [4,5] are solutions you wish to see, then why not [4.5,4.5], and [4.3,4.7]?
Anyway, iterating over ALL such local solutions is clearly impossible. Even if your computer is REALLY fast, infinity is a long way out.
Edit: YEs. I admit that someone will feel it necessary to point out there are actually only finitely many solutions along the line segment. There will be on the order of
1/4*1/eps
ans = 1.1259e+15
solutions. So if your computer can generate a billion solutions per second (mighty fast that is), that would still take you
ans/1e9/60/60/24
ans = 13.0312
So roughly 13 days of computer time, with your CPU melting down from the heat generated. And do you have sufficient RAM to store them all? I seriously doubt it.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!