How can I use cumulfunction as dependent of the time scale in objective function? Or, any alternative solution?

135 Views Asked by At

I created a resource-constraint multi-project scheduling problem formulation by using ILOG CP Optimizer. In this problem, each resource can work on several tasks at certain period depending on their skill, capability and capacity.

I used cumulFunction ResourceUsage[K in 1..nbResources]=sum(P in 1..nbProjects, I in 1..nbTasks, S in 1..nbSkills) pulse(itvs[P][I],BRatio[P][I][K][S]*Capability[P][I][K][S])in order to track utilization of resources during project period. However, cumulfunction is independent of the time scale and I would like to minimize total salary cost spent for resource usage and minimize excessive amount of resource usage as problem objectives.

I formulated model as below by using additional variable R[K] however it should show R[K] usage during time T. Like R[K][T] in CPLEX formulations.

dvar interval itvs[P in 1..nbProjects][I in 1..nbTasks] in EST[P][I]..EFT[P][I] size PT[P][I];
dvar int+ R[K in 1..nbResources];
dvar int+ SSURP[K in 1..nbResources];
minimize sum(K in 1..nbResources) FixedCost[K]*R[K]+sum(K in 1..nbResources) OverCapCost[K]*SSURP[K];

subject to{...

forall(K in 1..nbResources)
  R[K]>=ResourceUsage[K];

forall(K in 1..nbResources)
  R[K]-SSURP[K]<=RMAX[K];}  
1

There are 1 best solutions below

0
On

You could use heightAtStart to get a specific value from a culul:

using CP;

dvar interval itvs1 in 0..5 size 5;

dvar interval itvs2 in 2..7 size 5;
dvar interval reset in 10..11 size 1;

// value we look for : the value v of cumul c at time 10
dvar int v;

cumulFunction  c=stepAtStart(itvs1,2)+stepAtStart(itvs2,4);
cumulFunction  c2=c-stepAtStart(reset,0,20);

subject to
{
  c<=10;
  
  alwaysIn(c2,10,11,0,0);
  
  v==-heightAtStart(reset,c2);
}

execute
{
  writeln("v=",v);
}

/*

which gives

v=6

*/