Program 1.3


/****************************************************************************
* This program is taken from the following book. If using please cite it as:                            *
* Emrouznejad, A. and W. Ho (2012). Applied Operations Research with SAS, *
* CRC Press: Taylor Francis Ltd, ISBN: 9781439841303.*
* For details please visit: http://www.sas-or.com.                          *
****************************************************************************/

*Program 1.3: An example of PROC OPTMODEL;
proc optmodel;

* Declare parametrs a, b and c;
number c{1..4}=[4, 2, 1, 3] ;
number b{1..3}=[4, 3, 8];
number a{1..3, 1..4}= [2, 1, 0, 4,
4, -1, 4, 0,
3, 2, 1, 2];


* Declare variable x;
var x{1..4} >=0;

* Define objective function;
max z = sum{i in 1..4}(c[i]*x[i]);

* Define constraints;
con constraint{i in 1..3}:


sum{j in 1..4} a[i,j]*x[j] <= b[i];

* Print the linear programming;
expand;

* Solve the model;
solve;


* Print optimum solution for x;
print x.sol;
%put &_OROPTMODEL_;
quit;


/****************************************************************************
******************************END of the program*****************************
****************************************************************************/

Permanent link to this article: http://sas-or.com/book/program-1-3