The OPTMODEL Procedure

A Transportation Problem

You can easily translate the symbolic formulation of a problem into the OPTMODEL procedure. Consider the transportation problem, which is mathematically modeled as the following linear programming problem:

StartLayout 1st Row 1st Column minimize 2nd Column sigma-summation Underscript i element-of upper O comma j element-of upper D Endscripts c Subscript i j Baseline x Subscript i j 3rd Column Blank 4th Column Blank 5th Column Blank 6th Column Blank 2nd Row 1st Column subject to 2nd Column sigma-summation Underscript j element-of upper D Endscripts x Subscript i j 3rd Column equals 4th Column a Subscript i Baseline comma 5th Column for-all i element-of upper O 6th Column left-parenthesis normal upper S normal upper U normal upper P normal upper P normal upper L normal upper Y right-parenthesis 3rd Row 1st Column Blank 2nd Column sigma-summation Underscript i element-of upper O Endscripts x Subscript i j 3rd Column equals 4th Column b Subscript j Baseline comma 5th Column for-all j element-of upper D 6th Column left-parenthesis normal upper D normal upper E normal upper M normal upper A normal upper N normal upper D right-parenthesis 4th Row 1st Column Blank 2nd Column x Subscript i j 3rd Column greater-than-or-equal-to 4th Column 0 comma 5th Column for-all left-parenthesis i comma j right-parenthesis element-of upper O times upper D 6th Column Blank EndLayout

where O is the set of origins, D is the set of destinations, c Subscript i j is the cost to transport one unit from i to j, a Subscript i is the supply of origin i, b Subscript j is the demand of destination j, and x Subscript i j is the decision variable for the amount of shipment from i to j.

Here is a very simple example. The cities in the set O of origins are Detroit and Pittsburgh. The cities in the set D of destinations are Boston and New York. The cost matrix, supply, and demand are shown in Table 2.

Table 2: A Transportation Problem

Boston New York Supply
Detroit 30 20 200
Pittsburgh 40 10 100
Demand 150 150


The problem is compactly and clearly formulated and solved by using the OPTMODEL procedure with the following statements:

proc optmodel;
   /* specify parameters */
   set O={'Detroit','Pittsburgh'};
   set D={'Boston','New York'};
   number c{O,D}=[30 20
                  40 10];
   number a{O}=[200 100];
   number b{D}=[150 150];
   /* model description */
   var x{O,D} >= 0;
   min total_cost = sum{i in O, j in D}c[i,j]*x[i,j];
   constraint supply{i in O}: sum{j in D}x[i,j]=a[i];
   constraint demand{j in D}: sum{i in O}x[i,j]=b[j];
   /* solve and output */
   solve;
   print x;

The output is shown in Figure 4.

Figure 4: Solution to the Transportation Problem

The OPTMODEL Procedure

Problem Summary
Objective SenseMinimization
Objective Functiontotal_cost
Objective TypeLinear
  
Number of Variables4
Bounded Above0
Bounded Below4
Bounded Below and Above0
Free0
Fixed0
  
Number of Constraints4
Linear LE (<=)0
Linear EQ (=)4
Linear GE (>=)0
Linear Range0
  
Constraint Coefficients8

Solution Summary
SolverLP
AlgorithmSimplex
Objective Functiontotal_cost
Solution StatusOptimal
Objective Value6500
  
Primal Infeasibility0
Dual Infeasibility0
Bound Infeasibility0
  
Iterations0
Presolve Time0.00
Solution Time0.00

x
 BostonNew York
Detroit15050
Pittsburgh0100


Last updated: June 22, 2026