Maximize - Maple Help

Optimization

 Minimize
 minimize an objective function, possibly subject to constraints
 Maximize
 maximize an objective function, possibly subject to constraints

 Calling Sequence Minimize(obj, constr, bd, opts) Maximize(obj, constr, bd, opts) Minimize(opfobj, ineqcon, eqcon, opfbd, opts) Maximize(opfobj, ineqcon, eqcon, opfbd, opts)

Parameters

 obj - algebraic; objective function constr - (optional) set(relation) or list(relation); constraints bd - (optional) sequence of name = range; bounds for one or more variables opfobj - procedure; objective function ineqcon - (optional) set(procedure) or list(procedure) ; inequality constraints eqcon - (optional) set(procedure) or list(procedure); equality constraints opfbd - (optional) sequence of ranges; bounds for all variables opts - (optional) equation(s) of the form option = value where option is one of assume, feasibilitytolerance, infinitebound, initialpoint, iterationlimit, optimalitytolerance, output, or useunits; specify options for the Minimize or Maximize command

Description

 • The Minimize command computes a local minimum of an objective function, possibly subject to constraints.  If the problem is convex (for example, when the objective function and constraints are linear), the solution will also be a global minimum.  The Maximize command is similar to the Minimize command except that it computes a local maximum.  The algorithms that both commands use assume the objective function and constraints are twice continuously differentiable.
 Both commands accept the optimization problem in algebraic or operator form. See the Optimization/AlgebraicForm and Optimization/OperatorForm help pages.  These commands work by calling other commands in the Optimization package based on the form of the input. Setting infolevel[Optimization] to an integer value greater than 0 will give information about the solution process as the commands are called.
 • The first two calling sequences use the algebraic form of input.  The first parameter obj is the objective function, which must be an algebraic expression.
 The second parameter constr is optional and 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.
 Bounds, bd, on one or more of the variables are given as additional arguments, each of the form $\mathrm{varname}=\mathrm{varrange}$ where varname is a variable name and $\mathrm{varrange}$ is its range.
 • The last two 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 $\mathrm{x1}$, $\mathrm{x2}$, ..., $\mathrm{xn}$ and returns a float.
 Inequality and equality constraints are provided using the optional ineqcon and eqcon parameters. An inequality constraint, $v\left(\mathrm{x1},\mathrm{x2},\mathrm{...},\mathrm{xn}\right)\le 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 $w\left(\mathrm{x1},\mathrm{x2},\mathrm{...},\mathrm{xn}\right)=0$ is specified by a procedure w in eqcon.  Either ineqcon or eqcon can be empty.
 Bounds, opfbd, on the variables are optional, but if given must be a sequence of exactly n ranges corresponding in order to $\mathrm{x1}$, $\mathrm{x2}$, ..., $\mathrm{xn}$.
 • For either form of input, non-negativity of the variables is not assumed by default, but can be specified using the assume = nonnegative option.  Bounds can include values having type infinity.
 • Maple returns the solution as a list containing the final minimum (or maximum) value and a point (the extremum).  If the output = solutionmodule option is provided, then a module is returned.  See the Optimization/Solution help page for more information.
 • The Minimize and Maximize commands call one of the Optimization[LPSolve], Optimization[QPSolve] or Optimization[NLPSolve] commands, depending on the form of the input. Input provided in operator form always results in a call to Optimization[NLPSolve].  For more control over the solution process, or to use the more efficient Matrix form of input described in Optimization/MatrixForm, use LPSolve, QPSolve, or NLPSolve directly.  Minimize and Maximize do not accept problems in least-squares form. To solve such problems, use the Optimization[LSSolve] command.

Options

 The opts argument can contain one or more of the following options. The list below contains the options applicable to most or all of the Optimization package commands called by Minimize or Maximize.  Additional options accepted by specific commands can also be passed to Minimize and Maximize.  For a full list of options, see the Optimization/Options help page.  Each target command uses a variety of internal solvers. If an option is not used by a particular solver, a warning will be issued.
 • assume = nonnegative -- Assume that all variables are non-negative.
 • feasibilitytolerance = realcons(positive) -- Set the maximum absolute allowable constraint violation.
 • infinitebound = realcons(positive) -- Set any value greater than the infinitebound value to be equivalent to infinity during the computation.
 • initialpoint = set(equation), list(equation), or list(numeric) --  Use the provided initial point, which is a set or list of equations $\mathrm{varname}=\mathrm{value}$ (for algebraic form input) or a list of exactly $n$ values (for operator form input).
 • iterationlimit = posint -- Set the maximum number of iterations performed by the algorithm.
 • optimalitytolerance = realcons(positive) -- Set the tolerance that determines whether an optimal point has been found. This option is not available for linear or quadratic problems.
 • output = solutionmodule -- Return a module as described in the Optimization/Solution help page.
 • useunits = true or false or a list.  See Optimization/Units.
 • variables = list(name) or set(name) -- Specify the problem variables when the objective function is in algebraic form.

