Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
bc2e0e1c
Commit
bc2e0e1c
authored
Nov 09, 2018
by
Mathieu Hemery
Browse files
Correct the parser from glucose in solve_sat
parent
c6a8ccb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
sepi_graphs.pl
View file @
bc2e0e1c
...
...
@@ -329,6 +329,9 @@ write_morph(Tabint, G1, G2) :-
write_morph
(
Tabint
,
G1
,
G2
,
0
).
write_morph
(
_
,
[
N1
|
_
],
[
N2
|
_
],
N
)
:-
N
is
N1
*
(
N2
+
1
)
+
1
.
write_morph
([
X
|
Tail
],
G1
,
G2
,
I
)
:-
X
=
"SAT"
,
write_morph
(
Tail
,
G1
,
G2
,
I
).
write_morph
([
X
|
Tail
],
G1
,
G2
,
I
)
:-
atom_number
(
X
,
Xnum
),
(
m_to_morph
(
Xnum
,
G1
,
G2
);
true
),
...
...
@@ -490,14 +493,28 @@ add_solution(G1, G2, String) :-
write_neg_sol
(
Stream
,
Tabint
,
N1
,
N2
),
close
(
Stream
).
% solve_sat(+Graph1,+Graph2)
%
% search and write a SEpi between the 2 input graphs
% /!\ this function use indirectly /tmp/in.sat
solve_sat
(
G1
,
G2
)
:-
run_glucose
(
'/tmp/in.sat'
),
open
(
'/tmp/out.sat'
,
read
,
Stream
,
[]),
read_string
(
Stream
,
'\n'
,
"\r"
,
_
,
String
),
((
String
=
"UNSAT"
,
write
(
'no sepi found\n'
));
(
split_string
(
String
,
" "
,
""
,
Tabint
)),
write_morph
(
Tabint
,
G1
,
G2
));
write
(
'no sepi found\n'
);
true
.
read_string
(
Stream
,
''
,
"\n\r"
,
_
,
String
),
(
(
String
=
"UNSAT"
,
write
(
'no sepi found\n'
)
)
;
(
split_string
(
String
,
" \n"
,
" \n"
,
Tabint
)
),
write_morph
(
Tabint
,
G1
,
G2
)
);
write
(
'no sepi found\n'
);
true
.
search_sepi
(
G1
,
G2
,
Stream
)
:-
open
(
'/tmp/in.sat'
,
write
,
Stream
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment