The OPTMODEL Procedure

Linearization

PROC OPTMODEL supports the transformation of certain nonlinear expressions in objectives and constraints into equivalent linear forms. This enables the processing of some MINLP formulations by using the MILP solver. Use the LINEARIZE option with the EXPAND, SAVE MPS, or SOLVE statement to request the linearization transformations.

Linearization examines each nonlinear objective, constraint, or IMPVAR expression, replacing nonlinear subexpressions with equivalent linear subexpressions. Fixed variables are treated as constants to enable more opportunities for linearization. The transformations might require the creation of additional variables and constraints. For example, the product of binary variables can be replaced by a new binary variable, with added constraints to relate the new variable value to the original variable values.

The added variables are elements of the predefined array _ADDED_VAR_, which has an integer index that starts from 1. Added constraints are elements of the predefined array _ADDED_CON_, which has an integer index that starts from 1. You can specify the name _ADDED_VAR_ or _ADDED_CON_ in the EXPAND statement with the LINEARIZE option to examine the added variables or constraints in the transformed problem.

When the problem is updated, added variables and constraints are re-created during problem generation. The optimal values for added variables from one SOLVE statement might not be meaningful in the next SOLVE statement, so the values that are assigned to the variables are ignored when PROC OPTMODEL determines initial values for the solver. The procedure attempts to determine initial values that are consistent with the values of the user-defined variables.

The LINEARIZE option is most often used with the MILP solver, although it can be used with other solvers. The MILP solver does not support dual values and reduced costs. PROC OPTMODEL does not attempt to recover the dual values and reduced costs of a problem that has been transformed by linearization, and it reports missing values.

The following types of subexpressions can be transformed:

  • binary-binary products

  • binary-bounded products

  • polynomials with binary and bounded variables

  • MIN/MAX/ABS function calls, <> expressions, and >< expressions

  • linear ratio constraint bodies

Problem generation fails if linearization is unable to transform a nonlinear subexpression or if the required linear coefficients are out of range or undefined.

Binary-Binary Products

The product of two or more binary variables can be replaced by a new binary variable in combination with added constraints. For example, the product of binary variables x Subscript i for indices i in a set S can be replaced by a new binary variable z, with the following constraints:

StartLayout 1st Row 1st Column z less-than-or-equal-to x Subscript i Baseline 2nd Column for all i element-of upper S 2nd Row 1st Column z greater-than-or-equal-to sigma-summation Underscript i element-of upper S Endscripts x Subscript i Baseline minus StartAbsoluteValue upper S EndAbsoluteValue plus 1 EndLayout

The first set of constraints ensures that z is 0 when any x Subscript i is 0. The last constraint ensures that z is 1 when all x Subscript i are 1. This covers all the possibilities, so z is constrained to equal the product.

The following code shows a simple example of the binary-binary product transformation:

proc optmodel;
   var x binary;
   var y binary;
   minimize obj = x*y + y*2*x;
   con c: x*y >= 1;
   expand / linearize;
   solve linearize;
   print x y;

The output is shown in Figure 66. PROC OPTMODEL recognizes that all the uses of x y are equivalent, and it reuses the same variable. The SOLVE statement invokes the MILP solver because the transformed problem uses binary variables. Note that the problem summary describes the problem before transformation.

Figure 66: Binary-Binary Products

Var x BINARY                                                                    
Var y BINARY                                                                    
Var _ADDED_VAR_[1] BINARY                                                       
Minimize obj=3*_ADDED_VAR_[1]                                                   
Constraint c: _ADDED_VAR_[1] >= 1                                               
Constraint _ADDED_CON_[1]: _ADDED_VAR_[1] - x <= 0                              
Constraint _ADDED_CON_[2]: _ADDED_VAR_[1] - y <= 0                              
Constraint _ADDED_CON_[3]: - _ADDED_VAR_[1] + x + y <= 1                        

Problem Summary
Objective SenseMinimization
Objective Functionobj
Objective TypeQuadratic
  
Number of Variables2
Bounded Above0
Bounded Below0
Bounded Below and Above2
Free0
Fixed0
Binary2
Integer0
  
Number of Constraints1
Linear LE (<=)0
Linear EQ (=)0
Linear GE (>=)0
Linear Range0
Nonlinear LE (<=)0
Nonlinear EQ (=)0
Nonlinear GE (>=)1
Nonlinear Range0
  
Constraint Coefficients0

Solution Summary
SolverMILP
AlgorithmBranch and Cut
Objective Functionobj
Solution StatusOptimal
Objective Value3
  
Relative Gap0
Absolute Gap0
Primal Infeasibility0
Bound Infeasibility0
Integer Infeasibility0
  
Best Bound3
Nodes0
Solutions Found2
Iterations0
Presolve Time0.00
Solution Time0.01

xy
11


Binary-Bounded Products

The product of a binary variable x and a bounded variable y can be replaced by a continuous variable, z, which is equal to 0 when x is 0 and equal to y when x is 1. You can also use a linearizable operand for y, such as an IMPVAR reference or a MIN/MAX/ABS function call, provided that the OPTMODEL presolver can determine the bounds for the operand. Let the lower bound for the value of y be L and the upper bound be U. Linearization adds the following constraints:

StartLayout 1st Row 1st Column z 2nd Column less-than-or-equal-to y minus upper L left-parenthesis 1 minus x right-parenthesis 2nd Row 1st Column z 2nd Column greater-than-or-equal-to y minus upper U left-parenthesis 1 minus x right-parenthesis 3rd Row 1st Column z 2nd Column less-than-or-equal-to upper U x 4th Row 1st Column z 2nd Column greater-than-or-equal-to upper L x EndLayout

When x is 0, the second pair of constraints ensure that z is 0, and the first pair hold trivially, based on the bounds of y. When x is 1, the first pair of constraints ensure that z equals y. The second pair of constraints hold trivially, based on the bounds of y.

The following code shows a simple example of the binary-bounded transformation:

proc optmodel;
   var x binary;
   var y >=1 <=2;
   minimize obj1 = x*y;
   expand / linearize;

The output is shown in Figure 67.

Figure 67: Binary-Bounded Products

Var x BINARY                                                                    
Var y >= 1 <= 2                                                                 
Var _ADDED_VAR_[1] >= 0 <= 2                                                    
Minimize obj1=_ADDED_VAR_[1]                                                    
Constraint _ADDED_CON_[1]: _ADDED_VAR_[1] - y - x <= -1                         
Constraint _ADDED_CON_[2]: _ADDED_VAR_[1] - y - 2*x >= -2                       
Constraint _ADDED_CON_[3]: _ADDED_VAR_[1] - 2*x <= 0                            
Constraint _ADDED_CON_[4]: _ADDED_VAR_[1] - x >= 0                              


Polynomials with Binary and Bounded Variables

More complex expressions, including linearizable subexpressions that are raised to constant nonnegative integer powers, are handled by expansion into a sum of product terms. Each expanded product term can include zero or more binary variables in combination with an optional bounded operand or a general variable. These terms are then linearized, if necessary, using the binary-binary and binary-bounded product transformations. An expanded term that contains multiple variables and includes either a general variable or multiple bounded nonbinary variables cannot be linearized.

When processing products, PROC OPTMODEL recognizes that an operand like upper C minus upper C x, where C is a constant and x is a binary variable, is a scaled version of the complement of x, upper C left-parenthesis 1 minus x right-parenthesis. The expansion into product terms uses the rule x left-parenthesis 1 minus x right-parenthesis equals 0 to remove unneeded product terms.

The value of 0 Superscript 0 is not defined, so a linear subexpression a left-parenthesis x right-parenthesis Superscript 0 is not linearized (as 1) unless PROC OPTMODEL can determine that the value of a left-parenthesis x right-parenthesis cannot be 0. A linear subexpression a left-parenthesis x right-parenthesis Superscript 1 is treated as a left-parenthesis x right-parenthesis.

The following code shows an example of the polynomial transformation:

proc optmodel;
   var x {1..4} binary;
   minimize obj = (x[1] + x[2]) * (x[3] + x[4]);
   con c: (x[1] + x[2] + x[3]) * x[4]**3 >= 1;
   expand / linearize;

The output is shown in Figure 68.

Figure 68: Polynomial Linearization

Var x[1] BINARY                                                                 
Var x[2] BINARY                                                                 
Var x[3] BINARY                                                                 
Var x[4] BINARY                                                                 
Var _ADDED_VAR_[1] BINARY                                                       
Var _ADDED_VAR_[2] BINARY                                                       
Var _ADDED_VAR_[3] BINARY                                                       
Var _ADDED_VAR_[4] BINARY                                                       
Var _ADDED_VAR_[5] BINARY                                                       
Minimize obj=_ADDED_VAR_[4] + _ADDED_VAR_[1] + _ADDED_VAR_[5] + _ADDED_VAR_[2]  
Constraint c: _ADDED_VAR_[1] + _ADDED_VAR_[2] + _ADDED_VAR_[3] >= 1             
Constraint _ADDED_CON_[1]: _ADDED_VAR_[1] - x[1] <= 0                           
Constraint _ADDED_CON_[2]: _ADDED_VAR_[1] - x[4] <= 0                           
Constraint _ADDED_CON_[3]: - _ADDED_VAR_[1] + x[1] + x[4] <= 1                  
Constraint _ADDED_CON_[4]: _ADDED_VAR_[2] - x[2] <= 0                           
Constraint _ADDED_CON_[5]: _ADDED_VAR_[2] - x[4] <= 0                           
Constraint _ADDED_CON_[6]: - _ADDED_VAR_[2] + x[2] + x[4] <= 1                  
Constraint _ADDED_CON_[7]: _ADDED_VAR_[3] - x[3] <= 0                           
Constraint _ADDED_CON_[8]: _ADDED_VAR_[3] - x[4] <= 0                           
Constraint _ADDED_CON_[9]: - _ADDED_VAR_[3] + x[3] + x[4] <= 1                  
Constraint _ADDED_CON_[10]: _ADDED_VAR_[4] - x[1] <= 0                          
Constraint _ADDED_CON_[11]: _ADDED_VAR_[4] - x[3] <= 0                          
Constraint _ADDED_CON_[12]: - _ADDED_VAR_[4] + x[1] + x[3] <= 1                 
Constraint _ADDED_CON_[13]: _ADDED_VAR_[5] - x[2] <= 0                          
Constraint _ADDED_CON_[14]: _ADDED_VAR_[5] - x[3] <= 0                          
Constraint _ADDED_CON_[15]: - _ADDED_VAR_[5] + x[2] + x[3] <= 1                 


MIN/MAX/ABS Function Calls, <> Expressions, and >< Expressions

Subexpressions that call the MIN, MAX, and ABS functions or use the <> (maximum) and >< (minimum) operators can be linearized. When the function or operator is a convex term in the containing objective or constraint, PROC OPTMODEL can linearize the value by using a simplified transformation, adding one constraint for each argument and a single variable for the result term. For nonconvex terms, the transformation requires additional binary variables and constraints.

The function or operator is a convex term if it is used with a constant linear coefficient of the correct sign in the containing objective or constraint. For the linearizable subexpressions a Subscript i Baseline left-parenthesis x right-parenthesis and b left-parenthesis y right-parenthesis, with positive constant coefficient c and constant bound B, the following examples of objectives and constraints can be linearized by using the transformation for convex terms:

StartLayout 1st Row 1st Column minimize 2nd Column c dot normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 2nd Row 1st Column maximize 2nd Column negative c dot normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Row 1st Column Blank 2nd Column c dot normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column less-than-or-equal-to upper B 4th Row 1st Column Blank 2nd Column negative c dot normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column greater-than-or-equal-to upper B 5th Row 1st Column minimize 2nd Column negative c dot normal upper M normal upper I normal upper N left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 6th Row 1st Column maximize 2nd Column c dot normal upper M normal upper I normal upper N left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 7th Row 1st Column Blank 2nd Column negative c dot normal upper M normal upper I normal upper N left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column less-than-or-equal-to upper B 8th Row 1st Column Blank 2nd Column c dot normal upper M normal upper I normal upper N left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma ellipsis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column greater-than-or-equal-to upper B 9th Row 1st Column minimize 2nd Column c dot normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 10th Row 1st Column maximize 2nd Column negative c dot normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 11th Row 1st Column Blank 2nd Column c dot normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column less-than-or-equal-to upper B 12th Row 1st Column Blank 2nd Column negative c dot normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column greater-than-or-equal-to upper B 13th Row 1st Column minimize 2nd Column c dot left-parenthesis a 1 left-parenthesis x right-parenthesis less-than greater-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 14th Row 1st Column maximize 2nd Column negative c dot left-parenthesis a 1 left-parenthesis x right-parenthesis less-than greater-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 15th Row 1st Column Blank 2nd Column c dot left-parenthesis a 1 left-parenthesis x right-parenthesis less-than greater-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column less-than-or-equal-to upper B 16th Row 1st Column Blank 2nd Column negative c dot left-parenthesis a 1 left-parenthesis x right-parenthesis less-than greater-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column greater-than-or-equal-to upper B 17th Row 1st Column minimize 2nd Column negative c dot left-parenthesis a 1 left-parenthesis x right-parenthesis greater-than less-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 18th Row 1st Column maximize 2nd Column c dot left-parenthesis a 1 left-parenthesis x right-parenthesis greater-than less-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 19th Row 1st Column Blank 2nd Column negative c dot left-parenthesis a 1 left-parenthesis x right-parenthesis greater-than less-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column less-than-or-equal-to upper B 20th Row 1st Column Blank 2nd Column c dot left-parenthesis a 1 left-parenthesis x right-parenthesis greater-than less-than a 2 left-parenthesis x right-parenthesis right-parenthesis plus b left-parenthesis y right-parenthesis 3rd Column greater-than-or-equal-to upper B EndLayout

