Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
sat4j
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
51
Issues
51
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SAT4J
sat4j
Commits
1813cebb
Commit
1813cebb
authored
Mar 01, 2018
by
Daniel Le Berre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using NullObject for tautological PB constraints.
parent
da498a78
Pipeline
#865
failed with stages
in 17 minutes and 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
8 deletions
+89
-8
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/IDataStructurePB.java
...in/java/org/sat4j/pb/constraints/pb/IDataStructurePB.java
+80
-0
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/Pseudos.java
...pb/src/main/java/org/sat4j/pb/constraints/pb/Pseudos.java
+9
-8
No files found.
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/IDataStructurePB.java
View file @
1813cebb
...
...
@@ -31,11 +31,91 @@ package org.sat4j.pb.constraints.pb;
import
java.math.BigInteger
;
import
org.sat4j.minisat.core.ILits
;
import
org.sat4j.minisat.core.VarActivityListener
;
import
org.sat4j.specs.IVec
;
import
org.sat4j.specs.IVecInt
;
public
interface
IDataStructurePB
{
IDataStructurePB
TAUTOLOGY
=
new
IDataStructurePB
()
{
@Override
public
int
size
()
{
return
0
;
}
@Override
public
BigInteger
saturation
()
{
return
BigInteger
.
ZERO
;
}
@Override
public
int
reduceCoeffsByPower2
()
{
return
0
;
}
@Override
public
boolean
isLongSufficient
()
{
return
true
;
}
@Override
public
boolean
isCardinality
()
{
return
true
;
}
@Override
public
BigInteger
getDegree
()
{
return
BigInteger
.
ZERO
;
}
@Override
public
BigInteger
getCardDegree
()
{
return
BigInteger
.
ZERO
;
}
@Override
public
int
getAssertiveLiteral
()
{
return
ILits
.
UNDEFINED
;
}
@Override
public
BigInteger
cuttingPlane
(
int
[]
lits
,
BigInteger
[]
reducedCoefs
,
BigInteger
degreeCons
,
BigInteger
coefMult
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
BigInteger
cuttingPlane
(
int
[]
lits
,
BigInteger
[]
reducedCoefs
,
BigInteger
deg
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
BigInteger
cuttingPlane
(
PBConstr
cpb
,
BigInteger
degreeCons
,
BigInteger
[]
reducedCoefs
,
BigInteger
coefMult
,
VarActivityListener
val
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
BigInteger
cuttingPlane
(
PBConstr
cpb
,
BigInteger
deg
,
BigInteger
[]
reducedCoefs
,
VarActivityListener
val
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
buildConstraintFromMapPb
(
int
[]
resLits
,
BigInteger
[]
resCoefs
)
{
}
@Override
public
void
buildConstraintFromConflict
(
IVecInt
resLits
,
IVec
<
BigInteger
>
resCoefs
)
{
}
};
BigInteger
saturation
();
BigInteger
cuttingPlane
(
PBConstr
cpb
,
BigInteger
deg
,
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/Pseudos.java
View file @
1813cebb
...
...
@@ -51,8 +51,8 @@ public abstract class Pseudos {
ps
.
copyTo
(
lits
);
BigInteger
[]
bc
=
new
BigInteger
[
bigCoefs
.
size
()];
bigCoefs
.
copyTo
(
bc
);
BigInteger
bigDegree
=
Pseudos
.
niceCheckedParametersForCompetition
(
lits
,
bc
,
moreThan
,
bigDeg
);
BigInteger
bigDegree
=
Pseudos
.
niceCheckedParametersForCompetition
(
lits
,
bc
,
moreThan
,
bigDeg
);
IDataStructurePB
mpb
=
new
MapPb
(
voc
.
nVars
()
*
2
+
2
);
if
(
bigDegree
.
signum
()
>
0
)
{
...
...
@@ -100,12 +100,12 @@ public abstract class Pseudos {
ILits
voc
)
throws
ContradictionException
{
// Ajouter les simplifications quand la structure sera d?finitive
if
(
ps
.
size
()
==
0
)
{
if
(
moreThan
&&
bigDeg
.
signum
()
>
0
||
!
moreThan
&&
bigDeg
.
signum
()
<
0
)
{
if
(
moreThan
&&
bigDeg
.
signum
()
>
0
||
!
moreThan
&&
bigDeg
.
signum
()
<
0
)
{
throw
new
ContradictionException
(
"Creating Empty clause ?"
);
}
// ignoring tautological constraint
return
null
;
return
IDataStructurePB
.
TAUTOLOGY
;
}
if
(
ps
.
size
()
!=
bigCoefs
.
size
())
{
throw
new
IllegalArgumentException
(
...
...
@@ -121,8 +121,8 @@ public abstract class Pseudos {
throws
ContradictionException
{
// Ajouter les simplifications quand la structure sera d?finitive
if
(
ps
.
length
==
0
)
{
if
(
moreThan
&&
bigDeg
.
signum
()
>
0
||
!
moreThan
&&
bigDeg
.
signum
()
<
0
)
{
if
(
moreThan
&&
bigDeg
.
signum
()
>
0
||
!
moreThan
&&
bigDeg
.
signum
()
<
0
)
{
throw
new
ContradictionException
(
"Creating Empty clause ?"
);
}
// ignoring tautological constraint
...
...
@@ -149,7 +149,8 @@ public abstract class Pseudos {
return
BigInteger
.
valueOf
(
i
);
}
public
static
ObjectiveFunction
normalizeObjective
(
ObjectiveFunction
initial
)
{
public
static
ObjectiveFunction
normalizeObjective
(
ObjectiveFunction
initial
)
{
IVec
<
BigInteger
>
initCoeffs
=
initial
.
getCoeffs
();
IVecInt
initLits
=
initial
.
getVars
();
assert
initCoeffs
.
size
()
==
initLits
.
size
();
...
...
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