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
6d880cc4
Commit
6d880cc4
authored
Jul 28, 2020
by
Romain Wallon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds more statistics to the different LCDSs.
parent
408542ef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
11 deletions
+52
-11
org.sat4j.core/src/main/java/org/sat4j/minisat/core/ActivityLCDS.java
...re/src/main/java/org/sat4j/minisat/core/ActivityLCDS.java
+8
-3
org.sat4j.pb/src/main/java/org/sat4j/pb/core/PBSolverStats.java
...t4j.pb/src/main/java/org/sat4j/pb/core/PBSolverStats.java
+2
-2
org.sat4j.pb/src/main/java/org/sat4j/pb/lcds/PBActivityLCDS.java
...4j.pb/src/main/java/org/sat4j/pb/lcds/PBActivityLCDS.java
+39
-0
org.sat4j.sat/src/main/java/org/sat4j/sat/KTHLauncher.java
org.sat4j.sat/src/main/java/org/sat4j/sat/KTHLauncher.java
+3
-6
No files found.
org.sat4j.core/src/main/java/org/sat4j/minisat/core/ActivityLCDS.java
View file @
6d880cc4
...
...
@@ -34,12 +34,12 @@ import org.sat4j.specs.Constr;
import
org.sat4j.specs.IVec
;
@Feature
(
value
=
"deletion"
,
parent
=
"expert"
)
final
class
ActivityLCDS
implements
LearnedConstraintsDeletionStrategy
{
public
class
ActivityLCDS
implements
LearnedConstraintsDeletionStrategy
{
private
static
final
long
serialVersionUID
=
1L
;
private
final
ConflictTimer
timer
;
pr
ivate
final
Solver
<?
extends
DataStructureFactory
>
solver
;
pr
otected
final
Solver
<?
extends
DataStructureFactory
>
solver
;
ActivityLCDS
(
Solver
<?
extends
DataStructureFactory
>
solver
,
public
ActivityLCDS
(
Solver
<?
extends
DataStructureFactory
>
solver
,
ConflictTimer
timer
)
{
this
.
timer
=
timer
;
this
.
solver
=
solver
;
...
...
@@ -53,6 +53,7 @@ final class ActivityLCDS implements LearnedConstraintsDeletionStrategy {
if
(
c
.
locked
()
||
c
.
size
()
==
2
)
{
learnedConstrs
.
set
(
j
++,
learnedConstrs
.
get
(
i
));
}
else
{
onRemove
(
c
);
c
.
remove
(
solver
);
solver
.
slistener
.
delete
(
c
);
}
...
...
@@ -97,4 +98,8 @@ final class ActivityLCDS implements LearnedConstraintsDeletionStrategy {
public
void
onPropagation
(
Constr
from
)
{
// do nothing
}
protected
void
onRemove
(
Constr
c
)
{
// Nothing to do by default.
}
}
\ No newline at end of file
org.sat4j.pb/src/main/java/org/sat4j/pb/core/PBSolverStats.java
View file @
6d880cc4
...
...
@@ -282,7 +282,7 @@ public class PBSolverStats extends SolverStats {
}
public
void
setMinRemoved
(
BigInteger
minRemoved
)
{
if
(
minRemoved
==
null
)
{
if
(
this
.
minRemoved
==
null
)
{
this
.
minRemoved
=
minRemoved
;
}
else
{
this
.
minRemoved
=
this
.
minRemoved
.
min
(
minRemoved
);
...
...
@@ -290,7 +290,7 @@ public class PBSolverStats extends SolverStats {
}
public
void
setMaxRemoved
(
BigInteger
maxRemoved
)
{
if
(
maxRemoved
==
null
)
{
if
(
this
.
maxRemoved
==
null
)
{
this
.
maxRemoved
=
maxRemoved
;
}
else
{
this
.
maxRemoved
=
this
.
maxRemoved
.
max
(
maxRemoved
);
...
...
org.sat4j.pb/src/main/java/org/sat4j/pb/lcds/PBActivityLCDS.java
0 → 100644
View file @
6d880cc4
/**
*
*/
package
org.sat4j.pb.lcds
;
import
org.sat4j.minisat.core.ActivityLCDS
;
import
org.sat4j.minisat.core.ConflictTimer
;
import
org.sat4j.minisat.core.DataStructureFactory
;
import
org.sat4j.minisat.core.Solver
;
import
org.sat4j.pb.constraints.pb.PBConstr
;
import
org.sat4j.pb.core.PBSolverStats
;
import
org.sat4j.specs.Constr
;
/**
* @author romain
*
*/
public
class
PBActivityLCDS
extends
ActivityLCDS
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
public
PBActivityLCDS
(
Solver
<?
extends
DataStructureFactory
>
solver
,
ConflictTimer
timer
)
{
super
(
solver
,
timer
);
}
@Override
protected
void
onRemove
(
Constr
c
)
{
PBConstr
constr
=
(
PBConstr
)
c
;
PBSolverStats
stats
=
(
PBSolverStats
)
solver
.
getStats
();
stats
.
incNbRemoved
();
stats
.
setMinRemoved
(
constr
.
getDegree
());
stats
.
setMaxRemoved
(
constr
.
getDegree
());
}
}
org.sat4j.sat/src/main/java/org/sat4j/sat/KTHLauncher.java
View file @
6d880cc4
...
...
@@ -42,6 +42,7 @@ import org.sat4j.pb.constraints.pb.PreProcessReduceConflict;
import
org.sat4j.pb.constraints.pb.SkipStrategy
;
import
org.sat4j.pb.core.PBDataStructureFactory
;
import
org.sat4j.pb.core.PBSolverCP
;
import
org.sat4j.pb.lcds.PBActivityLCDS
;
import
org.sat4j.pb.lcds.PBGlucoseLCDS
;
import
org.sat4j.pb.orders.BumpStrategy
;
import
org.sat4j.pb.orders.Bumper
;
...
...
@@ -424,6 +425,8 @@ public class KTHLauncher {
String
value
=
line
.
getOptionValue
(
"deletion-strategy"
);
ConflictTimer
timer
=
cpsolver
.
lbd_based
.
getTimer
();
if
(
"activity"
.
equals
(
value
))
{
LearnedConstraintsDeletionStrategy
lcds
=
new
PBActivityLCDS
(
cpsolver
,
timer
);
cpsolver
.
setLearnedConstraintsDeletionStrategy
(
lcds
);
}
else
if
(
"assigned"
.
equals
(
value
))
{
LearnedConstraintsDeletionStrategy
lcds
=
PBGlucoseLCDS
.
newIgnoreUnassigned
(
cpsolver
,
timer
);
...
...
@@ -445,12 +448,6 @@ public class KTHLauncher {
LearnedConstraintsDeletionStrategy
lcds
=
PBGlucoseLCDS
.
newDegree
(
cpsolver
,
timer
);
cpsolver
.
setLearnedConstraintsDeletionStrategy
(
lcds
);
}
else
if
(
"size"
.
equals
(
value
))
{
cpsolver
.
setLearnedConstraintsDeletionStrategy
(
cpsolver
.
size_based
);
}
else
if
(
"age"
.
equals
(
value
))
{
cpsolver
.
setLearnedConstraintsDeletionStrategy
(
cpsolver
.
age_based
);
}
else
{
log
(
value
+
" is not a supported value for option deletion-strategy"
);
...
...
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