BookmarkSubscribeRSS Feed
pmoovala0
Calcite | Level 5

I need to explicitely define binary variable openstatus for WH1  as 1 (in the below code)

 

how to define that 

 

Proc optmodel;
set WH= {"WH1","WH2","WH3","WH4","WH5"};
set WS= {"WS1","WS2","WS3"};
Number FixedCost {WH}=[
10000  20000  15000  17000  13000];
Number TransCost {WH}=[
9  7  8  7.5  8.5];
Number Distance{WH,WS}=[
85  120  90
45  150  85
75  120  95
60  80   90
110 65   95];
var openstatus{WH1}=1;
var openstatus{WH} binary;
minimize operatingCost=
 sum{w in WH}(FixedCost[W]+40*TransCost[w]*sum{s in WS}distance[w,s])*openstatus[w];
constraint sum{w in WH}openstatus[w]=2;
solve;
print OperatingCost openstatus;

 

2 REPLIES 2
RobPratt
SAS Super FREQ
Use one VAR statement to declare the whole set of variables, and then use the FIX statement to fix one variable's value.

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
  • 2 replies
  • 1158 views
  • 0 likes
  • 2 in conversation