As an example of the convex linearization transformation, consider the subexpression normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis right-parenthesis used with a positive coefficient in a minimization objective. The subexpression can be replaced by a new variable, z, with these added constraints:

StartLayout 1st Row 1st Column z 2nd Column greater-than-or-equal-to a 1 left-parenthesis x right-parenthesis 2nd Row 1st Column z 2nd Column greater-than-or-equal-to a 2 left-parenthesis x right-parenthesis EndLayout

Because the variable z is used with a positive coefficient in a minimization objective, the solver drives z toward negative normal infinity, subject to the added constraints. This results in an optimal value, with z equal to the largest of the MAX arguments. If the original subexpression were used with a positive coefficient in a constraint that had an upper bound, then the optimal solution value of z might not be equal to any of the arguments. But the transformed constraint is feasible if and only if the original constraint is feasible.

The following code shows some examples of the convex transformation:

proc optmodel;
   var x;
   var y;
   minimize obj = 2*max(-x+1, x-1) + y;
   expand / linearize;
   fix y = 7;
   minimize obj2 = y*abs(x+1) + 3*abs( x );
   con c: min(x, 2*x-1) >= 0;
   expand / linearize;

The output from the two EXPAND statements is shown in Figure 69.

Figure 69: Convex MIN/MAX/ABS Linearization

Var x                                                                           
Var y                                                                           
Var _ADDED_VAR_[1]                                                              
Minimize obj=y + 2*_ADDED_VAR_[1]                                               
Constraint _ADDED_CON_[1]: - x - _ADDED_VAR_[1] <= -1                           
Constraint _ADDED_CON_[2]: x - _ADDED_VAR_[1] <= 1                              

Var x                                                                           
Fix y = 7                                                                       
Var _ADDED_VAR_[1]                                                              
Var _ADDED_VAR_[2]                                                              
Var _ADDED_VAR_[3]                                                              
Minimize obj2=7*_ADDED_VAR_[2] + 3*_ADDED_VAR_[3]                               
Constraint c: _ADDED_VAR_[1] >= 0                                               
Constraint _ADDED_CON_[1]: x - _ADDED_VAR_[1] >= 0                              
Constraint _ADDED_CON_[2]: 2*x - _ADDED_VAR_[1] >= 1                            
Constraint _ADDED_CON_[3]: x - _ADDED_VAR_[2] <= -1                             
Constraint _ADDED_CON_[4]: x + _ADDED_VAR_[2] >= -1                             
Constraint _ADDED_CON_[5]: x - _ADDED_VAR_[3] <= 0                              
Constraint _ADDED_CON_[6]: x + _ADDED_VAR_[3] >= 0                              


When the function or operator is a nonconvex term, linearization requires additional variables and constraints. Consider the subexpression normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis comma a 3 left-parenthesis x right-parenthesis right-parenthesis. The nonconvex transformation requires a new binary variable, w Subscript i, for each argument. Linearization replaces the subexpression with a new variable, z, that has these added constraints:

