Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
f68bd519
Commit
f68bd519
authored
Sep 06, 2017
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrating Glucose into &bmcs -g.
parent
8063887f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
132 additions
and
42 deletions
+132
-42
src/base/abci/abc.c
+11
-5
src/sat/bmc/bmc.h
+1
-0
src/sat/bmc/bmcBmcG.c
+0
-0
src/sat/bmc/module.make
+1
-0
src/sat/glucose/AbcGlucose.cpp
+81
-11
src/sat/glucose/AbcGlucose.h
+26
-11
src/sat/glucose/AbcGlucoseCmd.cpp
+5
-8
src/sat/glucose/Glucose.cpp
+7
-7
No files found.
src/base/abci/abc.c
View file @
f68bd519
...
@@ -39998,6 +39998,7 @@ usage:
...
@@ -39998,6 +39998,7 @@ usage:
int
Abc_CommandAbc9SBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandAbc9SBmc
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
int
Bmcs_ManPerform
(
Gia_Man_t
*
pGia
,
Bmc_AndPar_t
*
pPars
);
extern
int
Bmcs_ManPerform
(
Gia_Man_t
*
pGia
,
Bmc_AndPar_t
*
pPars
);
extern
int
Bmcg_ManPerform
(
Gia_Man_t
*
pGia
,
Bmc_AndPar_t
*
pPars
);
Bmc_AndPar_t
Pars
,
*
pPars
=
&
Pars
;
int
c
;
Bmc_AndPar_t
Pars
,
*
pPars
=
&
Pars
;
int
c
;
memset
(
pPars
,
0
,
sizeof
(
Bmc_AndPar_t
)
);
memset
(
pPars
,
0
,
sizeof
(
Bmc_AndPar_t
)
);
pPars
->
nStart
=
0
;
// starting timeframe
pPars
->
nStart
=
0
;
// starting timeframe
...
@@ -40011,6 +40012,7 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -40011,6 +40012,7 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
fDumpFrames
=
0
;
// dump unrolled timeframes
pPars
->
fDumpFrames
=
0
;
// dump unrolled timeframes
pPars
->
fUseSynth
=
0
;
// use synthesis
pPars
->
fUseSynth
=
0
;
// use synthesis
pPars
->
fUseOldCnf
=
0
;
// use old CNF construction
pPars
->
fUseOldCnf
=
0
;
// use old CNF construction
pPars
->
fUseGlucose
=
0
;
// use Glucose 3.0
pPars
->
fVerbose
=
0
;
// verbose
pPars
->
fVerbose
=
0
;
// verbose
pPars
->
fVeryVerbose
=
0
;
// very verbose
pPars
->
fVeryVerbose
=
0
;
// very verbose
pPars
->
fNotVerbose
=
0
;
// skip line-by-line print-out
pPars
->
fNotVerbose
=
0
;
// skip line-by-line print-out
...
@@ -40020,7 +40022,7 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -40020,7 +40022,7 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars
->
pFuncOnFrameDone
=
pAbc
->
pFuncOnFrameDone
;
// frame done callback
pPars
->
pFuncOnFrameDone
=
pAbc
->
pFuncOnFrameDone
;
// frame done callback
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"PCFATvwh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"PCFAT
g
vwh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -40079,6 +40081,9 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -40079,6 +40081,9 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
pPars
->
nTimeOut
<
0
)
if
(
pPars
->
nTimeOut
<
0
)
goto
usage
;
goto
usage
;
break
;
break
;
case
'g'
:
pPars
->
fUseGlucose
^=
1
;
break
;
case
'v'
:
case
'v'
:
pPars
->
fVerbose
^=
1
;
pPars
->
fVerbose
^=
1
;
break
;
break
;
...
@@ -40096,24 +40101,25 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -40096,24 +40101,25 @@ int Abc_CommandAbc9SBmc( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print
(
-
1
,
"Abc_CommandAbc9Bmcs(): There is no AIG.
\n
"
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9Bmcs(): There is no AIG.
\n
"
);
return
0
;
return
0
;
}
}
if
(
pPars
->
nProcs
>
3
)
if
(
pPars
->
nProcs
>
4
)
{
{
Abc_Print
(
-
1
,
"Abc_CommandAbc9Bmcs(): Currently this command can run at most
3
concurrent solvers.
\n
"
);
Abc_Print
(
-
1
,
"Abc_CommandAbc9Bmcs(): Currently this command can run at most
4
concurrent solvers.
\n
"
);
return
0
;
return
0
;
}
}
pAbc
->
Status
=
Bmcs_ManPerform
(
pAbc
->
pGia
,
pPars
);
pAbc
->
Status
=
pPars
->
fUseGlucose
?
Bmcg_ManPerform
(
pAbc
->
pGia
,
pPars
)
:
Bmcs_ManPerform
(
pAbc
->
pGia
,
pPars
);
pAbc
->
nFrames
=
pPars
->
iFrame
;
pAbc
->
nFrames
=
pPars
->
iFrame
;
Abc_FrameReplaceCex
(
pAbc
,
&
pAbc
->
pGia
->
pCexSeq
);
Abc_FrameReplaceCex
(
pAbc
,
&
pAbc
->
pGia
->
pCexSeq
);
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: &bmcs [-PCFAT num] [-vwh]
\n
"
);
Abc_Print
(
-
2
,
"usage: &bmcs [-PCFAT num] [-
g
vwh]
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs bounded model checking
\n
"
);
Abc_Print
(
-
2
,
"
\t
performs bounded model checking
\n
"
);
Abc_Print
(
-
2
,
"
\t
-P num : the number of parallel solvers [default = %d]
\n
"
,
pPars
->
nProcs
);
Abc_Print
(
-
2
,
"
\t
-P num : the number of parallel solvers [default = %d]
\n
"
,
pPars
->
nProcs
);
Abc_Print
(
-
2
,
"
\t
-C num : the SAT solver conflict limit [default = %d]
\n
"
,
pPars
->
nConfLimit
);
Abc_Print
(
-
2
,
"
\t
-C num : the SAT solver conflict limit [default = %d]
\n
"
,
pPars
->
nConfLimit
);
Abc_Print
(
-
2
,
"
\t
-F num : the maximum number of timeframes [default = %d]
\n
"
,
pPars
->
nFramesMax
);
Abc_Print
(
-
2
,
"
\t
-F num : the maximum number of timeframes [default = %d]
\n
"
,
pPars
->
nFramesMax
);
Abc_Print
(
-
2
,
"
\t
-A num : the number of additional frames to unroll [default = %d]
\n
"
,
pPars
->
nFramesAdd
);
Abc_Print
(
-
2
,
"
\t
-A num : the number of additional frames to unroll [default = %d]
\n
"
,
pPars
->
nFramesAdd
);
Abc_Print
(
-
2
,
"
\t
-T num : approximate timeout in seconds [default = %d]
\n
"
,
pPars
->
nTimeOut
);
Abc_Print
(
-
2
,
"
\t
-T num : approximate timeout in seconds [default = %d]
\n
"
,
pPars
->
nTimeOut
);
Abc_Print
(
-
2
,
"
\t
-g : toggle using Glucose 3.0 [default = %s]
\n
"
,
pPars
->
fUseGlucose
?
"Glucose"
:
"Satoko"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
pPars
->
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-v : toggle printing verbose information [default = %s]
\n
"
,
pPars
->
fVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-w : toggle printing information about unfolding [default = %s]
\n
"
,
pPars
->
fVeryVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-w : toggle printing information about unfolding [default = %s]
\n
"
,
pPars
->
fVeryVerbose
?
"yes"
:
"no"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
src/sat/bmc/bmc.h
View file @
f68bd519
...
@@ -93,6 +93,7 @@ struct Bmc_AndPar_t_
...
@@ -93,6 +93,7 @@ struct Bmc_AndPar_t_
int
fDumpFrames
;
// dump unrolled timeframes
int
fDumpFrames
;
// dump unrolled timeframes
int
fUseSynth
;
// use synthesis
int
fUseSynth
;
// use synthesis
int
fUseOldCnf
;
// use old CNF construction
int
fUseOldCnf
;
// use old CNF construction
int
fUseGlucose
;
// use Glucose 3.0 as the default solver
int
fVerbose
;
// verbose
int
fVerbose
;
// verbose
int
fVeryVerbose
;
// very verbose
int
fVeryVerbose
;
// very verbose
int
fNotVerbose
;
// skip line-by-line print-out
int
fNotVerbose
;
// skip line-by-line print-out
...
...
src/sat/bmc/bmcBmcG.c
0 → 100644
View file @
f68bd519
This diff is collapsed.
Click to expand it.
src/sat/bmc/module.make
View file @
f68bd519
...
@@ -4,6 +4,7 @@ SRC += src/sat/bmc/bmcBCore.c \
...
@@ -4,6 +4,7 @@ SRC += src/sat/bmc/bmcBCore.c \
src/sat/bmc/bmcBmc3.c
\
src/sat/bmc/bmcBmc3.c
\
src/sat/bmc/bmcBmcAnd.c
\
src/sat/bmc/bmcBmcAnd.c
\
src/sat/bmc/bmcBmci.c
\
src/sat/bmc/bmcBmci.c
\
src/sat/bmc/bmcBmcG.c
\
src/sat/bmc/bmcBmcS.c
\
src/sat/bmc/bmcBmcS.c
\
src/sat/bmc/bmcCexCare.c
\
src/sat/bmc/bmcCexCare.c
\
src/sat/bmc/bmcCexCut.c
\
src/sat/bmc/bmcCexCut.c
\
...
...
src/sat/glucose/AbcGlucose.cpp
View file @
f68bd519
...
@@ -81,12 +81,11 @@ int glucose_solver_addclause(Glucose::Solver* S, int * plits, int nlits)
...
@@ -81,12 +81,11 @@ int glucose_solver_addclause(Glucose::Solver* S, int * plits, int nlits)
return
S
->
addClause
(
lits
);
// returns 0 if the problem is UNSAT
return
S
->
addClause
(
lits
);
// returns 0 if the problem is UNSAT
}
}
int
glucose_solver_setcallback
(
Glucose
::
Solver
*
S
,
void
*
pman
,
int
(
*
pfunc
)(
void
*
,
int
,
int
*
))
void
glucose_solver_setcallback
(
Glucose
::
Solver
*
S
,
void
*
pman
,
int
(
*
pfunc
)(
void
*
,
int
,
int
*
))
{
{
S
->
pCnfMan
=
pman
;
S
->
pCnfMan
=
pman
;
S
->
pCnfFunc
=
pfunc
;
S
->
pCnfFunc
=
pfunc
;
S
->
nCallConfl
=
1000
;
S
->
nCallConfl
=
1000
;
return
0
;
}
}
int
glucose_solver_solve
(
Glucose
::
Solver
*
S
,
int
*
plits
,
int
nlits
)
int
glucose_solver_solve
(
Glucose
::
Solver
*
S
,
int
*
plits
,
int
nlits
)
...
@@ -141,6 +140,73 @@ void glucose_print_stats(Solver& s, abctime clk)
...
@@ -141,6 +140,73 @@ void glucose_print_stats(Solver& s, abctime clk)
/**Function*************************************************************
/**Function*************************************************************
Synopsis [Wrapper APIs to calling from ABC.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
bmcg_sat_solver
*
bmcg_sat_solver_start
()
{
return
(
bmcg_sat_solver
*
)
glucose_solver_start
();
}
void
bmcg_sat_solver_stop
(
bmcg_sat_solver
*
s
)
{
glucose_solver_stop
((
Glucose
::
Solver
*
)
s
);
}
int
bmcg_sat_solver_addclause
(
bmcg_sat_solver
*
s
,
int
*
plits
,
int
nlits
)
{
return
glucose_solver_addclause
((
Glucose
::
Solver
*
)
s
,
plits
,
nlits
);
}
void
bmcg_sat_solver_setcallback
(
bmcg_sat_solver
*
s
,
void
*
pman
,
int
(
*
pfunc
)(
void
*
,
int
,
int
*
))
{
glucose_solver_setcallback
((
Glucose
::
Solver
*
)
s
,
pman
,
pfunc
);
}
int
bmcg_sat_solver_solve
(
bmcg_sat_solver
*
s
,
int
*
plits
,
int
nlits
)
{
return
glucose_solver_solve
((
Glucose
::
Solver
*
)
s
,
plits
,
nlits
);
}
int
bmcg_sat_solver_addvar
(
bmcg_sat_solver
*
s
)
{
return
glucose_solver_addvar
((
Glucose
::
Solver
*
)
s
);
}
int
bmcg_sat_solver_read_cex_varvalue
(
bmcg_sat_solver
*
s
,
int
ivar
)
{
return
glucose_solver_read_cex_varvalue
((
Glucose
::
Solver
*
)
s
,
ivar
);
}
void
bmcg_sat_solver_setstop
(
bmcg_sat_solver
*
s
,
int
*
pstop
)
{
glucose_solver_setstop
((
Glucose
::
Solver
*
)
s
,
pstop
);
}
int
bmcg_sat_solver_varnum
(
bmcg_sat_solver
*
s
)
{
return
((
Glucose
::
Solver
*
)
s
)
->
nVars
();
}
int
bmcg_sat_solver_clausenum
(
bmcg_sat_solver
*
s
)
{
return
((
Glucose
::
Solver
*
)
s
)
->
nClauses
();
}
int
bmcg_sat_solver_learntnum
(
bmcg_sat_solver
*
s
)
{
return
((
Glucose
::
Solver
*
)
s
)
->
nLearnts
();
}
int
bmcg_sat_solver_conflictnum
(
bmcg_sat_solver
*
s
)
{
return
((
Glucose
::
Solver
*
)
s
)
->
conflicts
;
}
/**Function*************************************************************
Synopsis []
Synopsis []
Description []
Description []
...
@@ -150,9 +216,10 @@ void glucose_print_stats(Solver& s, abctime clk)
...
@@ -150,9 +216,10 @@ void glucose_print_stats(Solver& s, abctime clk)
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Glucose_SolveCnf
(
char
*
pFilename
,
ExtSat
_Pars
*
pPars
)
void
Glucose_SolveCnf
(
char
*
pFilename
,
Glucose
_Pars
*
pPars
)
{
{
abctime
clk
=
Abc_Clock
();
abctime
clk
=
Abc_Clock
();
SimpSolver
S
;
SimpSolver
S
;
S
.
verbosity
=
pPars
->
verb
;
S
.
verbosity
=
pPars
->
verb
;
S
.
setConfBudget
(
pPars
->
nConfls
>
0
?
(
int64_t
)
pPars
->
nConfls
:
-
1
);
S
.
setConfBudget
(
pPars
->
nConfls
>
0
?
(
int64_t
)
pPars
->
nConfls
:
-
1
);
...
@@ -161,10 +228,13 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
...
@@ -161,10 +228,13 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
parse_DIMACS
(
in
,
S
);
parse_DIMACS
(
in
,
S
);
gzclose
(
in
);
gzclose
(
in
);
printf
(
"c ============================[ Problem Statistics ]=============================
\n
"
);
if
(
pPars
->
verb
)
printf
(
"c | |
\n
"
);
{
printf
(
"c | Number of variables: %12d |
\n
"
,
S
.
nVars
());
printf
(
"c ============================[ Problem Statistics ]=============================
\n
"
);
printf
(
"c | Number of clauses: %12d |
\n
"
,
S
.
nClauses
());
printf
(
"c | |
\n
"
);
printf
(
"c | Number of variables: %12d |
\n
"
,
S
.
nVars
());
printf
(
"c | Number of clauses: %12d |
\n
"
,
S
.
nClauses
());
}
if
(
pPars
->
pre
)
S
.
eliminate
(
true
);
if
(
pPars
->
pre
)
S
.
eliminate
(
true
);
...
@@ -172,7 +242,7 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
...
@@ -172,7 +242,7 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
lbool
ret
=
S
.
solveLimited
(
dummy
);
lbool
ret
=
S
.
solveLimited
(
dummy
);
if
(
pPars
->
verb
)
glucose_print_stats
(
S
,
Abc_Clock
()
-
clk
);
if
(
pPars
->
verb
)
glucose_print_stats
(
S
,
Abc_Clock
()
-
clk
);
printf
(
ret
==
l_True
?
"SATISFIABLE"
:
ret
==
l_False
?
"UNSATISFIABLE"
:
"INDETERMINATE"
);
printf
(
ret
==
l_True
?
"SATISFIABLE"
:
ret
==
l_False
?
"UNSATISFIABLE"
:
"INDETERMINATE"
);
Abc_PrintTime
(
1
,
" Time"
,
Abc_Clock
()
-
clk
);
Abc_PrintTime
(
1
,
"
Time"
,
Abc_Clock
()
-
clk
);
}
}
/**Function*************************************************************
/**Function*************************************************************
...
@@ -188,7 +258,7 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
...
@@ -188,7 +258,7 @@ void Glucose_SolveCnf( char * pFilename, ExtSat_Pars * pPars )
***********************************************************************/
***********************************************************************/
Vec_Int_t
*
Glucose_SolverFromAig
(
Gia_Man_t
*
p
,
SimpSolver
&
S
)
Vec_Int_t
*
Glucose_SolverFromAig
(
Gia_Man_t
*
p
,
SimpSolver
&
S
)
{
{
abctime
clk
=
Abc_Clock
();
//
abctime clk = Abc_Clock();
int
*
pLit
,
*
pStop
,
i
;
int
*
pLit
,
*
pStop
,
i
;
Cnf_Dat_t
*
pCnf
=
(
Cnf_Dat_t
*
)
Mf_ManGenerateCnf
(
p
,
8
/*nLutSize*/
,
0
/*fCnfObjIds*/
,
1
/*fAddOrCla*/
,
0
,
0
/*verbose*/
);
Cnf_Dat_t
*
pCnf
=
(
Cnf_Dat_t
*
)
Mf_ManGenerateCnf
(
p
,
8
/*nLutSize*/
,
0
/*fCnfObjIds*/
,
1
/*fAddOrCla*/
,
0
,
0
/*verbose*/
);
for
(
i
=
0
;
i
<
pCnf
->
nClauses
;
i
++
)
for
(
i
=
0
;
i
<
pCnf
->
nClauses
;
i
++
)
...
@@ -211,7 +281,7 @@ Vec_Int_t * Glucose_SolverFromAig( Gia_Man_t * p, SimpSolver& S )
...
@@ -211,7 +281,7 @@ Vec_Int_t * Glucose_SolverFromAig( Gia_Man_t * p, SimpSolver& S )
return
vCnfIds
;
return
vCnfIds
;
}
}
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
ExtSat
_Pars
*
pPars
)
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
Glucose
_Pars
*
pPars
)
{
{
abctime
clk
=
Abc_Clock
();
abctime
clk
=
Abc_Clock
();
...
@@ -241,7 +311,7 @@ int Glucose_SolveAig(Gia_Man_t * p, ExtSat_Pars * pPars)
...
@@ -241,7 +311,7 @@ int Glucose_SolveAig(Gia_Man_t * p, ExtSat_Pars * pPars)
if
(
pPars
->
verb
)
glucose_print_stats
(
S
,
Abc_Clock
()
-
clk
);
if
(
pPars
->
verb
)
glucose_print_stats
(
S
,
Abc_Clock
()
-
clk
);
printf
(
ret
==
l_True
?
"SATISFIABLE"
:
ret
==
l_False
?
"UNSATISFIABLE"
:
"INDETERMINATE"
);
printf
(
ret
==
l_True
?
"SATISFIABLE"
:
ret
==
l_False
?
"UNSATISFIABLE"
:
"INDETERMINATE"
);
Abc_PrintTime
(
1
,
" Time"
,
Abc_Clock
()
-
clk
);
Abc_PrintTime
(
1
,
"
Time"
,
Abc_Clock
()
-
clk
);
// port counterexample
// port counterexample
if
(
ret
==
l_True
)
if
(
ret
==
l_True
)
...
...
src/sat/glucose/AbcGlucose.h
View file @
f68bd519
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
***********************************************************************/
***********************************************************************/
#ifndef
SRC_EXTSAT_GLUCOSE_ABC
_H_
#ifndef
ABC_SAT_GLUCOSE
_H_
#define
SRC_EXTSAT_GLUCOSE_ABC
_H_
#define
ABC_SAT_GLUCOSE
_H_
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
/// INCLUDES ///
...
@@ -37,24 +37,26 @@ ABC_NAMESPACE_HEADER_START
...
@@ -37,24 +37,26 @@ ABC_NAMESPACE_HEADER_START
/// BASIC TYPES ///
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
typedef
struct
ExtSat_Pars_
ExtSat
_Pars
;
typedef
struct
Glucose_Pars_
Glucose
_Pars
;
struct
ExtSat
_Pars_
{
struct
Glucose
_Pars_
{
int
pre
;
// preprocessing
int
pre
;
// preprocessing
int
verb
;
// verbosity
int
verb
;
// verbosity
int
cust
;
// customizable
int
cust
;
// customizable
int
nConfls
;
// conflict limit (0 = no limit)
int
nConfls
;
// conflict limit (0 = no limit)
};
};
static
inline
ExtSat_Pars
ExtSat
_CreatePars
(
int
p
,
int
v
,
int
c
,
int
nConfls
)
static
inline
Glucose_Pars
Glucose
_CreatePars
(
int
p
,
int
v
,
int
c
,
int
nConfls
)
{
{
ExtSat
_Pars
pars
;
Glucose
_Pars
pars
;
pars
.
pre
=
p
;
pars
.
pre
=
p
;
pars
.
verb
=
v
;
pars
.
verb
=
v
;
pars
.
cust
=
c
;
pars
.
cust
=
c
;
pars
.
nConfls
=
nConfls
;
pars
.
nConfls
=
nConfls
;
return
pars
;
return
pars
;
}
}
typedef
void
bmcg_sat_solver
;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
...
@@ -63,8 +65,21 @@ static inline ExtSat_Pars ExtSat_CreatePars(int p, int v, int c, int nConfls)
...
@@ -63,8 +65,21 @@ static inline ExtSat_Pars ExtSat_CreatePars(int p, int v, int c, int nConfls)
/// FUNCTION DECLARATIONS ///
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
extern
void
Glucose_SolveCnf
(
char
*
pFilename
,
ExtSat_Pars
*
pPars
);
extern
bmcg_sat_solver
*
bmcg_sat_solver_start
();
extern
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
ExtSat_Pars
*
pPars
);
extern
void
bmcg_sat_solver_stop
(
bmcg_sat_solver
*
s
);
extern
int
bmcg_sat_solver_addclause
(
bmcg_sat_solver
*
s
,
int
*
plits
,
int
nlits
);
extern
void
bmcg_sat_solver_setcallback
(
bmcg_sat_solver
*
s
,
void
*
pman
,
int
(
*
pfunc
)(
void
*
,
int
,
int
*
)
);
extern
int
bmcg_sat_solver_solve
(
bmcg_sat_solver
*
s
,
int
*
plits
,
int
nlits
);
extern
int
bmcg_sat_solver_addvar
(
bmcg_sat_solver
*
s
);
extern
int
bmcg_sat_solver_read_cex_varvalue
(
bmcg_sat_solver
*
s
,
int
);
extern
void
bmcg_sat_solver_setstop
(
bmcg_sat_solver
*
s
,
int
*
);
extern
int
bmcg_sat_solver_varnum
(
bmcg_sat_solver
*
s
);
extern
int
bmcg_sat_solver_clausenum
(
bmcg_sat_solver
*
s
);
extern
int
bmcg_sat_solver_learntnum
(
bmcg_sat_solver
*
s
);
extern
int
bmcg_sat_solver_conflictnum
(
bmcg_sat_solver
*
s
);
extern
void
Glucose_SolveCnf
(
char
*
pFilename
,
Glucose_Pars
*
pPars
);
extern
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
Glucose_Pars
*
pPars
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
...
...
src/sat/glucose/AbcGlucoseCmd.cpp
View file @
f68bd519
...
@@ -72,15 +72,12 @@ void Glucose_End( Abc_Frame_t * pAbc )
...
@@ -72,15 +72,12 @@ void Glucose_End( Abc_Frame_t * pAbc )
***********************************************************************/
***********************************************************************/
int
Abc_CommandGlucose
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
int
Abc_CommandGlucose
(
Abc_Frame_t
*
pAbc
,
int
argc
,
char
**
argv
)
{
{
extern
void
Glucose_SolveCnf
(
char
*
pFilename
,
ExtSat_Pars
*
pPars
);
int
c
=
0
;
extern
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
ExtSat_Pars
*
pPars
);
int
pre
=
1
;
int
verb
=
0
;
int
c
=
0
;
int
pre
=
1
;
int
verb
=
0
;
int
nConfls
=
0
;
int
nConfls
=
0
;
ExtSat
_Pars
pPars
;
Glucose
_Pars
pPars
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Cpvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Cpvh"
)
)
!=
EOF
)
{
{
...
@@ -110,7 +107,7 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -110,7 +107,7 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
}
}
}
}
pPars
=
ExtSat
_CreatePars
(
pre
,
verb
,
0
,
nConfls
);
pPars
=
Glucose
_CreatePars
(
pre
,
verb
,
0
,
nConfls
);
if
(
argc
==
globalUtilOptind
+
1
)
if
(
argc
==
globalUtilOptind
+
1
)
{
{
...
...
src/sat/glucose/Glucose.cpp
View file @
f68bd519
...
@@ -1156,7 +1156,7 @@ lbool Solver::search(int nof_conflicts)
...
@@ -1156,7 +1156,7 @@ lbool Solver::search(int nof_conflicts)
next
=
pickBranchLit
();
next
=
pickBranchLit
();
if
(
next
==
lit_Undef
){
if
(
next
==
lit_Undef
){
printf
(
"c last restart ## conflicts : %d %d
\n
"
,
conflictC
,
decisionLevel
());
//
printf("c last restart ## conflicts : %d %d \n",conflictC,decisionLevel());
// Model found:
// Model found:
return
l_True
;
return
l_True
;
}
}
...
@@ -1189,17 +1189,17 @@ void Solver::printIncrementalStats() {
...
@@ -1189,17 +1189,17 @@ void Solver::printIncrementalStats() {
printf
(
"c---------- Glucose Stats -------------------------
\n
"
);
printf
(
"c---------- Glucose Stats -------------------------
\n
"
);
printf
(
"c restarts : %lld
\n
"
,
starts
);
printf
(
"c restarts : %lld
\n
"
,
starts
);
printf
(
"c nb ReduceDB : %lld
\n
"
,
nbReduceDB
);
printf
(
"c nb ReduceDB : %lld
\n
"
,
nbReduceDB
);
printf
(
"c nb removed Clauses : %lld
\n
"
,
nbRemovedClauses
);
printf
(
"c nb removed Clauses : %lld
\n
"
,
nbRemovedClauses
);
printf
(
"c nb learnts DL2 : %lld
\n
"
,
nbDL2
);
printf
(
"c nb learnts DL2 : %lld
\n
"
,
nbDL2
);
printf
(
"c nb learnts size 2 : %lld
\n
"
,
nbBin
);
printf
(
"c nb learnts size 2 : %lld
\n
"
,
nbBin
);
printf
(
"c nb learnts size 1 : %lld
\n
"
,
nbUn
);
printf
(
"c nb learnts size 1 : %lld
\n
"
,
nbUn
);
printf
(
"c conflicts : %lld
\n
"
,
conflicts
);
printf
(
"c conflicts : %lld
\n
"
,
conflicts
);
printf
(
"c decisions : %lld
\n
"
,
decisions
);
printf
(
"c decisions : %lld
\n
"
,
decisions
);
printf
(
"c propagations : %lld
\n
"
,
propagations
);
printf
(
"c propagations : %lld
\n
"
,
propagations
);
printf
(
"c SAT Calls : %d in %g seconds
\n
"
,
nbSatCalls
,
totalTime4Sat
);
printf
(
"c SAT Calls : %d in %g seconds
\n
"
,
nbSatCalls
,
totalTime4Sat
);
printf
(
"c UNSAT Calls : %d in %g seconds
\n
"
,
nbUnsatCalls
,
totalTime4Unsat
);
printf
(
"c UNSAT Calls : %d in %g seconds
\n
"
,
nbUnsatCalls
,
totalTime4Unsat
);
printf
(
"c--------------------------------------------------
\n
"
);
printf
(
"c--------------------------------------------------
\n
"
);
...
...
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