-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTSAP Optimization.page
120 lines (90 loc) · 2.49 KB
/
TSAP Optimization.page
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
Generic model customized to handle time-varied requirements
=======================================================
Model overview
--------------
```{.clafer .summary}
```
```{.clafer .mooviz}
```
Service prototype
-----------------
```clafer
abstract Service
requirements : Requirements // resources required by a service
machine -> Machine // machine the service is allocated to
[this in machine.services] // inverse relationship constraint
```
Requirements and Resources prototypes
-------------------------------------
```clafer
abstract Requirements
morning_cpu -> integer
midday_cpu -> integer
evening_cpu -> integer
night_cpu -> integer
abstract Resources
cpu -> integer
```
Machine prototype
-----------------
```clafer
abstract Machine
services -> Service*
[this.machine = Machine]
isFree?
[isFree <=> no services]
limits : Resources
/* constraints for limiting total requirements */
morning_utilization : Resources
[cpu = sum services.requirements.morning_cpu]
[cpu < limits.cpu]
midday_utilization : Resources
[cpu = sum services.requirements.midday_cpu]
[cpu < limits.cpu]
evening_utilization : Resources
[cpu = sum services.requirements.evening_cpu]
[cpu < limits.cpu]
night_utilization : Resources
[cpu = sum services.requirements.night_cpu]
[cpu < limits.cpu]
```
A machine is free when no services are allocated.
Utilization of the machine must satisfy limits varied by time of day.
Optimization goals and constraints
----------------------------------
```clafer
Task
// total number of machines free
total_free -> integer = #Machine.isFree
<<max Task.total_free>>
```
Particular data (machines and services)
=======================================================
Machines
--------
```clafer
GoogleCA : Machine
[limits.cpu = 10]
GoogleNY : Machine
[limits.cpu = 16]
GoogleTX : Machine
[limits.cpu = 14]
```
Services
```clafer
MailService : Service
[requirements.morning_cpu = 5]
[requirements.midday_cpu = 4]
[requirements.evening_cpu = 5]
[requirements.night_cpu = 1]
SearchService : Service
[requirements.morning_cpu = 7]
[requirements.midday_cpu = 7]
[requirements.evening_cpu = 8]
[requirements.night_cpu = 3]
CalendarService : Service
[requirements.morning_cpu = 2]
[requirements.midday_cpu = 2]
[requirements.evening_cpu = 2]
[requirements.night_cpu = 1]
```