# Scheduling with transition costs - DOCPLEX

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?

• You should also mention on Stack Overflow that your question is cross-posted here. Nov 14 '19 at 22:22
• Your second paragraph mentions transferring material between machines, but then you talk about the cost of changing a worker. Are those the same thing? Nov 14 '19 at 22:23
• 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). Nov 14 '19 at 22:31
• @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. Nov 15 '19 at 9:36

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.