BookmarkSubscribeRSS Feed
Santha
Pyrite | Level 9
thank you. i shall use the auto as you recommended.
zamolotov
Calcite | Level 5

Hi Santha,

I've saw your code and could highlight some moment:

var BoxesNeeded {LegitCombo_ISN} >= 0 integer;
var Proportion {LegitCombo_ISN} >= 0 <= 1;
impvar VolumeInsideBox {i in ISN, b in BOX,m in MOL,d in T1,w in T2} = Volume_ISN[i] * Proportion[i,b,m,d,w];
impvar WeightInsideBox {i in ISN, b in BOX,m in MOL,d in T1,w in T2} = Weight_ISN[i] * Proportion[i,b,m,d,w];

In this case, you'll get some errors because you create variables only for certain subset with expression Flag=1.

I would recommend you to fix some values for variable, like that:

var BoxesNeeded {i in ISN, b in BOX,m in MOL,d in T1,w in T2} >= 0 integer;
var Proportion {i in ISN, b in BOX,m in MOL,d in T1,w in T2} >= 0 <= 1;

for {i in ISN, b in BOX,m in MOL,d in T1,w in T2:  Flag[i,b,m,d,w]=1 } do;
        fix BoxesNeeded {i in ISN, b in BOX,m in MOL,d in T1,w in T2}=0;
        fix Proportion {i in ISN, b in BOX,m in MOL,d in T1,w in T2}=0;
end;
In this case you can set constraint correctly. Thats should be look like that:

con CYSSpecific {m in MOL, i in ISN,d in T1: m="CYS"}:
sum {b in BOX, w in T2} VolumeInsideBox[i,b,m,d,w]= Volume_ISN[i]*Is_ISN_MOL[i,m];

Santha
Pyrite | Level 9
Pls ignore this code. I have refined my code. I have not used Flag anymore as I realized there is no need of it. I have my latest code in the latest comment of mine.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Discussion stats
  • 17 replies
  • 14881 views
  • 2 likes
  • 4 in conversation