Units Support in the Optimization Package - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Optimization : Optimization Package : General information : Optimization/General/Units

Units Support in the Optimization Package

 

Description

Examples

Description

• 

The Optimization package supports Units in expressions, operators, boundaries, and initial points. It does not support units in Matrix inputs.

• 

The following commands support units and accept the useunits option.

– 

Minimize

– 

Maximize

– 

LPSolve

– 

QPSolve

– 

NLPSolve

– 

LSSolve

• 

In all cases, a dimensional analysis of the optimization problem is done and a unit-free version of the problem is created and passed back to the original Optimization command. Units are then added back to the output when it is returned to the user.

• 

Output of these commands will be in the same form as calls made without units except for the Operator forms which will return the solution point as a list instead of a Vector.

• 

The units in the solution point variables are determined by (in order of precedence) the units specified in the useunits option, the units in the initialpoint option, the units in boundary ranges, or the default from the current unit system for the dimension of the variable determined by Units:-TestDimension.

• 

The unit used for the optimal value of the objective function will be the default for its dimension giving the current unit system.

• 

The useunits option forces dimensional analysis of the input even if no units are detected. This can be helpful if the input is a procedure that returns units but the variables are dimensionless, or no initial points or boundary ranges are given in the input.

• 

The useunits option can also be set to a list or set to indicate the units for each of the variables.  If the objective function is an operator, useunits may be a list of units.  If the objective function is an expression, useunits may be a list or set of :: values of the form variable::unit.

• 

Units are not completely supported for the solutionmodule output form in Optimization. A module will be generated, but it will not have units in its outputs.  A warning will be issued in that case informing the user of what units are being used inside the module.

• 

Details of the conversion to a unit-free problem can be seen by setting infolevel[HasUnits] to a value from 2 to 4.

Examples

withOptimization:

Minimizex4000yd2,x=10ft..2mi

230399.9999999yd2,x=10560.ft

(1)

The units of the objective function are usually in the default unit for that dimension in the current Units system. To get feet instead of meters change the system. This will not effect the units of variables which are given explicitly.

Units:-UseSystem'FPS'

Minimizex4000yd2,x=10ft..2mi

230399.9999999yd2,x=10560.ft

(2)

Units:-UseSystem'SI'

Minimize1,x30km2=0,z=Pi,initialpoint=x=10m,z=10

1.,x=29999.9165699122m,z=3.14159265358979

(3)

The automatically detected units for the variables can be overridden by the useunits option.

Minimizex4000yd2,x=10ft..2mi,useunits=x::m

230400.0000000yd2,x=3218.68800000000m

(4)

The units handler will issue errors when incompatible dimensions are found.

LSSolvex2m,x0.1min,x900ms

Error, (in Units:-Tools:-OptimizeExpression) units problem, incompatible dimensions in {abs(x-2*Units:-Unit(m))+abs(x-.1*Units:-Unit(min))+abs(x-900*Units:-Unit(ms))}

LSSolvex2s,x0.1min,x900ms

7.20333333333333137s,x=2.96666666666667s

(5)

Minimized,s→ds,d,s→d4yd2cm2,d,s→sⅇ,initialpoint=2mi,1

0.00616102262626188561mi,0.00226651356079383mi,2.71828182845905

(6)

See Also

Optimization

Units

Units/System