-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaggregate_planning_profit.mod
131 lines (99 loc) · 3.54 KB
/
aggregate_planning_profit.mod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
set TIME;
set TIME_SHIFT;
set INIT;
set END;
var EMPLOYEES{i in TIME_SHIFT} integer >= 0;
var FIRED_EMPLOYEES{i in TIME} integer >= 0;
var HIRED_EMPLOYEES{i in TIME} integer >= 0;
var INVENTORY{i in TIME_SHIFT} integer >= 0;
var OVERTIME{i in TIME} integer >= 0;
var BACKORDER{i in TIME_SHIFT} integer >= 0;
var INTERNAL{i in TIME} integer >= 0;
var OUTSRC{i in TIME} integer >= 0;
param cm;
param ci;
param cb;
param ct;
param cf;
param ch;
param cw;
param co;
param cc;
param L;
param H;
param M;
param init_employees;
param init_backorders;
param init_inventory;
param end_inventory_min;
param end_backlog_max;
param end_employees_min;
param end_employees_max;
param price_elasticity;
param discount{i in TIME};
param base_demand{i in TIME};
param demand{i in TIME} integer := base_demand[i] + base_demand[i]*price_elasticity*discount[i];
param base_price;
param price{i in TIME} := base_price - base_price*discount[i];
param total_cost := sum{i in TIME} price[i]*demand[i];
maximize profit: sum{i in TIME} demand[i]*price[i] - sum{i in TIME} ( cw*EMPLOYEES[i] + ch*HIRED_EMPLOYEES[i] + cf*FIRED_EMPLOYEES[i] + co*OVERTIME[i] + ci*INVENTORY[i] + cb*BACKORDER[i] + cm*INTERNAL[i] + cc*OUTSRC[i]);
s.t. cap_constraint{i in TIME}:L*INTERNAL[i] - H*EMPLOYEES[i] - OVERTIME[i] <= 0;
s.t. workforce{i in TIME}: EMPLOYEES[i] - EMPLOYEES[i - 1] - HIRED_EMPLOYEES[i] + FIRED_EMPLOYEES[i] = 0;
s.t. inventory{i in TIME}: INVENTORY[i] - INVENTORY[i - 1] - INTERNAL[i] - OUTSRC[i] + demand[i] + BACKORDER[i-1] - BACKORDER[i] = 0;
s.t. overtime{i in TIME}:OVERTIME[i] - M*EMPLOYEES[i] <= 0;
s.t. init_workforce_constraint{i in INIT}: EMPLOYEES[i] = init_employees;
s.t. init_inventory_constraint{i in INIT}: INVENTORY[i] = init_inventory;
s.t. init_backorder_constraint{i in INIT}: BACKORDER[i] = init_backorders;
s.t. end_workforce_constraint{i in END}: EMPLOYEES[i] <= end_employees_max;
s.t. end_workforce_constraint_min{i in END}: EMPLOYEES[i] >= end_employees_min;
s.t. end_inventory_constraint{i in END}: INVENTORY[i] >= end_inventory_min;
s.t. end_inventory_constraint1{i in TIME}: INVENTORY[i] <= 1000;
s.t. end_backorder_constraint{i in END}: BACKORDER[i] <= end_backlog_max;
solve;
printf '\n Results #############\n';
printf 'Total Profit : ';
printf '%.2f', profit;
printf '\n';
printf 'Regular Labor Cost : ';
printf '%.2f', sum{i in TIME} EMPLOYEES[i]*cw;
printf '\n';
printf 'Overtime Cost : ';
printf '%.2f', sum{i in TIME} OVERTIME[i]*co;
printf '\n';
printf 'Cost of Hiring : ';
printf '%.2f', sum{i in TIME} HIRED_EMPLOYEES[i]*ch;
printf '\n';
printf 'Cost of Firing : ';
printf '%.2f', sum{i in TIME} FIRED_EMPLOYEES[i]*cf;
printf '\n';
printf 'Cost of Inventory: ';
printf '%.2f', sum{i in TIME} INVENTORY[i]*ci;
printf '\n';
printf 'Cost of Stockouts: ';
printf '%.2f', sum{i in TIME} BACKORDER[i]*cb;
printf '\n';
printf 'Cost of Materials: ';
printf '%.2f', sum{i in TIME} INTERNAL[i]*cm;
printf '\n';
printf 'Cost of Outsourcing: ';
printf '%.2f', sum{i in TIME} OUTSRC[i]*cc;
printf '\n';
printf 'Number of Employees hired: ';
printf '%d', sum{i in TIME} HIRED_EMPLOYEES[i];
printf '\n';
printf 'Number of Employees fired: ';
printf '%d', sum{i in TIME} FIRED_EMPLOYEES[i];
printf '\n';
printf 'Number of Overtime: ';
printf '%d', sum{i in TIME} OVERTIME[i];
printf '\n';
printf 'Number of Items Backlogged: ';
printf '%d', sum{i in TIME} BACKORDER[i];
printf '\n';
printf 'Number of Items Produced: ';
printf '%d', sum{i in TIME} INTERNAL[i];
printf '\n';
printf 'Number of Items Outsourced: ';
printf '%d', sum{i in TIME} OUTSRC[i];
printf '\n';
printf '#############\n\n';