-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusr.ml
79 lines (57 loc) · 1.88 KB
/
usr.ml
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
open Const
open Format
(* DEFINITION TYPE TASKS *)
type task ={id:int;
work:float;
fiab:float;
}
(* DEFINITION TYPE EDGES *)
type edge ={id1:int;
id2:int;
}
module IntOrd =
struct
type t = int
let compare = Pervasives.compare
end
module V = Set.Make(IntOrd)
module VH1 = Set.Make(IntOrd)
module IntMap = Map.Make(IntOrd)
type configuration = {
tabTask : task array array;
tabStartTime : (float * V.t) array array;
tabFinishTime : (float * V.t) array array;
tabSlowed : bool array array;
tabSlowedFreq : (float * float) array array;
}
(*GLOBAL ARRAYS, DEFINITIONS*)
(*WE DEFINE THE SET OF EDGES, SORTED WITH LEX ORDER. *)
module EdgeIdOrd =
struct
type t= edge
let compare = fun e1 e2 ->
if ((e1.id1) < (e2.id1)) then -1
else if ((e1.id1) > (e2.id1)) then 1
else if ((e1.id2) < (e2.id2)) then -1
else if ((e1.id2) > (e2.id2)) then 1
else 0
end
module E = Set.Make(EdgeIdOrd)
let eDag = ref E.empty (*eDAG is the set of edges *)
(* OBJECTIVE FUNCTIONS *)
let matchRel config param f1 f2 id =
(f1*.f2 >= param.lambda0 *. ((config.tabTask.(0).(id)).work) *. param.fr)
let energy id config h =
let f1,f2 = config.tabSlowedFreq.(h).(id) in
if config.tabSlowed.(h).(id) then ((config.tabTask.(0).(id)).work) *. (f1**2. +. f2**2.)
else ((config.tabTask.(0).(id)).work) *. (f1**2.)
(* energy functions depending on the model *)
let energyTest config f1 f2 id =
((config.tabTask.(0).(id)).work) *. (f1**2. +. f2**2.)
(* energy functions depending on the model *)
let computef1 param t = (*execution speed when two executions *)
(* 0.2838 *. param.fr*) 0.7 *. param.fr
let computef2 param t =(*re-execution speed when two executions *)
(* 0.2838 *. param.fr*) 0.7 *. param.fr
(* FONCTION DE COMPARAISON D'HEURISTIQUES*)
let heurFun1 config t w = w +. (config.tabTask.(0).(t).work)