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
483e953b
Commit
483e953b
authored
5 years ago
by
erwan
Browse files
Options
Downloads
Plain Diff
New: add the pid of the process in the local_env
parents
2e5b8b6f
776d22ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/algo/algo.mli
+1
-1
1 addition, 1 deletion
lib/algo/algo.mli
lib/sasacore/env.ml
+2
-1
2 additions, 1 deletion
lib/sasacore/env.ml
lib/sasacore/sasa.ml
+1
-2
1 addition, 2 deletions
lib/sasacore/sasa.ml
test/coloring/p.ml
+5
-4
5 additions, 4 deletions
test/coloring/p.ml
with
9 additions
and
8 deletions
lib/algo/algo.mli
+
1
−
1
View file @
483e953b
(* Time-stamp: <modified the 1
2
/06/2019 (at
09:54
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
4
/06/2019 (at
13:46
) by Erwan Jahier> *)
(** Process programmer API *)
...
...
This diff is collapsed.
Click to expand it.
lib/sasacore/env.ml
+
2
−
1
View file @
483e953b
(* Time-stamp: <modified the 1
2
/06/2019 (at
08:0
6) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
4
/06/2019 (at
13:4
6) by Erwan Jahier> *)
module
Dico
=
Map
.
Make
(
String
)
...
...
@@ -21,6 +21,7 @@ let (get_copy: Algo.vars -> 'v t -> string -> 'v Algo.local_env) =
let
(
set
:
'
v
t
->
string
->
'
v
Algo
.
local_env
->
'
v
t
)
=
fun
e
pid
lenv
->
(* Printf.printf "--> set pid %s\n" pid; flush stdout; *)
let
lenv
=
Algo
.
set
lenv
"pid"
(
Algo
.
S
pid
)
in
Dico
.
add
pid
lenv
e
let
(
init
:
unit
->
'
v
t
)
=
fun
()
->
Dico
.
empty
...
...
This diff is collapsed.
Click to expand it.
lib/sasacore/sasa.ml
+
1
−
2
View file @
483e953b
(* Time-stamp: <modified the 1
2
/06/2019 (at
09:57
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
4
/06/2019 (at
13:45
) by Erwan Jahier> *)
open
Algo
open
Sasacore
let
(
update_env_with_init
:
'
v
Env
.
t
->
'
v
Process
.
t
list
->
'
v
Env
.
t
)
=
fun
e
pl
->
let
(
aux
:
'
v
Env
.
t
->
'
v
Process
.
t
->
'
v
Env
.
t
)
=
...
...
This diff is collapsed.
Click to expand it.
test/coloring/p.ml
+
5
−
4
View file @
483e953b
(* Time-stamp: <modified the 1
1
/06/2019 (at 1
6:32
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
4
/06/2019 (at 1
3:26
) by Erwan Jahier> *)
(* This is algo 3.1 in the book *)
...
...
@@ -12,7 +12,7 @@ let (init_vars: neighbor list -> local_env) =
set
empty_env
"c"
(
I
(
Random
.
int
k
))
let
verbose
=
fals
e
let
verbose
=
tru
e
let
(
neigbhors_values
:
neighbor
list
->
Algo
.
value
list
)
=
fun
nl
->
...
...
@@ -23,7 +23,8 @@ let (clash : Algo.value -> neighbor list -> bool) = fun v nl ->
let
inl
=
List
.
map
(
fun
n
->
n
.
pid
()
)
nl
in
let
res
=
List
.
mem
v
vnl
in
if
verbose
then
(
Printf
.
printf
"%s %s in [%s] (%s)
\n
"
(
value_to_string
v
)
(
if
res
then
""
else
"not"
)
Printf
.
printf
"%s %s in [%s] (%s)
\n
"
(
value_to_string
v
)
(
if
res
then
""
else
"not"
)
(
String
.
concat
","
(
List
.
map
value_to_string
vnl
))
(
String
.
concat
","
(
inl
));
flush
stdout
...
...
@@ -46,7 +47,7 @@ let (free : neighbor list -> Algo.value list) = fun nl ->
let
(
enable_f
:
neighbor
list
->
local_env
->
action
list
)
=
fun
nl
e
->
if
(
clash
(
get
e
"c"
)
nl
)
then
[
"conflict"
]
else
[]
let
(
step_f
:
neighbor
list
->
local_env
->
action
->
local_env
)
=
fun
nl
e
a
->
let
f
=
free
nl
in
...
...
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