Operator Form of Input for Optimization Package Commands
This help page describes the operator form of input for commands in the Optimization package. For general information on all the input forms accepted by the Optimization package commands, see the Optimization/InputForms help page.
The descriptions of the various components below assume that the optimization problem involves minimizing or maximizing a function of variables , , ..., .
Objective Function
Constraints
Bounds
Initial Values
Solution
Examples
Specify the objective function as a procedure that accepts n floating-point parameters corresponding to the problem variables and returns a float.
The Optimization[LSSolve] command accepts an objective function of the form . In this situation, the objective function is specified as a list of procedures, each taking floating-point parameters representing the problem variables and returning a float. These procedures compute the least-squares residuals , , ..., .
Specify the inequality constraints as a set or list of procedures. A single constraint is specified as a procedure v of the same form as the objective function previously described and returning the left-hand side value of the constraint.
Specify the equality constraints also as a set or list of procedures. Each constraint is specified as a procedure returning the left-hand side value of the constraint.
Specify bounds as a sequence of ranges. For example, the sequence indicates that the first problem variable is constrained to be between and , and the second is constrained to be between and . If bounds are provided, the number of ranges must be equal to the number of problem variables.
Bounds can be included with the general constraints. For example, adding the inequalities and to the constraint set is equivalent to specifying . Bounds are not required to be specified separately, though this usually leads to more efficient computation.
The problem variables are not assumed to be non-negative by default, but the option can be used to specify this. For more information, see the Optimization/Options help page.
Specify the initial values using the option initialpoint=p, where p is a list of realcons. The list must contain one value for each problem variable. For more information on the initialpoint option, see the Optimization/Options help page.
Maple returns the solution as a list containing the final minimum (or maximum) value and a point (the computed extremum). The point is a Vector containing the values of the problem variables unless the problem involves units in which case the point will be a list (see Optimization/General/Units).
Use simple procedures as input to the NLPSolve command.
p := proc(x) if x <= 0 then x^2+1; else sin(x)/x; end if; end proc;
Use operator form to solve a least-squares problem.
b1 := proc(x) x-1 end proc:
b2 := proc(x) x-7 end proc:
c1 := proc(x) -2*x-3 end proc:
c2 := proc(x) x-5 end proc:
Use operator form as input to the Maximize command.
See Also
Optimization
Optimization/InputForms
Optimization/Options
Optimization[LSSolve]
Download Help Document