BookmarkSubscribeRSS Feed

Dear all,

 

I am using Proc Optmodel to solve a inventoory problem. I have the code pasted below.

I am getting notes like below. I have used similar structure earlier as well but I never got those notes.

 

706
NOTE 706-782: The name 'RR' hides an outer declaration.

NOTE 706-782: The name 'ITEMID' hides an outer declaration.

NOTE 706-782: The name 'STOREID' hides an outer declaration.

NOTE 706-782: The name 'RR' hides an outer declaration.

 

 

 /***Code******/

Proc optmodel FDIGITS=3 printlevel=3 ;
/*ods output SolutionSummary=objective_value;*/
/**** declare index sets *****/
/***creating the dimension variables to read the data dimensions *********/
set <num,num,num> SKU_STORE_RR_DIM;
set <num,num> BUDGET_DIM;
Read data OPT_RR_DATA_V1 into SKU_STORE_RR_DIM=[ ITEMID STOREID RR ];
/****** decalaring parameter for Total cost (backorder +Holding) and then reading***/
num Total_Cost{SKU_STORE_RR_DIM};
num InvCost{SKU_STORE_RR_DIM};
num Avg_Onhand{SKU_STORE_RR_DIM};
num Budget{BUDGET_DIM};

/****reading data for Total_Cost***********/
Read data OPT_RR_DATA_V1 into SKU_STORE_RR_DIM=[ITEMID STOREID RR] Total_Cost=totalcost_Store InvCost=InvCost Avg_Onhand;
Read data Budget_Table into BUDGET_DIM=[ITEMID STOREID ] Budget;

Var SKU_STORE_RR_BIN {SKU_STORE_RR_DIM} binary ;

/**Total Cost****/
max OPTIMUM_COST =sum {<ITEMID, STOREID, RR> in SKU_STORE_RR_DIM }
(Total_Cost[ITEMID,STOREID,RR]*SKU_STORE_RR_BIN[ITEMID, STOREID, RR]);

/*****Binding constraint to select only one RR is selected******/
con RR_BINARY_CONSTRAINT{<ITEMID,STOREID,RR> in SKU_STORE_RR_DIM}:
sum{<(ITEMID),(STOREID),RR> in SKU_STORE_RR_DIM}
SKU_STORE_RR_BIN[ITEMID,STOREID,RR]=1;

con BUDGET_CONSTRAINT{<ITEMID,STOREID,RR> in SKU_STORE_RR_DIM}:
sum{<ITEMID,STOREID,RR> in SKU_STORE_RR_DIM}
SKU_STORE_RR_BIN[ITEMID,STOREID,RR]*InvCost[ITEMID,STOREID,RR]*Avg_Onhand[ITEMID,STOREID,RR]
<=sum{<ITEMID,STOREID> in Budget_dim} Budget[ITEMID,STOREID];
solve;

Create data Solution_RR
from [ITEMID STOREID RR]
={<ITEMID,STOREID,RR> in SKU_STORE_RR_DIM :
SKU_STORE_RR_BIN[ITEMID,STOREID,RR].sol > 0}
SKU_STORE_RR_BIN = SKU_STORE_RR_BIN;

Quit;

 

thanks

LOkendra

1 REPLY 1
RobPratt
SAS Super FREQ

Those notes arise because the same dummy parameter appears as both a constraint index and a summation index within the constraint.  I don't know your optimization model, but I suspect you want the following instead:

 

con RR_BINARY_CONSTRAINT{<ITEMID,STOREID> in Budget_dim}:
sum{<(ITEMID),(STOREID),RR> in SKU_STORE_RR_DIM}
SKU_STORE_RR_BIN[ITEMID,STOREID,RR]=1;
con BUDGET_CONSTRAINT{<ITEMID,STOREID> in Budget_dim}:
sum{<(ITEMID),(STOREID),RR> in SKU_STORE_RR_DIM}
SKU_STORE_RR_BIN[ITEMID,STOREID,RR]*InvCost[ITEMID,STOREID,RR]*Avg_Onhand[ITEMID,STOREID,RR]
<= Budget[ITEMID,STOREID];

At least that will avoid the notes.  To see whether the new declarations correctly express your desired model, you can use the EXPAND statement.

 

For more explanation of this implicit slice, see Manpower Planning and other examples in the Mathematical Programming Examples documentation.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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