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
3dfc50b4
Commit
3dfc50b4
authored
Aug 27, 2018
by
Daniel Le Berre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow MaxHS to be used on the command line of the maxsat solver (-hs
option).
parent
ca8ba743
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
5 deletions
+28
-5
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/GenericOptLauncher.java
...at/src/main/java/org/sat4j/maxsat/GenericOptLauncher.java
+10
-5
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/MaxHSLikeSolver.java
...axsat/src/main/java/org/sat4j/maxsat/MaxHSLikeSolver.java
+13
-0
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/SolverFactory.java
....maxsat/src/main/java/org/sat4j/maxsat/SolverFactory.java
+5
-0
No files found.
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/GenericOptLauncher.java
View file @
3dfc50b4
...
...
@@ -86,7 +86,8 @@ public class GenericOptLauncher extends AbstractLauncher {
"kind of problem: minone, maxsat, etc."
);
options
.
addOption
(
"i"
,
"incomplete"
,
false
,
"incomplete mode for maxsat"
);
options
.
addOption
(
"I"
,
"inner mode"
,
false
,
"optimize using inner mode"
);
options
.
addOption
(
"I"
,
"inner mode"
,
false
,
"optimize using inner mode"
);
options
.
addOption
(
"c"
,
"clean databases"
,
false
,
"clean up the database at root level"
);
options
.
addOption
(
"k"
,
"keep Hot"
,
false
,
...
...
@@ -99,8 +100,11 @@ public class GenericOptLauncher extends AbstractLauncher {
"Do not display a solution line (useful if the solution is large)"
);
options
.
addOption
(
"l"
,
"lower bounding"
,
false
,
"search solution by lower bounding instead of by upper bounding"
);
options
.
addOption
(
"hs"
,
"MaxHS Like"
,
false
,
"search solution using a MaxHS like approach"
);
options
.
addOption
(
"m"
,
"mystery"
,
false
,
"mystery option"
);
options
.
addOption
(
"B"
,
"External&Internal"
,
false
,
"External&Internal optimization"
);
options
.
addOption
(
"B"
,
"External&Internal"
,
false
,
"External&Internal optimization"
);
return
options
;
}
...
...
@@ -127,7 +131,6 @@ public class GenericOptLauncher extends AbstractLauncher {
return
reader
;
}
@Override
protected
String
getInstanceName
(
String
[]
args
)
{
return
args
[
args
.
length
-
1
];
...
...
@@ -179,6 +182,9 @@ public class GenericOptLauncher extends AbstractLauncher {
if
(
cmd
.
hasOption
(
"l"
))
{
asolver
=
new
ConstraintRelaxingPseudoOptDecorator
(
this
.
wmsd
);
}
else
if
(
cmd
.
hasOption
(
"hs"
))
{
asolver
=
org
.
sat4j
.
maxsat
.
SolverFactory
.
newMaxHSLike
();
setLauncherMode
(
ILauncherMode
.
DECISION
);
}
else
if
(
cmd
.
hasOption
(
"I"
)){
this
.
wmsd
.
setSearchListener
(
new
SearchOptimizerListener
(
ILauncherMode
.
DECISION
));
setLauncherMode
(
ILauncherMode
.
DECISION
);
...
...
@@ -231,8 +237,7 @@ public class GenericOptLauncher extends AbstractLauncher {
@Override
protected
IProblem
readProblem
(
String
problemname
)
throws
ParseFormatException
,
IOException
,
ContradictionException
{
throws
ParseFormatException
,
IOException
,
ContradictionException
{
super
.
readProblem
(
problemname
);
return
solver
;
}
...
...
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/MaxHSLikeSolver.java
View file @
3dfc50b4
...
...
@@ -220,6 +220,9 @@ public class MaxHSLikeSolver extends SolverDecorator<ISolver>
public
boolean
isSatisfiable
()
throws
TimeoutException
{
IVecInt
hs
=
new
VecInt
(
hsfinder
.
findModel
());
while
(!
decorated
().
isSatisfiable
(
hs
))
{
if
(
isVerbose
())
{
System
.
out
.
print
(
"."
);
}
IVecInt
core
=
decorated
().
unsatExplanation
();
IVecInt
clause
=
new
VecInt
(
core
.
size
());
for
(
IteratorInt
it
=
core
.
iterator
();
it
.
hasNext
();)
{
...
...
@@ -245,4 +248,14 @@ public class MaxHSLikeSolver extends SolverDecorator<ISolver>
return
hsfinder
.
getObjectiveFunction
().
calculateDegree
(
hsfinder
);
}
@Override
public
String
toString
(
String
prefix
)
{
return
prefix
+
"MaxHS like optimization"
+
System
.
lineSeparator
()+
super
.
toString
(
prefix
);
}
@Override
public
String
toString
()
{
return
"MaxHS like optimization "
+
super
.
toString
();
}
}
org.sat4j.maxsat/src/main/java/org/sat4j/maxsat/SolverFactory.java
View file @
3dfc50b4
...
...
@@ -38,6 +38,7 @@ import org.sat4j.minisat.learning.MiniSATLearning;
import
org.sat4j.minisat.orders.VarOrderHeap
;
import
org.sat4j.minisat.restarts.MiniSATRestarts
;
import
org.sat4j.pb.IPBSolver
;
import
org.sat4j.specs.ISolver
;
public
class
SolverFactory
extends
ASolverFactory
<
IPBSolver
>
{
...
...
@@ -105,4 +106,8 @@ public class SolverFactory extends ASolverFactory<IPBSolver> {
public
static
IPBSolver
newLight
()
{
return
org
.
sat4j
.
pb
.
SolverFactory
.
newLight
();
}
public
static
ISolver
newMaxHSLike
()
{
return
new
MaxHSLikeSolver
(
newDefault
(),
newDefault
());
}
}
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