GlobalOptimSolution object contains information on a
local minimum, including location, objective function value, and start point or points
that lead to the minimum.
MultiStart generate a vector of
GlobalOptimSolution objects. The vector is ordered by objective function
value, from lowest (best) to highest (worst).
solutions that coincide with previously found solutions to within tolerances. For
GlobalSearch details, see Update
Solution Set in When fmincon Runs. For
MultiStart details, see Create GlobalOptimSolution Object.
When you execute
run and request
the solutions output,
GlobalOptimSolution objects as output.
Exitflag — Exit condition of local solver
Exit condition of the local solver, returned as an integer. Generally, a
Exitflag corresponds to a local optimum, and a
zero or negative
Exitflag corresponds to an unsuccessful
search for a local minimum.
For the exact meaning of each
Exitflag, see the
exitflag description in the appropriate local solver
function reference page:
Fval — Objective function value
Objective function value, returned as a real scalar. For the
Fval is the sum of squares of the
X — Local solution
Local solution, returned as an array with the same dimensions as
X0 — Start points that lead to current solution
Start points that lead to current solution, returned as a cell array.
Control the distance between points considered as distinct by setting the
properties of the global solver.
Obtain Multiple Local Solutions
MultiStart to create a vector of
GlobalOptimSolution objects for a problem with multiple local minima.
rng default % For reproducibility ms = MultiStart; sixmin = @(x)(4*x(1)^2 - 2.1*x(1)^4 + x(1)^6/3 ... + x(1)*x(2) - 4*x(2)^2 + 4*x(2)^4); problem = createOptimProblem('fmincon','x0',[-1,2],... 'objective',sixmin,'lb',[-3,-3],'ub',[3,3]); [xmin,fmin,flag,outpt,allmins] = run(ms,problem,30);
MultiStart completed the runs from all start points. All 30 local solver runs converged with a positive local solver exit flag.
allmins is a vector of
1x6 GlobalOptimSolution array with properties: X Fval Exitflag Output X0
Plot the objective function values at the returned solutions.
plot(arrayfun(@(x)x.Fval,allmins),'k*') xlabel('Solution number') ylabel('Function value') title('Solution Function Values')
To examine the initial points that lead to the various solutions, see Visualize the Basins of Attraction.
Introduced in R2010a