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
d9d1abfd
Commit
d9d1abfd
authored
5 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
Refactor: coloring/p.ml
parent
294cb67c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/coloring/p.ml
+10
-9
10 additions, 9 deletions
test/coloring/p.ml
with
10 additions
and
9 deletions
test/coloring/p.ml
+
10
−
9
View file @
d9d1abfd
(* Time-stamp: <modified the
2
0/0
3
/2019 (at 1
3:18
) by Erwan Jahier> *)
(* Time-stamp: <modified the
1
0/0
5
/2019 (at 1
0:04
) by Erwan Jahier> *)
(* This is algo 3.1 in the book *)
...
...
@@ -12,25 +12,26 @@ let (init_vars: neighbor list -> local_env) =
function
_
->
I
(
Random
.
int
k
)
let
(
used
:
neighbor
list
->
Algo
.
value
list
)
=
fun
nl
->
let
(
clash
:
neighbor
list
->
Algo
.
value
list
)
=
fun
nl
->
let
res
=
List
.
map
(
fun
n
->
n
.
lenv
"c"
)
nl
in
res
let
(
free
:
neighbor
list
->
Algo
.
value
list
)
=
fun
nl
->
let
used
_list
=
List
.
sort_uniq
compare
(
used
nl
)
in
let
rec
aux
free
used
i
=
let
clash
_list
=
List
.
sort_uniq
compare
(
clash
nl
)
in
let
rec
aux
free
clash
i
=
if
i
>
k
then
free
else
(
match
used
with
|
x
::
tail
->
if
x
=
I
i
then
aux
free
tail
(
i
+
1
)
else
aux
((
I
i
)
::
free
)
used
(
i
+
1
)
|
[]
->
aux
((
I
i
)
::
free
)
used
(
i
+
1
)
(
match
clash
with
|
x
::
tail
->
if
x
=
I
i
then
aux
free
tail
(
i
+
1
)
else
aux
((
I
i
)
::
free
)
clash
(
i
+
1
)
|
[]
->
aux
((
I
i
)
::
free
)
clash
(
i
+
1
)
)
in
let
res
=
aux
[]
used
_list
0
in
let
res
=
aux
[]
clash
_list
0
in
List
.
rev
res
let
(
enable_f
:
neighbor
list
->
local_env
->
action
list
)
=
fun
nl
e
->
if
List
.
mem
(
e
"c"
)
(
used
nl
)
then
[
"conflict"
]
else
[]
if
List
.
mem
(
e
"c"
)
(
clash
nl
)
then
[
"conflict"
]
else
[]
let
(
step_f
:
neighbor
list
->
local_env
->
action
->
local_env
)
=
fun
nl
e
->
...
...
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