I have defined variables Itvs[units][activities][results] as intervals and resAlloc as an integer. The value of resAlloc influences the size of each interval in Itvs. However, when attempting to calculate the total resources allocated to each day using cumulFunction-pulse, I encounter a limitation because resAlloc is declared as a decision variable (dvar), which cannot be directly processed in this context.
int reqRes [u in units][i in activities][r in resources] = sum (t in unitTypes) unitConfig [u][t] * resInAct [t][i][r];
dvar interval resItvs [units][activities][resources] optional;
dvar int+ allocRes [units][activities][resources];
dexpr int resDuration [u in units][i in activities][r in resources] = (reqRes[u][i][r] != 0) ? reqRes[u][i][r] div allocRes[u][i][r]: 0;
cumulFunction resUsage [r in resources] =
sum(u in units, i in activities) pulse(resItvs[u][i][r], allocRes[u][i][r]);
I aim to utilize a cumulative function resUsage that adheres to the constraints imposed by resource availability.
forall (r in resources) resUsage [u] <= resAvail [r]
There might be alternative methods available apart from using pulse or cumulFunction.
Thanks.
sarwatatwadhika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.