BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KafeelBasha
Quartz | Level 8

Hello

 

I am getting optimal feasible solution as 31250 with decision variable values 0, 7.5 and 20.

 

proc optmodel;
var x{1..3}>=0;
max z=900*x[1]+1500*x[2]+1000*x[3];
con c1: 50000*x[1]+12000*x[2]+8000*x[3]<=250000;
con c2: 1*x[1]+0*x[2]+0*x[3]<=4;
con c3: 0*x[1]+1*x[2]+0*x[3]<=15;
con c4: 0*x[1]+0*x[2]+1*x[3]<=20;
solve with milp/presolver=none;
print x[1] x[2] x[3];
quit;

 

x1,x3>=0 or integer

x2>=0.

But in excel it is given as 42,250 optimal feasible solution with decision variable values 4, 4.16,0. Please help if I am going wrong.

1 ACCEPTED SOLUTION

Accepted Solutions
RobPratt
SAS Super FREQ

You have not specified any integer variables.  Use the INTEGER option in the VAR statement and then the .RELAX suffix to relax x[2].  Also, you need not enter the zero coefficients explicitly.  In fact, you can avoid those last three constraints by instead using the .UB variable suffix:

 

proc optmodel;
   var x{1..3}>=0 integer;
   x[2].relax = 1;
   max z=900*x[1]+1500*x[2]+1000*x[3];
   con c1: 50000*x[1]+12000*x[2]+8000*x[3]<=250000;
   x[1].ub = 4;
   x[2].ub = 15;
   x[3].ub = 20;
   solve with milp/presolver=none;
   print x;
quit;

 

If you change the objective coefficient for x[1] from 900 to 9000, you do get an optimal objective value of 42,250.

View solution in original post

1 REPLY 1
RobPratt
SAS Super FREQ

You have not specified any integer variables.  Use the INTEGER option in the VAR statement and then the .RELAX suffix to relax x[2].  Also, you need not enter the zero coefficients explicitly.  In fact, you can avoid those last three constraints by instead using the .UB variable suffix:

 

proc optmodel;
   var x{1..3}>=0 integer;
   x[2].relax = 1;
   max z=900*x[1]+1500*x[2]+1000*x[3];
   con c1: 50000*x[1]+12000*x[2]+8000*x[3]<=250000;
   x[1].ub = 4;
   x[2].ub = 15;
   x[3].ub = 20;
   solve with milp/presolver=none;
   print x;
quit;

 

If you change the objective coefficient for x[1] from 900 to 9000, you do get an optimal objective value of 42,250.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 773 views
  • 2 likes
  • 2 in conversation