Originally posted by: AndyHam
I am seeking advice here. Any help will be very appreciated^^
This is a daily production planning problem. Due to sequence dependent setup and time-based pm, I am exploring CP approach.
Suppose there is a set of jobs with different quantities and processing times. The goal is to achieve a daily output target.
The following is a result. The time unit is hour so I converted the "End" hour into "Day".
|
ID
|
Qty
|
Start
|
End
|
Day
|
|
10
|
6
|
0
|
12
|
1
|
|
2
|
10
|
12
|
22
|
1
|
|
1
|
5
|
22
|
32
|
2
|
|
8
|
1
|
32
|
33
|
2
|
|
9
|
3
|
33
|
39
|
2
|
|
3
|
7
|
39
|
53
|
3
|
|
5
|
8
|
53
|
61
|
3
|
|
13
|
6
|
61
|
73
|
4
|
|
4
|
7
|
73
|
87
|
4
|
|
12
|
5
|
87
|
97
|
5
|
|
15
|
4
|
97
|
105
|
5
|
|
11
|
9
|
105
|
114
|
5
|
|
6
|
8
|
114
|
130
|
6
|
|
7
|
9
|
130
|
148
|
6
|
|
14
|
8
|
148
|
156
|
6
|
Then, we can calculate the daily output.
|
Day
|
Output
|
|
1
|
16
|
|
2
|
9
|
|
3
|
15
|
|
4
|
13
|
|
5
|
18
|
|
6
|
25
|
Now, I am trying to make the factory produce 16 units every day. Any shortage amount needs to be summed up and penalized accordingly. Here are my questions:
(1) How to map interval variables value into integer variables in order to calculate the daily output.
(2) When an interval of job spans two days, I need to credit the proportional amount of output to each day. For instance, job k starts at 17 and ends at 40 with 6 units. Then, Day1 should get 2 and Day2 get 4 units.
using CP;
tuple t_Plan {
key int id;
int group;
int qty;
int pt;
};
{t_Plan} Plan={
<1, 1, 5, 2>,
<2, 2, 10, 1>,
<3, 3, 7, 2>,
<4, 1, 7, 2>,
<5, 2, 8, 1>,
<6, 3, 8, 2>,
<7, 1, 9, 2>,
<8, 2, 1, 1>,
<9, 3, 3, 2>,
<10,1, 6, 2>,
<11,2, 9, 1>,
<12,3, 5, 2>,
<13,1, 6, 2>,
<14,2, 8, 1>,
<15,3, 4, 2>
};
dvar interval itvPlan[p in Plan] size p.qty*p.pt;
dvar sequence seqMch in all(p in Plan) itvPlan[p];
minimize max(p in Plan) endOf(itvPlan[p]);
subject to {
noOverlap (seqMch);
}
execute{
for (var p in Plan)
writeln( p.id + "\t" + p.qty + "\t" + itvPlan[p].start + "\t" + itvPlan[p].end );
}
Thanks,
Andy
#DecisionOptimization#OPLusingCPOptimizer