Notes

 • The Minimize and Maximize commands use various methods implemented in a built-in library provided by the Numerical Algorithms Group (NAG).   The solvers are iterative in nature and require an initial point. The quality of the solution can depend greatly on the point chosen, especially for nonlinear problems.  It is recommended that you provide a point using the initialpoint option. Otherwise, a point is automatically generated.
 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. For more information about numeric computation in the Optimization package, see the Optimization/Computation help page. However, in many cases the input may contain units which will be checked for consistency before being converted into a purely floating-point input.  See Optimization/Units for more details.
 Although the assume = nonnegative option is accepted, general assumptions are not supported by commands in the Optimization package.

Examples

 > $\mathrm{with}\left(\mathrm{Optimization}\right)$
 $\left[{\mathrm{ImportMPS}}{,}{\mathrm{Interactive}}{,}{\mathrm{LPSolve}}{,}{\mathrm{LSSolve}}{,}{\mathrm{Maximize}}{,}{\mathrm{Minimize}}{,}{\mathrm{NLPSolve}}{,}{\mathrm{QPSolve}}\right]$ (1)
 > $\mathrm{Minimize}\left(\mathrm{cos}\left(x\right),\mathrm{initialpoint}=\left\{x=1\right\}\right)$
 $\left[{-1.}{,}\left[{x}{=}{3.14159265358977}\right]\right]$ (2)
 > $\mathrm{Minimize}\left(\mathrm{cos}\left(x\right),\mathrm{initialpoint}=\left\{x=10\mathrm{Unit}\left(\mathrm{deg}\right)\right\}\right)$
 $\left[{-1.}{,}\left[{x}{=}{180.}{}⟦{\mathrm{arcdeg}}⟧\right]\right]$ (3)
 > $\mathrm{Minimize}\left(2x+y,\left\{4\le x+y,4x-y\le 9\right\},\mathrm{assume}=\mathrm{nonnegative}\right)$
 $\left[{4.}{,}\left[{x}{=}{0.}{,}{y}{=}{4.}\right]\right]$ (4)
 > $\mathrm{Minimize}\left({\left(x-1\right)}^{2}+{\left(x-y\right)}^{2},\left\{8\le x\left(1+{y}^{2}\right)\right\}\right)$
 $\left[{0.517128660129716033}{,}\left[{x}{=}{1.62561974988123}{,}{y}{=}{1.98020202339228}\right]\right]$ (5)
 > $\mathrm{Minimize}\left({\left(x-1\right)}^{2}+{\left(y-1\right)}^{2}+{\left(z-1\right)}^{2},\left\{8\le x\left(1+{y}^{2}+{z}^{2}\right)\right\}\right)$
 $\left[{0.693290283715208622}{,}\left[{x}{=}{1.53166579939482}{,}{y}{=}{1.45311243718810}{,}{z}{=}{1.45311243718810}\right]\right]$ (6)
 > $\mathrm{Maximize}\left(2{x}^{2}+y+2{y}^{2},\left\{2x+y\le 6,{y}^{2}-x\le 2\right\}\right)$
 $\left[{18.0000000000000071}{,}\left[{x}{=}{2.00000000000000}{,}{y}{=}{2.00000000000000}\right]\right]$ (7)
 > $\mathrm{Maximize}\left(2{x}^{2}+2{y}^{2},\left\{2x+y\le 0,{y}^{2}-{x}^{2}\le 0\right\}\right)$
 $\left[{1.56279239029344013}{×}{{10}}^{{27}}{,}\left[{x}{=}{-2.00799507061118}{×}{{10}}^{{13}}{,}{y}{=}{1.94471533851831}{×}{{10}}^{{13}}\right]\right]$ (8)
 > $\mathrm{Minimize}\left(2\mathrm{\pi }{R}^{2}+2\mathrm{\pi }RL+\mathrm{\pi }R\mathrm{sqrt}\left({H}^{2}+{R}^{2}\right),\left\{0\le H,0\le L,0\le R,\frac{2}{3}\mathrm{\pi }{R}^{3}+\mathrm{\pi }{R}^{2}L+\frac{1}{3}\mathrm{\pi }{R}^{2}H=3\mathrm{Unit}\left({'m'}^{3}\right)\right\}\right)$
 $\left[{10.2533536615869920}{}⟦{{m}}^{{2}}⟧{,}\left[{H}{=}{0.785093823049978}{}⟦{m}⟧{,}{L}{=}{0.392546902492684}{}⟦{m}⟧{,}{R}{=}{0.877761593519080}{}⟦{m}⟧\right]\right]$ (9)

Compatibility

 • The Optimization[Minimize] and Optimization[Maximize] commands were updated in Maple 2018.
 • The useunits option was introduced in Maple 2018.