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
a829c090
Commit
a829c090
authored
Oct 29, 2018
by
Daniel Le Berre
Browse files
Make explicit call to IConflict.setDecisionLevel()
parent
b4a97f9e
Pipeline
#3234
failed with stages
in 45 minutes and 15 seconds
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/ConflictMap.java
View file @
a829c090
...
...
@@ -574,6 +574,11 @@ public class ConflictMap extends MapPb implements IConflict {
return
isImplyingLiteral
(
slack
,
dl
);
}
public
void
setDecisionLevel
(
int
dl
)
{
assert
dl
<=
this
.
currentLevel
;
this
.
currentLevel
=
dl
;
}
/**
* tests if the conflict is unsatisfiable
*
...
...
@@ -586,7 +591,8 @@ public class ConflictMap extends MapPb implements IConflict {
// given the slack already computed, tests if a literal could be implied at
// a particular level
// uses the byLevel data structure to parse each literal by decision level
private
boolean
isImplyingLiteral
(
BigInteger
slack
,
int
currentDecisionLevel
)
{
private
boolean
isImplyingLiteral
(
BigInteger
slack
,
int
currentDecisionLevel
)
{
// unassigned literals are tried first
int
unassigned
=
levelToIndex
(-
1
);
int
lit
;
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/IConflict.java
View file @
a829c090
...
...
@@ -54,6 +54,8 @@ public interface IConflict extends IDataStructurePB {
boolean
isAssertive
(
int
dl
);
void
setDecisionLevel
(
int
dl
);
boolean
isUnsat
();
/**
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/PostProcessToCard.java
View file @
a829c090
...
...
@@ -54,6 +54,7 @@ public class PostProcessToCard implements IPostProcess {
&&
(!
conflictMap
.
degree
.
equals
(
BigInteger
.
ONE
)))
{
int
lit
,
litLevel
,
ilit
;
BigInteger
coefLit
;
conflictMap
.
setDecisionLevel
(
dl
);
if
(
conflictMap
.
assertiveLiteral
!=
-
1
)
{
conflictMap
.
assertiveLiteral
=
this
.
chooseAssertiveLiteral
(
dl
,
conflictMap
);
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/constraints/pb/PostProcessToClause.java
View file @
a829c090
...
...
@@ -51,6 +51,7 @@ public class PostProcessToClause implements IPostProcess {
if
(
conflictMap
.
isAssertive
(
dl
)
&&
(!
conflictMap
.
degree
.
equals
(
BigInteger
.
ONE
)))
{
int
litLevel
,
ilit
;
conflictMap
.
setDecisionLevel
(
dl
);
if
(
conflictMap
.
assertiveLiteral
!=
-
1
)
{
conflictMap
.
assertiveLiteral
=
this
.
chooseAssertiveLiteral
(
dl
,
conflictMap
);
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/core/PBSolverCP.java
View file @
a829c090
...
...
@@ -144,6 +144,7 @@ public class PBSolverCP extends PBSolver {
}
PBConstr
constraint
=
(
PBConstr
)
this
.
voc
.
getReason
(
litImplied
);
// result of the resolution is in the conflict (confl)
confl
.
setDecisionLevel
(
currentLevel
);
confl
.
resolve
(
constraint
,
litImplied
,
this
);
updateNumberOfReductions
(
confl
);
assert
confl
.
slackConflict
().
signum
()
<
0
;
...
...
@@ -171,6 +172,7 @@ public class PBSolverCP extends PBSolver {
||
decisionLevel
()
==
0
||
confl
.
isUnsat
();
assert
currentLevel
==
decisionLevel
();
confl
.
setDecisionLevel
(
currentLevel
);
confl
.
undoOne
(
this
.
trail
.
last
());
undoOne
();
this
.
qhead
=
this
.
trail
.
size
();
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/tools/InprocCardConstrLearningSolver.java
View file @
a829c090
...
...
@@ -182,6 +182,7 @@ public class InprocCardConstrLearningSolver extends PBSolverCP {
constraint
=
(
PBConstr
)
extendedConstr
;
}
// result of the resolution is in the conflict (confl)
confl
.
setDecisionLevel
(
currentLevel
);
confl
.
resolve
(
constraint
,
litImplied
,
this
);
updateNumberOfReductions
(
confl
);
assert
confl
.
slackConflict
().
signum
()
<
0
;
...
...
@@ -210,6 +211,7 @@ public class InprocCardConstrLearningSolver extends PBSolverCP {
||
decisionLevel
()
==
0
;
assert
currentLevel
==
decisionLevel
();
confl
.
setDecisionLevel
(
currentLevel
);
undoOne
();
this
.
qhead
=
this
.
trail
.
size
();
updateNumberOfReducedLearnedConstraints
(
confl
);
...
...
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