Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
SAT4J
sat4j
Commits
c091d768
Commit
c091d768
authored
Jul 26, 2020
by
Daniel Le Berre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test case.
parent
ae418f13
Pipeline
#9098
passed with stages
in 111 minutes and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
org.sat4j.core/src/test/java/org/sat4j/minisat/constraints/TestXor.java
.../src/test/java/org/sat4j/minisat/constraints/TestXor.java
+9
-6
No files found.
org.sat4j.core/src/test/java/org/sat4j/minisat/constraints/TestXor.java
View file @
c091d768
...
...
@@ -85,11 +85,12 @@ public class TestXor {
IVecInt
lits
=
new
VecInt
(
new
int
[]
{
1
,
2
,
3
});
solver
.
addParity
(
lits
,
true
);
ModelIterator
iterator
=
new
ModelIterator
(
solver
);
int
[]
model
=
{};
while
(
iterator
.
isSatisfiable
())
{
iterator
.
model
();
// to go to the next model
model
=
iterator
.
model
();
// to go to the next model
}
assertEquals
(
4
,
iterator
.
numberOfModelsFoundSoFar
());
System
.
out
.
println
(
new
VecInt
(
solver
.
model
()
));
System
.
out
.
println
(
new
VecInt
(
model
));
}
@Test
...
...
@@ -104,11 +105,12 @@ public class TestXor {
clause
.
push
(-
1
).
push
(-
3
);
solver
.
addClause
(
clause
);
ModelIterator
iterator
=
new
ModelIterator
(
solver
);
int
[]
model
=
{};
while
(
iterator
.
isSatisfiable
())
{
iterator
.
model
();
// to go to the next model
model
=
iterator
.
model
();
// to go to the next model
}
assertEquals
(
2
,
iterator
.
numberOfModelsFoundSoFar
());
System
.
out
.
println
(
new
VecInt
(
solver
.
model
()
));
System
.
out
.
println
(
new
VecInt
(
model
));
}
@Test
...
...
@@ -119,10 +121,11 @@ public class TestXor {
solver
.
addParity
(
lits
,
true
);
solver
.
addAtLeast
(
lits
,
1
);
ModelIterator
iterator
=
new
ModelIterator
(
solver
);
int
[]
model
=
{};
while
(
iterator
.
isSatisfiable
())
{
iterator
.
model
();
// to go to the next model
model
=
iterator
.
model
();
// to go to the next model
}
assertEquals
(
3
,
iterator
.
numberOfModelsFoundSoFar
());
System
.
out
.
println
(
new
VecInt
(
solver
.
model
()
));
System
.
out
.
println
(
new
VecInt
(
model
));
}
}
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