Originally posted by: Petr Vilím
Hello,
I see two different ways to model this problem: using interval variables or integer variables.
1) With integer variables
Considering the fact that time unit seems to be one day and there is basically one activity per day on each resource, it is rather timetabling problem then pure scheduling problem (i.e dates are fixed, the unknown what will be done within given time slot). So there could be one integer variable per slot (machine and day) say what kind of product (or setup) the machine does that day, lets call them for example production[machine][day]. And let value 0 denotes setup. Then we can constrain production at the given day to be the same as the day before unless there was a setup the day before.
ifThen(production[machine][day-1] != 0, production[machine][day] == production[machine][day-1])
Production of a product 1 during some period could be computed using count expression:
daily_product1_rate * count(production[machine1][day1], production[machine1][day2], ..., 1)
In OPL you can use "all" to create the list of values for count expression (the above example is in cpo file format).
Number of setups could be counted using count expressions.
2) With interval variables
In that case I'm assuming that what you described is just a simplification of a bigger problem. In particular this model could be useful if you need to create lower-resolution schedule and for example duration of one batch of production A has different duration than batch of product B. In this case I recommend to have a look on example sched_setup (or SchedSetup) that is delivered together with CP Optimizer in different languages. Regarding setup cost, I recommend to have at section "Sequence-dependent setup costs" at the bottom of the following page:
https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cpo.help/CP_Optimizer/User_manual/topics/designsched_costs.html
Best regards, Petr
#ConstraintProgramming-General#DecisionOptimization