GlobalOptimization
GlobalSolve
find a global solution to a nonlinear program
Calling Sequence
Parameters
Description
Options
Notes
Examples
GlobalSolve(obj, constr, bd, opts)
GlobalSolve(obj, bd, opts)
GlobalSolve(opfobj, ineqcon, eqcon, opfbd, opts)
GlobalSolve(opfobj, opfbd, opts)
obj
-
algebraic; objective function
constr
set(relation) or list(relation); constraints
bd
sequence of name = range; bounds for all variables
opfobj
procedure; objective function
ineqcon
set(procedure) or list(procedure); inequality constraints
eqcon
set(procedure) or list(procedure); equality constraints
opfbd
sequence of ranges; bounds for all variables
opts
(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,⁢…,xn≤0 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.
with⁡GlobalOptimization:
Find the global solution to an unconstrained nonlinear minimization problem.
GlobalSolve⁡exp⁡−x−cos⁡x3,x=1..4
0.176954236956028,x=1.81002937332731
Find the global solution to a constrained two-variable minimization problem.
GlobalSolve⁡x3−y3−x+y,x2+2⁢y≤6,x=0..5,y=0..5
−24.0191790909674054,x=0.0383116419453124,y=2.99926610904573
Find the global solution to a constrained least-squares minimization problem.
GlobalSolve⁡x−12+y−12+z−12,y2−12⁢x−7⁢z=100,x=−10..10,y=−10..10,z=−10..10
60.6658882380449995,x=−4.02830735637190,y=6.17479203580774,z=−1.93317929115185
Find the global minimum using the operator input form.
GlobalSolve⁡x↦Γ⁡x,1.1..1.9
0.885603194410889,1.46163215294504
Initial points can be provided to find the minimum.
GlobalSolve⁡cos⁡xx,x=11..21,initialpoint=x=12
−0.0637915530395936,x=15.6441283804492
Use the maximize option to maximize the objective function.
GlobalSolve⁡add⁡x‖i2,i=1..8,add⁡x‖i2,i=1..8≤1,seq⁡x‖i=−1..1,i=1..8,maximize
1.00000000000000067,x1=−0.138687931023509,x2=−0.0413711220237186,x3=−0.0154159434505829,x4=−0.232829087709284,x5=−0.333994844827890,x6=0.00865198080109979,x7=−0.854946138236215,x8=−0.286438021614627
GlobalSolve solves real-valued optimization problems. Trying to solve a complex problem can produce an error message.
Digits≔20:
GlobalSolve⁡sin⁡x⁢log⁡x−y,x=1..2,y=5..6
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.
Digits≔10:
GlobalSolve⁡sin⁡x⁢ℜ⁡log⁡x−y,x=1..2,y=5..6
0.360686590689181019,x=2.,y=6.
Using Re can create distinct problems with distinct solutions. Notice the difference between the previous example and the following.
GlobalSolve⁡ℜ⁡sin⁡x⁢log⁡x−y,x=1..2,y=5..6
11.3952154460165396,x=1.00000002213202,y=5.00000558219173
Set infolevel to 1 or higher to display details about the solution procedure.
infolevelGlobalOptimization≔3:
GlobalSolve⁡exp⁡x−x3,x=−1..0
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
0.728617821489263,x=−0.458962267755628
See Also
GlobalOptimization/AlgebraicForm
GlobalOptimization/Computation
GlobalOptimization/OperatorForm
GlobalOptimization/Options
GlobalOptimization[GetLastSolution]
GlobalOptimization[GlobalSolve] (MatrixForm)
Optimization
realcons
Download Help Document