Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
sasa
Commits
3edf66f6
Commit
3edf66f6
authored
4 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
Chore: renaming functions
parent
6a060cd6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/sasacore/daemon.ml
+3
-3
3 additions, 3 deletions
lib/sasacore/daemon.ml
lib/sasacore/evil.ml
+11
-11
11 additions, 11 deletions
lib/sasacore/evil.ml
lib/sasacore/evil.mli
+11
-10
11 additions, 10 deletions
lib/sasacore/evil.mli
with
25 additions
and
24 deletions
lib/sasacore/daemon.ml
+
3
−
3
View file @
3edf66f6
(* Time-stamp: <modified the
30/09
/2020 (at 1
3:53
) by Erwan Jahier> *)
(* Time-stamp: <modified the
07/12
/2020 (at 1
0:18
) by Erwan Jahier> *)
type
t
=
|
Synchronous
(* select all actions *)
...
...
@@ -141,10 +141,10 @@ let (f: bool -> bool -> t -> ('v Process.t * 'v Register.neighbor list) list ->
let
al
=
distributed
(
remove_empty_list
all
)
in
get_activate_val
al
pl
,
al
|
Greedy
->
let
al
=
Evil
.
worst
verbose_mode
e
p_nl_l
(
remove_empty_list
all
)
in
let
al
=
Evil
.
greedy
verbose_mode
e
p_nl_l
(
remove_empty_list
all
)
in
get_activate_val
al
pl
,
al
|
GreedyCentral
->
let
al
=
Evil
.
worst
_central
verbose_mode
e
p_nl_l
(
remove_empty_list
all
)
in
let
al
=
Evil
.
greedy
_central
verbose_mode
e
p_nl_l
(
remove_empty_list
all
)
in
get_activate_val
al
pl
,
al
|
Bad
i
->
let
al
=
Evil
.
bad
i
e
(
remove_empty_list
all
)
in
...
...
This diff is collapsed.
Click to expand it.
lib/sasacore/evil.ml
+
11
−
11
View file @
3edf66f6
(* Time-stamp: <modified the
13
/1
0
/2020 (at 1
6:06
) by Erwan Jahier> *)
(* Time-stamp: <modified the
07
/1
2
/2020 (at 1
0:20
) by Erwan Jahier> *)
type
'
v
pna
=
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
*
Register
.
action
...
...
@@ -118,7 +118,7 @@ let time3 verb lbl f x y z =
if
verb
then
Printf
.
eprintf
" [%s] Execution time: %fs
\n
"
lbl
(
Sys
.
time
()
-.
t
);
fxy
let
(
worst
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
let
(
greedy
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
pna
list
list
->
'
v
pna
list
)
=
fun
verb
e
p_nl_l
all
->
assert
(
all
<>
[]
);
...
...
@@ -138,7 +138,7 @@ let (worst: bool -> 'v Env.t -> ('v Process.t * 'v Register.neighbor list) list
let
cpt
=
ref
0
in
let
(
get_max
:
'
v
pna
list
list
->
'
v
pna
list
*
float
)
=
fun
all
->
let
pnal1
,
p1
,
shedules
=
match
time
verb
"Evil.
worst
enumerate"
enumerate
all
with
match
time
verb
"Evil.
greedy
enumerate"
enumerate
all
with
|
NoMore
->
assert
false
|
Elt
(
pnal
,
c
)
->
pnal
,
pf
pnal
,
c
in
...
...
@@ -153,15 +153,15 @@ let (worst: bool -> 'v Env.t -> ('v Process.t * 'v Register.neighbor list) list
then
search_max
[]
(
pnal_acc
,
v_acc
)
(
c
()
)
else
search_max
[]
(
pnal
,
v
)
(
c
()
)
in
let
maxl
=
(
time3
verb
"Evil.
worst
search"
search_max
[]
(
pnal1
,
p1
)
(
shedules
()
))
in
let
maxl
=
(
time3
verb
"Evil.
greedy
search"
search_max
[]
(
pnal1
,
p1
)
(
shedules
()
))
in
List
.
nth
maxl
(
Random
.
int
(
List
.
length
maxl
))
in
let
res
=
fst
(
get_max
all
)
in
if
verb
then
Printf
.
eprintf
" [Evil.
worst
] Number of trials: %i
\n
%!"
!
cpt
;
if
verb
then
Printf
.
eprintf
" [Evil.
greedy
] Number of trials: %i
\n
%!"
!
cpt
;
res
let
(
worst
_central
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
pna
list
list
->
'
v
pna
list
)
=
let
(
greedy
_central
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
pna
list
list
->
'
v
pna
list
)
=
fun
verb
e
p_nl_l
all
->
assert
(
all
<>
[]
);
match
Register
.
get_potential
()
with
...
...
@@ -178,12 +178,12 @@ let (worst_central: bool -> 'v Env.t -> ('v Process.t * 'v Register.neighbor lis
user_pf
pidl
get_info
in
let
all
=
(
time
verb
"Evil.
worst
_central connected component"
connected_component
all
)
(
time
verb
"Evil.
greedy
_central connected component"
connected_component
all
)
in
let
cpt
=
ref
0
in
let
(
get_max
:
'
v
pna
list
list
->
'
v
pna
*
float
)
=
fun
all
->
let
pnal1
,
p1
,
shedules
=
match
time
verb
"Evil.
worst
_central enumerate"
enumerate_central
all
with
match
time
verb
"Evil.
greedy
_central enumerate"
enumerate_central
all
with
|
NoMore
->
assert
false
|
Elt
(
pna
,
c
)
->
pna
,
pf
pna
,
c
in
...
...
@@ -198,12 +198,12 @@ let (worst_central: bool -> 'v Env.t -> ('v Process.t * 'v Register.neighbor lis
then
search_max
[]
(
pnal_acc
,
v_acc
)
(
c
()
)
else
search_max
[]
(
pnal
,
v
)
(
c
()
)
in
let
maxl
=
(
time3
verb
"Evil.
worst
_central search"
search_max
[]
(
pnal1
,
p1
)
(
shedules
()
))
in
let
maxl
=
(
time3
verb
"Evil.
greedy
_central search"
search_max
[]
(
pnal1
,
p1
)
(
shedules
()
))
in
List
.
nth
maxl
(
Random
.
int
(
List
.
length
maxl
))
in
let
res
=
fst
(
get_max
all
)
in
if
verb
then
(
Printf
.
eprintf
" [Evil.
worst
] Number of trials: %i
\n
%!"
!
cpt
;
Printf
.
eprintf
" [Evil.
greedy
] Number of trials: %i
\n
%!"
!
cpt
;
);
[
res
]
...
...
This diff is collapsed.
Click to expand it.
lib/sasacore/evil.mli
+
11
−
10
View file @
3edf66f6
(* Time-stamp: <modified the
25/09
/2020 (at 1
7:01
) by Erwan Jahier> *)
(* Time-stamp: <modified the
07/12
/2020 (at 1
0:16
) by Erwan Jahier> *)
(** This module gathers daemons that tries to reach the worst case with
...
...
@@ -6,21 +6,22 @@
type
'
v
pna
=
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
*
Register
.
action
(** [worst verb e p_nl_l all] Enumerate all the combinations, i.e., O(2^n) where
n is the number of enabled processes (|all|) *)
val
worst
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
(** [greedy verb e p_nl_l all] take the worst case among the combinations of
length 1, i.e., O(2^n) where n is the number of enabled processes
(|all|) *)
val
greedy
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
pna
list
list
->
'
v
pna
list
(**
Enumerate all the
central daemons (of a connected component) *)
val
worst
_central
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
(**
Ditto, but for
central daemons (of a connected component) *)
val
greedy
_central
:
bool
->
'
v
Env
.
t
->
(
'
v
Process
.
t
*
'
v
Register
.
neighbor
list
)
list
->
'
v
pna
list
list
->
'
v
pna
list
(** Returns the worst
solution for convex potential functions, and
just
a
bad one otherwise (O(n)
where n is the number of enabled
processes). *)
(** Returns the worst
case among the combinations of length 1 for
convex potential functions, and
just
a
bad
one otherwise (O(n)
where n is the number of enabled
processes). *)
val
worst4convex
:
'
v
Env
.
t
->
'
v
pna
list
list
->
'
v
pna
list
(** enumerate all the cases in sub-graphs of given size (O(2^size_max)) *)
(** enumerate all the cases
(of length 1)
in sub-graphs of given size (O(2^size_max)) *)
val
bad
:
int
->
'
v
Env
.
t
->
'
v
pna
list
list
->
'
v
pna
list
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment