-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.jl
More file actions
92 lines (68 loc) · 3.27 KB
/
main.jl
File metadata and controls
92 lines (68 loc) · 3.27 KB
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
include("heuris.jl")
include("exact.jl")
function Provide_full_results(s, m)
""" String * Int -> Void
s : Une sous chaine des noms d'instances a executer
m : Le nombre maximal de vehicules
Lance la resolution heuritique en deux phases et la resolution exacte (branch and cut) pour toute les instances ayant pour sous chaine s.
"""
ldir = readdir("./PRP_instances/")
for i in 1:length(ldir)
if occursin(s, ldir[i])
x = split(ldir[i], ".")
t0 = CPUtime_us()
tmin = Heuris(ldir[i], m, "Example_results")
t1 = CPUtime_us()
open(string("./Example_results/heu/PDI_heu_", x[1], "/", "PDI_heu_", x[1], ".log"), "w") do f
write(f, string("t Execution time : ", (t1 - t0) / 1e6, " s\n"))
write(f, string("o Objective value : ", tmin, "\n"))
end
println(ldir[i], " heuristic checked")
end
if occursin(s, ldir[i])
x = split(ldir[i], ".")
t0 = CPUtime_us()
tmin, gap = Exact_ne(ldir[i], m, "Example_results")
t1 = CPUtime_us()
open(string("./Example_results/exact/PDI_exact_", x[1], "/", "PDI_exact_", x[1], ".log"), "w") do f
write(f, string("t Execution time : ", (t1 - t0) / 1e6, " s\n"))
write(f, string("o Objective value : ", tmin, "\n"))
write(f, string("g Relative gap : ", round(gap * 100, digits = 2), "%\n"))
end
println(ldir[i], " optimal checked")
end
end
end
function Provide_class_results(s, m)
""" String * Int -> Void
s : Une sous chaine des noms d'instances a executer
m : Le nombre maximal de vehicules
Lance la resolution heuritique en deux phases et la resolution exacte (branch and cut) pour toute les instances par classe ayant pour sous chaine s.
"""
ldir = readdir("./PRP_instances/")
for i in 1:length(ldir)
if occursin(s, ldir[i]) && (occursin("ABS12", ldir[i]) || occursin("ABS36", ldir[i]) || occursin("ABS60", ldir[i]) || occursin("ABS84", ldir[i]))
x = split(ldir[i], ".")
t0 = CPUtime_us()
tmin = Heuris(ldir[i], m)
t1 = CPUtime_us()
open(string("./Results/heu/PDI_heu_", x[1], "/", "PDI_heu_", x[1], ".log"), "w") do f
write(f, string("t Execution time : ", (t1 - t0) / 1e6, " s\n"))
write(f, string("o Objective value : ", tmin, "\n"))
end
println(ldir[i], " heuristic checked")
end
if occursin(s, ldir[i]) && (occursin("ABS12", ldir[i]) || occursin("ABS36", ldir[i]) || occursin("ABS60", ldir[i]) || occursin("ABS84", ldir[i]))
x = split(ldir[i], ".")
t0 = CPUtime_us()
tmin, gap = Exact_ne(ldir[i], m)
t1 = CPUtime_us()
open(string("./Results/exact/PDI_exact_", x[1], "/", "PDI_exact_", x[1], ".log"), "w") do f
write(f, string("t Execution time : ", (t1 - t0) / 1e6, " s\n"))
write(f, string("o Objective value : ", tmin, "\n"))
write(f, string("g Relative gap : ", round(gap * 100, digits = 2), "%\n"))
end
println(ldir[i], " optimal checked")
end
end
end