generated from Gophing-Around/hashcode-golang-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (39 loc) · 1.18 KB
/
main.go
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
package main
import (
"fmt"
"io/ioutil"
)
func main() {
files := []string{
// Uncomment the line with the desired files (add other lines if needed)
// "a",
"a", "b", "c", "d", "e",
// "a", "b",
// "a", "b", "e", "f",
// "c",
// "d",
}
for _, fileName := range files {
fmt.Printf("****************** INPUT: %s\n", fileName)
inputSet := readFile(fmt.Sprintf("./inputFiles/%s.in", fileName))
config, videos, serversMap, endpointsMap, requestsList, serversList := buildInput(inputSet)
// fmt.Printf("Config %+v\n", config)
// for i, video := range videos {
// fmt.Printf("video %d %+v\n", i, video)
// }
// for i, server := range serversMap {
// fmt.Printf("serversMap %d %+v\n", i, server)
// }
// for i, endpoint := range endpointsMap {
// fmt.Printf("endpointsMap %d %+v\n", i, endpoint)
// }
// for i, req := range requestsList {
// fmt.Printf("requestsList %d %+v\n", i, req)
// }
// printInputMetrics(input)
algorithm(config, videos, serversMap, endpointsMap, requestsList, serversList)
output := buildOutput(serversMap)
// printResultMetrics(result)
ioutil.WriteFile(fmt.Sprintf("./result/%s.out", fileName), []byte(output), 0644)
}
}