Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SAT4J
sat4j
Commits
8461e372
Commit
8461e372
authored
Apr 09, 2022
by
Daniel Le Berre
Browse files
fix for Eclipse p2 bug
#28
parent
b7b13afe
Pipeline
#20603
passed with stages
in 51 minutes and 19 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
org.sat4j.pb/src/main/java/org/sat4j/pb/reader/OPBEclipseReader2007.java
View file @
8461e372
...
...
@@ -30,6 +30,7 @@
package
org.sat4j.pb.reader
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
org.sat4j.core.VecInt
;
import
org.sat4j.pb.IPBSolver
;
...
...
@@ -43,8 +44,8 @@ import org.sat4j.specs.IVecInt;
public
class
OPBEclipseReader2007
extends
OPBReader2007
{
/**
*
*/
*
*/
private
static
final
long
serialVersionUID
=
1L
;
private
final
IVecInt
varExplain
=
new
VecInt
();
...
...
@@ -68,6 +69,12 @@ public class OPBEclipseReader2007 extends OPBReader2007 {
protected
void
endListOfVariables
()
{
}
@Override
protected
void
readMetaData
()
throws
IOException
,
ParseFormatException
{
super
.
readMetaData
();
startsMapping
();
}
/**
* read the list for variables explanation (if any) calls
* beginListOfVariables and endListOfVariables
...
...
@@ -76,8 +83,8 @@ public class OPBEclipseReader2007 extends OPBReader2007 {
* @throws ParseException
*/
@Override
protected
void
readVariablesExplanation
()
throws
IOException
,
ParseFormatException
{
protected
void
readVariablesExplanation
()
throws
IOException
,
ParseFormatException
{
char
c
;
StringBuilder
var
=
new
StringBuilder
();
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/reader/OPBReader2005.java
View file @
8461e372
...
...
@@ -715,7 +715,7 @@ public class OPBReader2005 extends Reader implements Serializable {
mapping
=
null
;
readMetaData
();
skipComments
();
if
(
mapping
!=
null
)
{
readVariablesExplanation
();
}
...
...
org.sat4j.pb/src/test/java/org/sat4j/pb/TestEclipseBugP228.java
0 → 100644
View file @
8461e372
package
org.sat4j.pb
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
org.junit.Test
;
import
org.sat4j.pb.reader.OPBEclipseReader2007
;
import
org.sat4j.reader.ParseFormatException
;
import
org.sat4j.reader.Reader
;
import
org.sat4j.specs.ContradictionException
;
import
org.sat4j.specs.TimeoutException
;
public
class
TestEclipseBugP228
{
private
static
final
String
OPB_FILE
=
"* #variable= 6 #constraint= 3 \n"
+
"*\n"
+
"\n"
+
"explain: x1 x2 x3 x4 x5 ;\n"
+
"\n"
+
"* P 1.0.0 requires either PP 1.0.0 \n"
+
"-1 x2 +1 x1 >= 0;\n"
+
"* 1223597333557 0.0.0.1223597333557 requires either P 1.0.0 \n"
+
"-1 x3 +1 x2 >= 0;\n"
+
"+1 x3 = 1;\n"
;
@Test
public
void
testExplain
()
throws
ParseFormatException
,
ContradictionException
,
IOException
,
TimeoutException
{
IPBSolver
solver
=
SolverFactory
.
newEclipseP2
();
Reader
reader
=
new
OPBEclipseReader2007
(
solver
);
reader
.
parseInstance
(
new
ByteArrayInputStream
(
OPB_FILE
.
getBytes
()));
assertTrue
(
solver
.
isSatisfiable
());
}
}
Write
Preview
Supports
Markdown
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