StartLayout 1st Row 1st Column z 2nd Column greater-than-or-equal-to a 1 left-parenthesis x right-parenthesis 2nd Row 1st Column z 2nd Column greater-than-or-equal-to a 2 left-parenthesis x right-parenthesis 3rd Row 1st Column z 2nd Column greater-than-or-equal-to a 3 left-parenthesis x right-parenthesis 4th Row 1st Column w 1 equals 1 implies z 2nd Column less-than-or-equal-to a 1 left-parenthesis x right-parenthesis 5th Row 1st Column w 2 equals 1 implies z 2nd Column less-than-or-equal-to a 2 left-parenthesis x right-parenthesis 6th Row 1st Column w 3 equals 1 implies z 2nd Column less-than-or-equal-to a 3 left-parenthesis x right-parenthesis 7th Row 1st Column w 1 plus w 2 plus w 3 2nd Column equals 1 EndLayout

The first three constraints match the convex transformation. The next three indicator constraints require z to be at most (hence equal to) the a Subscript i Baseline left-parenthesis x right-parenthesis argument value when the corresponding w Subscript i variable is true. The final constraint ensures that one of the indicator constraints is active. The active constraint must correspond to an argument that has the maximum value because of the first three constraints.

When MIN or MAX has two arguments, the nonconvex transformation requires a single binary variable in order to select the active argument. For example, linearization replaces the function normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma a 2 left-parenthesis x right-parenthesis right-parenthesis with a new variable, z, that has these constraints:

StartLayout 1st Row 1st Column z 2nd Column greater-than-or-equal-to a 1 left-parenthesis x right-parenthesis 2nd Row 1st Column z 2nd Column greater-than-or-equal-to a 2 left-parenthesis x right-parenthesis 3rd Row 1st Column w 1 equals 0 implies z 2nd Column less-than-or-equal-to a 1 left-parenthesis x right-parenthesis 4th Row 1st Column w 1 equals 1 implies z 2nd Column less-than-or-equal-to a 2 left-parenthesis x right-parenthesis EndLayout

The new binary variable, w 1, selects an argument that has the maximum value.

The nonconvex transformation for normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis is similar, because normal upper A normal upper B normal upper S left-parenthesis a 1 left-parenthesis x right-parenthesis right-parenthesis equals normal upper M normal upper A normal upper X left-parenthesis a 1 left-parenthesis x right-parenthesis comma minus a 1 left-parenthesis x right-parenthesis right-parenthesis:

StartLayout 1st Row 1st Column z 2nd Column greater-than-or-equal-to a 1 left-parenthesis x right-parenthesis 2nd Row 1st Column z 2nd Column greater-than-or-equal-to minus a 1 left-parenthesis x right-parenthesis 3rd Row 1st Column w 1 equals 0 implies z 2nd Column less-than-or-equal-to a 1 left-parenthesis x right-parenthesis 4th Row 1st Column w 1 equals 1 implies z 2nd Column less-than-or-equal-to minus a 1 left-parenthesis x right-parenthesis EndLayout

The following code shows some examples of the nonconvex transformation:

proc optmodel;
   var x{1..4} >= 0 <= 100;
   con c1: max(x[1], x[2]) >= 50;
   con c2: min(x[1], x[2]) <= 10;
   maximize obj = abs(x[3]-x[4]);
   expand / linearize;

The output from the EXPAND statement is shown in Figure 70. Note that a big-M transformation was applied to the indicator constraints.

Figure 70: Nonconvex MIN/MAX/ABS Linearization

Var x[1] >= 0 <= 100                                                            
Var x[2] >= 0 <= 100                                                            
Var x[3] >= 0 <= 100                                                            
Var x[4] >= 0 <= 100                                                            
Var _ADDED_VAR_[1]                                                              
Var _ADDED_VAR_[2] BINARY                                                       
Var _ADDED_VAR_[3]                                                              
Var _ADDED_VAR_[4] BINARY                                                       
Var _ADDED_VAR_[5]                                                              
Var _ADDED_VAR_[6] BINARY                                                       
Maximize obj=_ADDED_VAR_[5]                                                     
Constraint c1: _ADDED_VAR_[1] >= 50                                             
Constraint c2: _ADDED_VAR_[3] <= 10                                             
Constraint _ADDED_CON_[1]: x[1] - _ADDED_VAR_[1] <= 0                           
Constraint _ADDED_CON_[2]: x[2] - _ADDED_VAR_[1] <= 0                           
Constraint _ADDED_CON_[3]: x[1] - _ADDED_VAR_[1] + 100*_ADDED_VAR_[2] >= 0      
Constraint _ADDED_CON_[4]: x[2] - _ADDED_VAR_[1] - 100*_ADDED_VAR_[2] >= -100   
Constraint _ADDED_CON_[5]: x[1] - _ADDED_VAR_[3] >= 0                           
Constraint _ADDED_CON_[6]: x[2] - _ADDED_VAR_[3] >= 0                           
Constraint _ADDED_CON_[7]: x[1] - _ADDED_VAR_[3] - 100*_ADDED_VAR_[4] <= 0      
Constraint _ADDED_CON_[8]: x[2] - _ADDED_VAR_[3] + 100*_ADDED_VAR_[4] <= 100    
Constraint _ADDED_CON_[9]: x[3] - x[4] - _ADDED_VAR_[5] <= 0                    
Constraint _ADDED_CON_[10]: x[3] - x[4] + _ADDED_VAR_[5] >= 0                   
Constraint _ADDED_CON_[11]: x[3] - x[4] - _ADDED_VAR_[5] + 200*_ADDED_VAR_[6] >=
0                                                                               
Constraint _ADDED_CON_[12]: x[3] - x[4] + _ADDED_VAR_[5] + 200*_ADDED_VAR_[6] <=
200                                                                             


