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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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