BookmarkSubscribeRSS Feed
FrankHonduras16
Calcite | Level 5

hello, I've been trying to resolve the next linear programming problem...but, what I only got is an error:

 

OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

proc optmodel;
ERROR: Procedure OPTMODEL not found.
 
var x1 integer =>0;
var x2 integer =>0;
 
maximize z=3*x1+5*x2;
 
con c1: 3*x1-2*x2<=10;
con c2: 5*x1+10*x2<=56;
 
solve;
 
print x1 x2;
 
quit;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDIMIENTO OPTMODEL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 
 
can you please help me..I dont know where I'm wrong. Thanks
 
franklin
3 REPLIES 3
Reeza
Super User

Are you using SAS UE? If so, I don't think proc optmodel is included. 

It falls under SAS/OR which is not part of SAS UE. 

FrankHonduras16
Calcite | Level 5

Yes I do 

Rick_SAS
SAS Super FREQ

If you are using SAS University Edition, then you have access to SAS/IML, which supports linear programming (LP) and mixed-integer LP. . Use the MILPSOLVE subroutine, as follows

 

/* Problem: x is a vector of integers 0 <= x[i] <= 10 
maximize c*x = 3*x1 + 5*x2
subject to 
A*x SYMBOL b 
where SYMBOL is a vector of symbols that indicate <=, =, or >=
*/
proc optmodel;
var x{i in 1..2} integer >= 0;
max z = 3*x[1] +  5*x[2];
con c1: 3*x[1] + -2*x[2] <= 10;
con c2: 5*x[1] + 10*x[2] <= 56;
solve with milp;
print x;
quit;

proc iml;
/* information about variables (row of column, doesn't matter) */
colType = {I, I};  /* variables are integers */
LowerB =  {0, 0};  /* lower bound contraints on x */
UpperB = {10,10};  /* upper bound contraints on x */

/* objective function */
c = {3 5};        /* vector for objective function c*x */

/* linear constraints */
A = {3 -2,        /* matrix of contraint coefficients */
     5 10};
b = {10,          /* RHS of constraint eqns (column vector) */
     56};         

/* specify symbols for constraints:
   'L' for less than or equal
   'E' for equal
   'G' for greater than or equal */
LEG = {L, L}; 

/* control vector for optimization */
ctrl = {-1,       /* maximize objective */
         1};      /* print level */

CALL MILPSOLVE(rc, objVal, result, relgap, /* output variables */
               c, A, b,      /* objective and linear constraints */
               ctrl,         /* control vector */
               coltype, LEG, /*range*/, LowerB, UpperB); 
print rc objVal relgap, result[rowname={x1 x2}];

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 992 views
  • 0 likes
  • 3 in conversation