This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Class: GlobalSearch

Find global minimum


x = run(gs,problem)
[x,fval] = run(gs,problem)
[x,fval,exitflag] = run(gs,problem)
[x,fval,exitflag,output] = run(gs,problem)
[x,fval,exitflag,output,solutions] = run(gs,problem)


x = run(gs,problem) finds a point x that solves the optimization problem described in the problem structure.

[x,fval] = run(gs,problem) returns the value of the objective function in problem at the point x.

[x,fval,exitflag] = run(gs,problem) returns an exit flag describing the results of the multiple local searches.

[x,fval,exitflag,output] = run(gs,problem) returns an output structure describing the iterations of the run.

[x,fval,exitflag,output,solutions] = run(gs,problem) returns a vector of solutions containing the distinct local minima found during the run.

Input Arguments


A GlobalSearch object.


Problem structure. Create problem with createOptimProblem or by exporting a problem structure from the Optimization app. problem must contain at least the following fields:

  • solver

  • objective

  • x0

  • options — Both createOptimProblem and the Optimization app always include an options field in the problem structure.

Output Arguments


Minimizing point of the objective function.


Objective function value at the minimizer x.


Describes the results of the multiple local searches. Values are:

2At least one local minimum found. Some runs of the local solver converged.
1At least one local minimum found. All runs of the local solver converged.
0No local minimum found. Local solver called at least once, and at least one local solver exceeded the MaxIterations or MaxFunctionEvaluations tolerances.
-1One or more local solver runs stopped by the local solver output or plot function.
-2No feasible local minimum found.
-5MaxTime limit exceeded.
-8No solution found. All runs had local solver exit flag -2 or smaller, not all equal -2.
-10Failures encountered in user-provided functions.


A structure describing the iterations of the run. Fields in the structure:

funcCountNumber of function evaluations.
localSolverIncompleteNumber of local solver runs with 0 exit flag.
localSolverNoSolutionNumber of local solver runs with negative exit flag.
localSolverSuccessNumber of local solver runs with positive exit flag.
localSolverTotalTotal number of local solver runs.
messageExit message.


A vector of GlobalOptimSolution objects containing the distinct local solutions found during the run. The vector is sorted by objective function value; the first element is best (smallest value). The object contains:

XSolution point returned by the local solver.
FvalObjective function value at the solution.
ExitflagInteger describing the result of the local solver run.
OutputOutput structure returned by the local solver.
X0Cell array of start points that led to the solution.


Use a default GlobalSearch object to solve the six-hump camel back problem (see Run the Solver):

gs = GlobalSearch;
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],...
[xmin,fmin,flag,outpt,allmins] = run(gs,problem);


A detailed description of the algorithm appears in GlobalSearch Algorithm. Ugray et al. [1] describes both the algorithm and the scatter-search method of generating trial points.


[1] Ugray, Zsolt, Leon Lasdon, John Plummer, Fred Glover, James Kelly, and Rafael Martí. Scatter Search and Local NLP Solvers: A Multistart Framework for Global Optimization. INFORMS Journal on Computing, Vol. 19, No. 3, 2007, pp. 328–340.

Was this topic helpful?