The OPTMODEL Procedure

MAX and MIN Objective Declarations

MAX name = expression;
MIN name = expression;

The MAX or MIN declaration specifies an objective for the solver. The name names the objective function for later reference. The solver maximizes an objective specified with the MAX keyword and minimizes an objective specified with the MIN keyword. An objective is not allowed to have the same name as a parameter or variable. Multiple objectives are permitted, but the solver processes only one objective at a time.

Expression specifies the numeric function to maximize or minimize in terms of the optimization variables.

When used in an expression, an objective name refers to the current value of the named objective function. The value of unsuffixed objective names can depend on the value of optimization variables, so objective names cannot be used in constant expressions such as variable bounds. You can reference objective names in objective or constraint expressions. For example, the following code declares two objective names, q and l, which are immediately referred to in the objective declaration of z and the declarations of the constraints.

  
    proc optmodel; 
       var x, y; 
       min q=(x+y)**2; 
       max l=x+2*y; 
       min z=q+l; 
       con c1: q<=4; 
       con c2: l>=2;
 

Objectives cannot be defined using functions that return different values each time they are called. See the section "Indexing" for details.

Previous Page | Next Page | Top of Page