0

I have n tasks to be scheduled. The time horizon is 0..T periods. Each task consumes a resources when executed. A resources are limited and could be of different types. I use the following decision variables in choco 2.1.5:

IntegerVariable[][] x = new IntegerVariable[n][m]; // decision variables

int i, j;
for (i = 0; i < n; i++){
    for (j = 0; j < T; j++){
        x[i][j] = Choco.makeIntVar("x_" + i +"_" + j, 0, 1,Options.V_ENUM);
                    model.addVariable(x[i][j]);         
    }
}

The variable x[i][j] equals 1 if the task i starts in period j, equals 0 otherwise. If a number of tasks may run in the same period they have to satisfy resources capacity limits. In case of a given task before a solver find in which period a task should start I have to add additional constraints for a resources. So, in a given period I have to count all usage of resources by running tasks. And I have to somehow know when they start and finish before the model is solved.

In different worrds how to implement the constraint consisting of the following sum: BigSigma {i | start[i]≤t<start[i]+duration[i]} resourcesRequiredByTask[i] ≤ capacity, (∀ time t), where index i is a task number.

Dan
  • 7,286
  • 6
  • 49
  • 114
JackAW
  • 164
  • 2
  • 14
  • 1
    I have to ask: Have you checked out the cumulative constraint in Choco? What I can see it do much of what you want. Or have I missed something? – hakank Jun 15 '14 at 10:09
  • @hakank Dear Hakan, you are right, but I would like to impelement a pure scheduling algorithm, without using any internal API. I base on old Pritsker RCPSP algorithm (1968 year). Especially, I dont know how to handle situation when a variable x[i][j] value is yet not known (it could be either 0 or 1), but I have to set constraint for the resources consumed by task i in so far unknown time period. – JackAW Jun 15 '14 at 19:38

0 Answers0