Monitoring average buffer content from interval variables using docplex.cp

53 views Asked by At

I have a job-shop model programmed using CPO (docplex.cp) and it is working fine! I have model all my scheduling variables as interval variables like ops(j,o) and mops(j, o, m) (job, operation, machine) like in the cp doc examples.

However, I have inserted some machines as buffers, which are optional and no-fixed sized. The objective of the optimization is set to minimize Makespan, but I would like to add a KPI monitoring the number of buffers used in parallel at each moment to get the maximum and the average.

I have delved into the docplex examples and documentation but I have no idea on how to this. My vague attempts have revolved around creating a step _at(0,) variable and accumulating pulse(mops), but I don't know how to extract the "max" of it. Any idea or suggestion?

I can provide the code, but it is very similar to the one in the documentation.

1

There are 1 answers

1
Olivier Lhomme On

Ok, it's clearer now. You could:

  1. Create an optional interval variable buffer_i_j for each job i between each operation j and operation j+1, and constrain it to start at end of operation j, and to end at start of operation j+1.
  2. Add a constraint so that buffer_i_j is present if and only if its length is different from 0.
  3. Then introduce a cumul expression f, so that all the buffers contribute to f by a pulse of height 1.
  4. Then it remains to get the max of f. There is no direct way, but you can do as follows.

let MAX be the max capacity of f, the number of jobs can be used for that.

Let HORIZON be an interval variable starting at 0 and ending at the max possible time in your problem.

Let us introduce g = pulse(HORIZON,0,MAX)

Add the constaint f+g<=MAX

Define f_max = MAX - heightAtStart(g,HORIZON)

Now if we maximize f_max, it will be the max level of f on HORIZON

You need to put f_max in your objective.