The OPTMILP Procedure |
This example illustrates a model in an MPS-format SAS data set. This data set is passed to PROC OPTMILP and a solution is found.
Consider a scenario where you have a container with a set of limiting attributes (volume and weight ) and a set of items that you want to pack. Each item type has a certain value , a volume , and a weight . You must choose at most four items of each type so that the total value is maximized and all the chosen items fit into the container. Let be the number of items of type to be included in the container. This model can be formulated as the following integer linear program:
Constraint (volume_con) enforces the volume capacity limit, while constraint (weight_con) enforces the weight capacity limit. An instance of this problem can be saved in an MPS-format SAS data set by using the following code:
data ex1data; input field1 $ field2 $ field3 $ field4 field5 $ field6; datalines; NAME ex1data . . ROWS . . MAX z . . L volume_con . . L weight_con . . COLUMNS . . .MRK0 'MARKER' . 'INTORG' . x[1] z 1 volume_con 10 x[1] weight_con 12 . x[2] z 2 volume_con 300 x[2] weight_con 15 . x[3] z 3 volume_con 250 x[3] weight_con 72 . x[4] z 4 volume_con 610 x[4] weight_con 100 . x[5] z 5 volume_con 500 x[5] weight_con 223 . x[6] z 6 volume_con 120 x[6] weight_con 16 . x[7] z 7 volume_con 45 x[7] weight_con 73 . x[8] z 8 volume_con 100 x[8] weight_con 12 . x[9] z 9 volume_con 200 x[9] weight_con 200 . x[10] z 10 volume_con 61 x[10] weight_con 110 . .MRK1 'MARKER' . 'INTEND' . RHS . . .RHS. volume_con 1000 . .RHS. weight_con 500 . BOUNDS . . UP .BOUNDS. x[1] 4 . UP .BOUNDS. x[2] 4 . UP .BOUNDS. x[3] 4 . UP .BOUNDS. x[4] 4 . UP .BOUNDS. x[5] 4 . UP .BOUNDS. x[6] 4 . UP .BOUNDS. x[7] 4 . UP .BOUNDS. x[8] 4 . UP .BOUNDS. x[9] 4 . UP .BOUNDS. x[10] 4 . ENDATA . . ;
In the COLUMNS section of this data set, the name of the objective is z, and the objective coefficients appear in field4. The coefficients of (volume_con) appear in field6. The coefficients of (weight_con) appear in field4. In the RHS section, the bounds and appear in field4.
This problem can be solved by using the following statement to call the OPTMILP procedure:
proc optmilp data=ex1data primalout=ex1soln; run;
The progress of the solver is shown in Output 16.1.1.
Output 16.1.1: Simple Integer Linear Program PROC OPTMILP LogThe data set ex1soln is shown in Output 16.1.2.
Output 16.1.2: Simple Integer Linear Program Solution
|
The optimal solution is , and , with a total value of 87. From this solution, you can compute the total volume used, which is 988 (); the total weight used is 499 (). The problem summary and solution summary are shown in Output 16.1.3.
Output 16.1.3: Simple Integer Linear Program Summary
|
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.