Hello,
I use a cp model with Docplex to schedule orders from a factory under certain constraints. There are a number of orders that can run on a certain machine. I also model transition times (setup) between 2 jobs on the same machine. For example, if job 1 has a black color and job 2 has a red color, I have a transition matrix that represents the time between these two types.
Here is how I model this:
On each machine, I create a sequence_var with the intervals, their setup and their type (for exemple, on machine 1, I have job 1 which have setup 1 and wtasks 1 and type 1, type depend on color and others things).
I get the type of the previous job:
prev_type = model.type_of_prev(span_sequence, iv, first_type, current_type)
If types are the same, setup will be absent:
model.add(model.presence_of(su) == (prev_type != current_type))
After that, I use my transition matrix:
model.add(model.length_of(su, setup_matrix_dc[current_type][current_type]) == model.element(prev_type,setup_matrix_dc[current_type]))
But now I would like to add a setup (of a fixed size) when there is a certain time T between the beginning of a task and the end of the previous task.
For example, if I want to add a setup when there is more than 10 hours of space between two tasks, I would like to do like this:
Setup is present if type_prev!=current_type OR model.strat_of(iv) - model.end_of_prev(span_sequence, iv) > 1000.
Then, I set the size according to the reason of presence of the setup:
- if model.start_of(iv) - model.end_of_prev(span_sequence > 1000, I set the size to 500 (5 hours)
- if not, I set the size as I already did with model.length_of(su, setup_matrix_dc[current_type][current_type]) == model.element(prev_type, setup_matrix_dc[ current_type])
I have the idea but my application is not the right one for the second point.
I hope I've made myself clear.
Anyone have an idea?
It would be appreciated
Regards,
Yanis Sellaï
Integrator / Analytical Developer
Novipro INC
------------------------------
Yanis Sellaï
------------------------------
#DecisionOptimization