GlobalSolve - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim





find a global solution to a nonlinear program


Calling Sequence






Calling Sequence

GlobalSolve(obj, constr, bd, opts)

GlobalSolve(obj, bd, opts)

GlobalSolve(opfobj, ineqcon, eqcon, opfbd, opts)

GlobalSolve(opfobj, opfbd, opts)




algebraic; objective function



set(relation) or list(relation); constraints



sequence of name = range; bounds for all variables



procedure; objective function



set(procedure) or list(procedure); inequality constraints



set(procedure) or list(procedure); equality constraints



sequence of ranges; bounds for all variables



(optional) equation(s) of the form option = value where option is one of avgstopstepwidth, evaluationlimit, feasibilitytolerance, initialpoint, iterationlimit, localrefinement, maximize, method, numexperiments, numsigma, nugget, objectivetarget, optimalitytolerance, optsearch, populationsize, randomseed, thetamethod, theta, targetweight, timelimit, or variables; specify options for the GlobalSolve command



The GlobalSolve command computes a global solution to a nonlinear program (NLP) over a bounded region. An NLP involves the minimization (or maximization) of an objective function, possibly subject to inequality and equality constraints. For a more detailed explanation of the solution obtained, see the following Notes section.


The global solver minimizes a merit function, incorporating a penalty term for the constraints, and provides both differential evolution and adaptive stochastic search methods. The global search phase is followed by a local search phase to refine the solution. No derivatives are required.


The solver is designed to search the specified region for a global solution to a non-convex optimization problem.  If the optimization problem is convex (for example, a linear program) or a local solution is acceptable, it is recommended that you use the commands for local optimization in the Optimization package. The Optimization package commands, which are more efficient, can compute global solutions to convex problems.


This help page describes the use of the GlobalSolve command when the NLP is specified in algebraic or operator form. Summaries of these forms are given on the GlobalOptimization/AlgebraicForm and GlobalOptimization/OperatorForm help pages. GlobalSolve also recognizes the problem in Matrix form (see the GlobalOptimization[GlobalSolve] (MatrixForm) help page). Matrix form leads to more efficient computation, but is more complex.


The first and second calling sequences use the algebraic form of input. The first parameter obj is the objective function, which must be an algebraic expression.


Constraints can be provided using the constr parameter. This is a set or list of relations (of type `<=` or `=`) involving the problem variables. The problem variables are the indeterminates of type name found in obj and constr. They can also be specified using the variables option.  For unconstrained problems, omit the constr parameter.


Bounds on the variables must be given as additional arguments, each of the form varname= varrange where varname is a variable name and varrange is its range. There must be exactly one argument for each problem variable, and the endpoints of each range must evaluate to finite numeric values.


The third and fourth calling sequences use the operator form of input. The objective function opfobj must be a procedure that accepts n floating-point parameters representing the problem variables x1, x2, ..., xn and returns a float.


Inequality and equality constraints are provided using the ineqcon and eqcon parameters. An inequality constraint vx1,x2,,xn0 is specified by a procedure v in ineqcon that has the same form as opfobj and returns the left-hand-side value of the constraint. Similarly, an equality constraint wx1,x2,,xn=0 is specified by a procedure w in eqcon. Either ineqcon or eqcon can be an empty list or set. For unconstrained problems, omit both of these parameters.


Bounds on the variables must be provided. These must be a sequence of exactly n ranges corresponding in order to x1, x2, ..., xn. The endpoints of each range must evaluate to finite numeric values.


Maple returns the solution as a list containing the final minimum (or maximum) value and a point (the extremum). If the input is in algebraic form, the point is a list containing elements of the form varname=value where varname is a problem variable and value is its final value. If the input is in operator form, the point is a Vector containing the values of the problem variables.



The opts argument can contain one or more of the following options not specific to a particular solving method. The options specific to a particular solving method are described in more detail in the GlobalOptimization/Options help page.


evaluationlimit = posint -- Set the maximum number of iterations performed by the Differential Evolution method. The global search phase terminates if this limit is reached.


feasibilitytolerance = positive and numeric -- Set the allowed violation of constraints.


initialpoint = set(equation), list(equation), or list(numeric) --  Use the provided initial point, which is a set or list of equations varname=value (for algebraic form input) or a list of exactly n values (for operator form input). This is supported by the Differential Evolution method.


localrefinement = truefalse -- Perform a local optimization refinement of the solution starting from the optimal point computed by the global solver. The default is 'localrefinement'='true'.


maximize or maximize = truefalse -- Maximize the objective function when m is 'true' and minimize when m is 'false'.  The option 'maximize' is equivalent to 'maximize'='true'. The default is 'maximize'='false'.


method = diffevol, ego -- Set the global search algorithm: Differential Evolution (method = diffevol), or Efficient Global Optimization (method = ego).  The default is method = diffevol.


objectivetarget = numeric -- Set an acceptable target value for the objective function. If the objective function achieves this value, the search terminates.


timelimit = posint -- Set the maximum computation time, in seconds, for the global solver.


variables = list(name) or set(name) -- Specify the problem variables when the objective function is in algebraic form.



For more information on the methods used by the global solver, with suggestions for achieving best performance, see the GlobalOptimization/Computation help page.


The global solver searches for the optimal solution until one of the termination criteria is met.  Then either the best available solution is returned or an error message is displayed stating that a solution could not be obtained.  The termination criteria can be set using options. Otherwise, default values for these options are applied.  In particular, the evaluationlimit option must be set to a sufficiently high value for difficult optimization problems or unexpected answers may be produced.


In the case that the computation is interrupted the last solution computed may be retrieved using the GetLastSolution command.


The computation is performed in floating-point. Therefore, all data provided must have type realcons and all returned solutions are floating-point, even if the problem is specified with exact values. The solver uses externally called code that works with hardware floats, but it is possible to evaluate the objective function and the constraints in Maple with higher precision. For details, see the GlobalOptimization/Computation help page.



Find the global solution to an unconstrained nonlinear minimization problem.




Find the global solution to a constrained two-variable minimization problem.




Find the global solution to a constrained least-squares minimization problem.




Find the global minimum using the operator input form.




Initial points can be provided to find the minimum.




Use the maximize option to maximize the objective function.




GlobalSolve solves real-valued optimization problems. Trying to solve a complex problem can produce an error message.



Error, (in GlobalOptimization:-GlobalSolve) non-numeric result encountered

However, you can apply the Re command to use the real portion of the complex-valued expressions in a complex optimization problem to define a different problem.





Using Re can create distinct problems with distinct solutions. Notice the difference between the previous example and the following.




Set infolevel to 1 or higher to display details about the solution procedure.



GlobalSolve:   calling NLP solver
GlobalSolve:   calling global optimization solver
GlobalSolve:   number of problem variables   1
GlobalSolve:   number of nonlinear inequality constraints   0
GlobalSolve:   number of nonlinear equality constraints   0
GlobalSolve:   method    OptimusDEVOL
GlobalSolve:   maximum iterations   80
GlobalSolve:   population size   50
GlobalSolve:   average stopping stepwidth   .1e-3
GlobalSolve:   time limit    100
GlobalSolve:   trying evalhf mode
GlobalSolve:   performing local refinement



See Also







GlobalOptimization[GlobalSolve] (MatrixForm)