Linear Ratio Constraints

A singly bounded constraint on the ratio of linear expressions can be transformed into a linear constraint by multiplying the bound by the denominator, provided that the denominator cannot equal 0. For example, the ratio constraint with linearizable expressions a left-parenthesis x right-parenthesis and b left-parenthesis y right-parenthesis and bound B,

StartFraction a left-parenthesis x right-parenthesis Over b left-parenthesis y right-parenthesis EndFraction less-than-or-equal-to upper B

can be linearized (assuming b left-parenthesis y right-parenthesis greater-than 0) as

a left-parenthesis x right-parenthesis less-than-or-equal-to upper B dot b left-parenthesis y right-parenthesis

If b left-parenthesis y right-parenthesis less-than 0, then the bound is multiplied by minus b left-parenthesis y right-parenthesis:

minus a left-parenthesis x right-parenthesis less-than-or-equal-to negative upper B dot b left-parenthesis y right-parenthesis

To handle a range constraint with bounds L and U,

upper L less-than-or-equal-to StartFraction a left-parenthesis x right-parenthesis Over b left-parenthesis y right-parenthesis EndFraction less-than-or-equal-to upper U

the original constraint is replaced by an equality constraint that introduces a new variable, z,

a left-parenthesis x right-parenthesis equals z

and the following added constraints (assuming b left-parenthesis y right-parenthesis greater-than 0):

StartLayout 1st Row  z greater-than-or-equal-to upper L dot b left-parenthesis y right-parenthesis 2nd Row  z less-than-or-equal-to upper U dot b left-parenthesis y right-parenthesis EndLayout

Note that the body value for ratio constraints is not preserved by the transformation.

The following code shows examples of the linearization of ratio constraints:

proc optmodel;
   var x {1..4} >=1;
   minimize obj = sum {i in 1..4} x[i];
   con c1: (x[1] + x[2] + 1) / (x[3] + x[4]) = 4;
   con c2: (x[1] + x[3]) / (x[2] + x[4]) <= 0.8;
   con c3: 4*(x[1] - x[2]) / (-x[3] - x[4]) >= -1;
   con c4: 2 <= (x[1] + x[2] + 1) / (x[3] + x[4] + 1) <= 3;
   expand / linearize;

The output is shown in Figure 71.

Figure 71: Ratio Constraint Linearization

Var x[1] >= 1                                                                   
Var x[2] >= 1                                                                   
Var x[3] >= 1                                                                   
Var x[4] >= 1                                                                   
Var _ADDED_VAR_[1]                                                              
Minimize obj=x[1] + x[2] + x[3] + x[4]                                          
Constraint c1: x[1] + x[2] - 4*x[3] - 4*x[4] = -1                               
Constraint c2: x[1] + x[3] - 0.8*x[2] - 0.8*x[4] <= 0                           
Constraint c3: - 4*x[1] + 4*x[2] + x[3] + x[4] >= 0                             
Constraint c4: x[1] + x[2] - _ADDED_VAR_[1] = -1                                
Constraint _ADDED_CON_[1]: _ADDED_VAR_[1] - 2*x[3] - 2*x[4] >= 2                
Constraint _ADDED_CON_[2]: _ADDED_VAR_[1] - 3*x[3] - 3*x[4] <= 3                


Last updated: September 09, 2026