-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
MergeSat is a recent SAT solver that fits the MiniSat2 interface. To use MergeSat as a proper SAT backend, some extensions might be dropped. Especially being able to print memory usage is not helpful for CBMC, but requires pulling in a new dependency. Signed-off-by: Norbert Manthey <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,16 @@ ifneq ($(MINISAT2),) | |
CLEANFILES += $(MINISAT2_LIB) $(patsubst %$(OBJEXT), %$(DEPEXT), $(MINISAT2_LIB)) | ||
endif | ||
|
||
ifneq ($(MERGESAT),) | ||
# MergeSat is based on MiniSat2 and is invoked (with suitable defines/ifdefs) | ||
# via satcheck_minisat2.{h,cpp} | ||
MERGESAT_SRC=sat/satcheck_minisat2.cpp | ||
MERGESAT_INCLUDE=-I $(MERGESAT) | ||
MERGESAT_LIB=$(MERGESAT)/minisat/simp/SimpSolver$(OBJEXT) $(MERGESAT)/minisat/core/Solver$(OBJEXT) $(MERGESAT)/minisat/utils/ccnr$(OBJEXT) $(MERGESAT)/minisat/utils/Options$(OBJEXT) $(MERGESAT)/minisat/utils/System$(OBJEXT) | ||
CP_CXXFLAGS += -DHAVE_MERGESAT -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS | ||
CLEANFILES += $(MERGESAT_LIB) $(patsubst %$(OBJEXT), %$(DEPEXT), $(MERGESAT_LIB)) | ||
endif | ||
|
||
ifneq ($(IPASIR),) | ||
IPASIR_SRC=sat/satcheck_ipasir.cpp | ||
IPASIR_INCLUDE=-I $(IPASIR) | ||
|
@@ -74,6 +84,7 @@ SRC = $(BOOLEFORCE_SRC) \ | |
$(GLUCOSE_SRC) \ | ||
$(LINGELING_SRC) \ | ||
$(MINISAT2_SRC) \ | ||
$(MERGESAT_SRC) \ | ||
$(IPASIR_SRC) \ | ||
$(MINISAT_SRC) \ | ||
$(PICOSAT_SRC) \ | ||
|
@@ -226,6 +237,28 @@ $(MINISAT2)/minisat/core/Solver$(OBJEXT): $(MINISAT2)/minisat/core/Solver.cc | |
endif | ||
endif | ||
|
||
ifneq ($(MERGESAT),) | ||
ifeq ($(BUILD_ENV_),MSVC) | ||
sat/satcheck_minisat2$(OBJEXT): sat/satcheck_minisat2.cpp | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
|
||
$(MERGESAT)/minisat/utils/ccnr$(OBJEXT): $(MERGESAT)/minisat/utils/ccnr.cc | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
|
||
$(MERGESAT)/minisat/utils/Options$(OBJEXT): $(MERGESAT)/minisat/utils/Options.cc | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
|
||
$(MERGESAT)/minisat/utils/System$(OBJEXT): $(MERGESAT)/minisat/utils/System.cc | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
|
||
$(MERGESAT)/minisat/simp/SimpSolver$(OBJEXT): $(MERGESAT)/minisat/simp/SimpSolver.cc | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
|
||
$(MERGESAT)/minisat/core/Solver$(OBJEXT): $(MERGESAT)/minisat/core/Solver.cc | ||
$(CXX) $(CP_CXXFLAGS) /w /nologo /c /EHsc $< /Fo$@ | ||
This comment has been minimized.
Sorry, something went wrong.
nmanthey
Contributor
|
||
endif | ||
endif | ||
|
||
ifneq ($(GLUCOSE),) | ||
ifeq ($(BUILD_ENV_),MSVC) | ||
sat/satcheck_glucose$(OBJEXT): sat/satcheck_glucose.cpp | ||
|
@@ -241,6 +274,7 @@ endif | |
|
||
INCLUDES += -I .. \ | ||
$(CHAFF_INCLUDE) $(BOOLEFORCE_INCLUDE) $(MINISAT_INCLUDE) $(MINISAT2_INCLUDE) \ | ||
$(MERGESAT_INCLUDE) \ | ||
$(IPASIR_INCLUDE) \ | ||
$(SQUOLEM2_INC) $(CUDD_INCLUDE) $(GLUCOSE_INCLUDE) \ | ||
$(PICOSAT_INCLUDE) $(LINGELING_INCLUDE) $(CADICAL_INCLUDE) | ||
|
@@ -259,7 +293,7 @@ endif | |
endif | ||
|
||
SOLVER_LIB = $(CHAFF_LIB) $(BOOLEFORCE_LIB) $(MINISAT_LIB) \ | ||
$(MINISAT2_LIB) $(SQUOLEM2_LIB) $(CUDD_LIB) \ | ||
$(MINISAT2_LIB) $(MERGESAT_LIB) $(SQUOLEM2_LIB) $(CUDD_LIB) \ | ||
$(PICOSAT_LIB) $(LINGELING_LIB) $(GLUCOSE_LIB) $(CADICAL_LIB) | ||
|
||
SOLVER_OBJS = $(filter %$(OBJEXT), $(SOLVER_LIB)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ Author: Daniel Kroening, [email protected] | |
// #define SATCHECK_ZCHAFF | ||
// #define SATCHECK_MINISAT1 | ||
// #define SATCHECK_MINISAT2 | ||
// #define SATCHECK_MERGESAT | ||
// #define SATCHECK_GLUCOSE | ||
// #define SATCHECK_BOOLEFORCE | ||
// #define SATCHECK_PICOSAT | ||
|
@@ -39,6 +40,10 @@ Author: Daniel Kroening, [email protected] | |
#define SATCHECK_MINISAT2 | ||
#endif | ||
|
||
#if defined(HAVE_MERGESAT) && !defined(SATCHECK_MERGESAT) | ||
# define SATCHECK_MERGESAT | ||
#endif | ||
|
||
#if defined(HAVE_GLUCOSE) && !defined(SATCHECK_GLUCOSE) | ||
#define SATCHECK_GLUCOSE | ||
#endif | ||
|
@@ -80,9 +85,11 @@ typedef satcheck_booleforcet satcheck_no_simplifiert; | |
typedef satcheck_minisat1t satcheckt; | ||
typedef satcheck_minisat1t satcheck_no_simplifiert; | ||
|
||
#elif defined SATCHECK_MINISAT2 | ||
#elif defined SATCHECK_MINISAT2 || defined SATCHECK_MERGESAT | ||
// MergeSat is based on MiniSat2 and is invoked (with suitable defines/ifdefs) | ||
// via satcheck_minisat2.{h,cpp} | ||
|
||
#include "satcheck_minisat2.h" | ||
# include "satcheck_minisat2.h" | ||
|
||
typedef satcheck_minisat_simplifiert satcheckt; | ||
typedef satcheck_minisat_no_simplifiert satcheck_no_simplifiert; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,20 @@ Author: Daniel Kroening, [email protected] | |
# include <unistd.h> | ||
#endif | ||
|
||
#include <limits> | ||
|
||
#include <util/invariant.h> | ||
#include <util/make_unique.h> | ||
#include <util/threeval.h> | ||
|
||
#include <minisat/core/Solver.h> | ||
#include <minisat/simp/SimpSolver.h> | ||
|
||
#ifndef HAVE_MINISAT2 | ||
#error "Expected HAVE_MINISAT2" | ||
#include <cstdlib> | ||
#include <limits> | ||
|
||
// MergeSat is based on MiniSat2; variations in their API are handled via | ||
// #ifdefs | ||
#if !defined(HAVE_MINISAT2) && !defined(HAVE_MERGESAT) | ||
# error "Expected HAVE_MINISAT2 or HAVE_MERGESAT" | ||
#endif | ||
|
||
void convert(const bvt &bv, Minisat::vec<Minisat::Lit> &dest) | ||
|
@@ -77,7 +80,11 @@ void satcheck_minisat2_baset<T>::set_polarity(literalt a, bool value) | |
try | ||
{ | ||
add_variables(); | ||
#ifdef HAVE_MERGESAT | ||
solver->setPolarity(a.var_no(), value); | ||
#else | ||
solver->setPolarity(a.var_no(), value ? l_True : l_False); | ||
#endif | ||
} | ||
catch(Minisat::OutOfMemoryException) | ||
{ | ||
|
@@ -101,12 +108,20 @@ void satcheck_minisat2_baset<T>::clear_interrupt() | |
|
||
const std::string satcheck_minisat_no_simplifiert::solver_text() | ||
{ | ||
#ifdef HAVE_MERGESAT | ||
return "MergeSat 4.0-rc without simplifier"; | ||
#else | ||
return "MiniSAT 2.2.1 without simplifier"; | ||
#endif | ||
} | ||
|
||
const std::string satcheck_minisat_simplifiert::solver_text() | ||
{ | ||
#ifdef HAVE_MERGESAT | ||
return "MergeSat 4.0-rc with simplifier"; | ||
#else | ||
return "MiniSAT 2.2.1 with simplifier"; | ||
#endif | ||
} | ||
|
||
template<typename T> | ||
|
@@ -314,6 +329,10 @@ satcheck_minisat2_baset<T>::satcheck_minisat2_baset( | |
solver(util_make_unique<T>()), | ||
time_limit_seconds(0) | ||
{ | ||
#ifdef HAVE_MERGESAT | ||
int ret = setenv(MINISAT_RUNTIME_ARGS, "-no-grow-iter", 0); | ||
This comment has been minimized.
Sorry, something went wrong.
nmanthey
Contributor
|
||
CHECK_RETURN(ret == 0); | ||
#endif | ||
} | ||
|
||
template <typename T> | ||
|
nit: version "3.0" is not true