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
Kučera Petr RNDr. Ph.D.
PCCompile
Commits
1c242551
Commit
1c242551
authored
Jan 28, 2022
by
Kučera Petr RNDr. Ph.D.
Browse files
Cadical can be used for PC checks
parent
7352f9a6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
1c242551
...
...
@@ -14,13 +14,13 @@ build:
mkdir
build
cmake
:
build
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
..
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
-DUSE_CADICAL
=
$(USE_CADICAL)
..
cmake_debug
:
build
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
Debug
-DUSE_KISSAT
=
$(USE_KISSAT)
..
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
Debug
-DUSE_KISSAT
=
$(USE_KISSAT)
-DUSE_CADICAL
=
$(USE_CADICAL)
..
cmake_static
:
build
cd
build
&&
cmake
-DBUILD_STATIC
=
ON
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
..
cd
build
&&
cmake
-DBUILD_STATIC
=
ON
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
-DUSE_CADICAL
=
$(USE_CADICAL)
..
cmake_subool_glucose
:
build
cd
build
&&
cmake
-DBUILD_SUBOOL_GLUCOSE
=
ON
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
..
cd
build
&&
cmake
-DBUILD_SUBOOL_GLUCOSE
=
ON
-DCMAKE_BUILD_TYPE
=
Release
-DUSE_KISSAT
=
$(USE_KISSAT)
-DUSE_CADICAL
=
$(USE_CADICAL)
..
bin/CMakeLists.txt
View file @
1c242551
cmake_minimum_required
(
VERSION 3.0.2
)
function
(
su_add_exec_x name use_
glucose
use_kissat
)
function
(
su_add_exec_x name use_
inc_solver
use_kissat
)
set
(
ATE_LIBS subool
)
if
(
${
use_
glucose
}
)
if
(
${
use_
inc_solver
}
)
su_add_glucose_lib
(
ATE_LIBS
)
su_add_cadical_lib
(
ATE_LIBS
)
endif
()
if
(
${
use_kissat
}
)
su_add_kissat_lib
(
ATE_LIBS
)
...
...
lib/pcchecker.cpp
View file @
1c242551
...
...
@@ -79,9 +79,9 @@ SUBool::AbsCheckerSAT::FindEmpoweringWithLevel(const CNF &cnf,
logs
.
TLog
(
3
)
<<
"[AbsCheckerSAT::FindEmpoweringWithLevel] level="
<<
(
level
==
0
?
mMaxUPLevel
:
level
)
<<
", input cnf "
<<
cnf
.
MaxVariable
()
<<
" "
<<
cnf
.
Size
()
<<
std
::
endl
;
auto
wrap
=
solver_wrapper
(
mSolverType
,
assume_sat
?
SolverInterface
::
ADAPTATION
::
LIKELY_SAT
:
SolverInterface
::
ADAPTATION
::
LIKELY_UNSAT
);
auto
wrap
=
solver_wrapper
(
mSolverType
,
false
,
assume_sat
?
SolverInterface
::
ADAPTATION
::
LIKELY_SAT
:
SolverInterface
::
ADAPTATION
::
LIKELY_UNSAT
);
auto
&
g
=
wrap
.
Solver
();
enc
->
PassToSolver
(
g
);
logs
.
TLog
(
3
)
<<
"... Calling SAT with encoding (p cnf "
<<
enc
->
MaxVariable
()
...
...
lib/solver_bind.cpp
View file @
1c242551
...
...
@@ -6,6 +6,7 @@
* Binding class to solver library. */
#include "solver_bind.h"
#include "cadical_bind.h"
#include "glucose_bind.h"
#include "kissat_bind.h"
#include "util.h"
...
...
@@ -20,11 +21,24 @@ const SUBool::EnumAnnotation<SUBool::SOLVER_TYPE> SUBool::kSolverTypeAnnotation(
{
SOLVER_TYPE
::
GLUCOSE
,
"glucose"
,
"use glucose."
}
#if HAS_CADICAL
,
{
SOLVER_TYPE
::
CADICAL
,
"cadical"
,
"use cadical."
}
#endif
#if HAS_KISSAT
,
{
SOLVER_TYPE
::
KISSAT
,
"kissat"
,
"use kissat."
}
#endif
});
const
SUBool
::
EnumAnnotation
<
SUBool
::
INC_SOLVER_TYPE
>
SUBool
::
kIncSolverTypeAnnotation
(
"INC_SOLVER_TYPE"
,
{
//
{
INC_SOLVER_TYPE
::
GLUCOSE
,
"glucose"
,
"use glucose."
}
#if HAS_CADICAL
,
{
INC_SOLVER_TYPE
::
CADICAL
,
"cadical"
,
"use cadical."
}
#endif
});
bool
SUBool
::
SolverInterface
::
AddClauses
(
const
std
::
vector
<
Clause
>
&
clauses
)
{
...
...
@@ -61,13 +75,20 @@ SUBool::SolverPool::InterruptInThread(std::thread::id thread_id)
}
SUBool
::
AbsSolverWrapper
SUBool
::
solver_wrapper
(
SOLVER_TYPE
solver_type
,
SolverInterface
::
ADAPTATION
adapt
)
SUBool
::
solver_wrapper
(
SOLVER_TYPE
solver_type
,
bool
collect_learnts
[[
maybe_unused
]]
,
SolverInterface
::
ADAPTATION
adapt
)
{
switch
(
solver_type
)
{
case
SOLVER_TYPE
::
GLUCOSE
:
return
SimpSolverWrapper
(
adapt
);
case
SOLVER_TYPE
::
CADICAL
:
#if HAS_CADICAL
return
CadicalWrapper
(
collect_learnts
,
adapt
);
#else
throw
BadParameterException
(
"AbsCheckerSAT::NewSolverWrapper"
,
"Cadical support not available"
);
#endif
case
SOLVER_TYPE
::
KISSAT
:
#if HAS_KISSAT
return
KissatSolverWrapper
(
adapt
);
...
...
lib/solver_bind.h
View file @
1c242551
...
...
@@ -227,13 +227,21 @@ namespace SUBool
enum
class
SOLVER_TYPE
{
GLUCOSE
,
CADICAL
,
KISSAT
};
enum
class
INC_SOLVER_TYPE
{
GLUCOSE
,
CADICAL
};
extern
const
EnumAnnotation
<
SOLVER_TYPE
>
kSolverTypeAnnotation
;
extern
const
EnumAnnotation
<
INC_SOLVER_TYPE
>
kIncSolverTypeAnnotation
;
AbsSolverWrapper
solver_wrapper
(
SOLVER_TYPE
solver_type
,
SolverInterface
::
ADAPTATION
adapt
);
AbsSolverWrapper
solver_wrapper
(
SOLVER_TYPE
solver_type
,
bool
collect_learnts
,
SolverInterface
::
ADAPTATION
adapt
);
template
<
class
S
>
class
SolverWrapperTemplate
:
public
AbsSolverWrapper
{
...
...
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