I am dealing with a kind of scheduling problem. I have a set of tasks to be executed by a set of machines. It is known that different machines are able to execute the same task, but each machine can execute one task at time. The cost of executing each task is dependent of each machine.

I need to find the minimal cost of executing all required tasks, in addition to the cost of executing each task I need to consider that there is an supplementary cost of transferring the material between two consecutive machines.

I found this example that consider the alternative resources in house building (chapter 6) : https://github.com/IBMDecisionOptimization/docplex-examples/blob/b2cb101befaa3febba0fc5fcfb77f28436891cc4/examples/cp/jupyter/scheduling_tuto.ipynb

My question is: how to add the cost of changing the worker that executes the operation in this example?

Same question asked here: https://stackoverflow.com/questions/58859430/scheduling-with-transition-costs-docplex

  • 1
    $\begingroup$ You should also mention on Stack Overflow that your question is cross-posted here. $\endgroup$
    – prubin
    Commented Nov 14, 2019 at 22:22
  • $\begingroup$ Your second paragraph mentions transferring material between machines, but then you talk about the cost of changing a worker. Are those the same thing? $\endgroup$
    – prubin
    Commented Nov 14, 2019 at 22:23
  • 1
    $\begingroup$ You might want to tag the question with "CP Optimizer" or "constraint programming" to make it clear that you are using a CP formulation and not a MIP formulation (since DOCPLEX has both). $\endgroup$
    – prubin
    Commented Nov 14, 2019 at 22:31
  • $\begingroup$ @prubin thanks for your comments. I want to calculate the cost of changing machine and this cost is fixed (if machine changes, there is a cost), like if worker changes, there is a cost. $\endgroup$
    – campioni
    Commented Nov 15, 2019 at 9:36

1 Answer 1


According to you mentioned, it sounds like the Resource‐Constrained Project Scheduling Problem (RCPS). To execute such a problem with CPLEX, you have two different options.

  • First, develop a mixed-integer programming model and solve it using CPLEX solver.

  • Second, using constraint programming with CPLEX/CPO.

For the first option, some examples could be found here and here.

A nice topic on CPLEX/CPO has been explained by Philippe Laborie.

One of the ways to calculate the cost of transferring the material between two consecutive machines is to define a binary variable which counts the number of changeovers between tasks and equals one if task A is processed before task B on the machine M, otherwise zero. (many of MIP models contain such variable). Then, you could calculate material handling cost using this variable.

It should be noted that, in both options, you could try developing your model in CPLEX python API and feeding that into the DOCPLEX.

I hope it would be useful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.