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
fdf00d80
Commit
fdf00d80
authored
Sep 18, 2015
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tuning SAT solver for QBF instances.
parent
3b838b95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
12 deletions
+22
-12
src/base/abci/abc.c
+4
-4
src/sat/bsat/satUtil.c
+6
-4
src/sat/cnf/cnfUtil.c
+12
-4
No files found.
src/base/abci/abc.c
View file @
fdf00d80
...
@@ -21829,7 +21829,7 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -21829,7 +21829,7 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
argc
==
globalUtilOptind
+
1
)
if
(
argc
==
globalUtilOptind
+
1
)
{
{
int
*
pModel
=
NULL
;
int
*
pModel
=
NULL
;
extern
int
Cnf_DataSolveFromFile
(
char
*
pFileName
,
int
nConfLimit
,
int
nLearnedStart
,
int
nLearnedDelta
,
int
nLearnedPerce
,
int
fVerbose
,
int
**
ppModel
);
extern
int
Cnf_DataSolveFromFile
(
char
*
pFileName
,
int
nConfLimit
,
int
nLearnedStart
,
int
nLearnedDelta
,
int
nLearnedPerce
,
int
fVerbose
,
int
**
ppModel
,
int
nPis
);
// get the input file name
// get the input file name
char
*
pFileName
=
argv
[
globalUtilOptind
];
char
*
pFileName
=
argv
[
globalUtilOptind
];
FILE
*
pFile
=
fopen
(
pFileName
,
"rb"
);
FILE
*
pFile
=
fopen
(
pFileName
,
"rb"
);
...
@@ -21839,14 +21839,14 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -21839,14 +21839,14 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
return
0
;
}
}
fclose
(
pFile
);
fclose
(
pFile
);
Cnf_DataSolveFromFile
(
pFileName
,
nConfLimit
,
nLearnedStart
,
nLearnedDelta
,
nLearnedPerce
,
fVerbose
,
&
pModel
);
Cnf_DataSolveFromFile
(
pFileName
,
nConfLimit
,
nLearnedStart
,
nLearnedDelta
,
nLearnedPerce
,
fVerbose
,
&
pModel
,
Abc_NtkPiNum
(
pNtk
)
);
if
(
pModel
&&
pNtk
)
if
(
pModel
&&
pNtk
)
{
{
int
*
pSimInfo
=
Abc_NtkVerifySimulatePattern
(
pNtk
,
pModel
);
int
*
pSimInfo
=
Abc_NtkVerifySimulatePattern
(
pNtk
,
pModel
);
if
(
pSimInfo
[
0
]
!=
1
)
if
(
pSimInfo
[
0
]
!=
1
)
Abc_Print
(
1
,
"ERROR in
Abc_NtkMiterSat(): Generated counter example
is invalid.
\n
"
);
Abc_Print
(
1
,
"ERROR in
mapping PIs into SAT vars: Generated CEX
is invalid.
\n
"
);
ABC_FREE
(
pSimInfo
);
ABC_FREE
(
pSimInfo
);
pAbc
->
pCex
=
Abc_CexCreate
(
0
,
Abc_NtkPiNum
(
pNtk
),
p
Ntk
->
p
Model
,
0
,
0
,
0
);
pAbc
->
pCex
=
Abc_CexCreate
(
0
,
Abc_NtkPiNum
(
pNtk
),
pModel
,
0
,
0
,
0
);
}
}
ABC_FREE
(
pModel
);
ABC_FREE
(
pModel
);
return
0
;
return
0
;
src/sat/bsat/satUtil.c
View file @
fdf00d80
...
@@ -185,13 +185,15 @@ void Sat_Solver2WriteDimacs( sat_solver2 * p, char * pFileName, lit* assumpBegin
...
@@ -185,13 +185,15 @@ void Sat_Solver2WriteDimacs( sat_solver2 * p, char * pFileName, lit* assumpBegin
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
static
inline
double
Sat_Wrd2Dbl
(
word
w
)
{
return
(
double
)(
unsigned
)(
w
&
0x3FFFFFFF
)
+
(
double
)(
1
<<
30
)
*
(
unsigned
)(
w
>>
30
);
}
void
Sat_SolverPrintStats
(
FILE
*
pFile
,
sat_solver
*
p
)
void
Sat_SolverPrintStats
(
FILE
*
pFile
,
sat_solver
*
p
)
{
{
// printf( "calls : %10d (%d)\n", (int)p->nCalls, (int)p->nCalls2 );
// printf( "calls : %10d (%d)\n", (int)p->nCalls, (int)p->nCalls2 );
printf
(
"starts : %1
0d
\n
"
,
(
int
)
p
->
stats
.
starts
);
printf
(
"starts : %1
6.0f
\n
"
,
Sat_Wrd2Dbl
(
p
->
stats
.
starts
)
);
printf
(
"conflicts : %1
0d
\n
"
,
(
int
)
p
->
stats
.
conflicts
);
printf
(
"conflicts : %1
6.0f
\n
"
,
Sat_Wrd2Dbl
(
p
->
stats
.
conflicts
)
);
printf
(
"decisions : %1
0d
\n
"
,
(
int
)
p
->
stats
.
decisions
);
printf
(
"decisions : %1
6.0f
\n
"
,
Sat_Wrd2Dbl
(
p
->
stats
.
decisions
)
);
printf
(
"propagations : %1
0d
\n
"
,
(
int
)
p
->
stats
.
propagations
);
printf
(
"propagations : %1
6.0f
\n
"
,
Sat_Wrd2Dbl
(
p
->
stats
.
propagations
)
);
// printf( "inspects : %10d\n", (int)p->stats.inspects );
// printf( "inspects : %10d\n", (int)p->stats.inspects );
// printf( "inspects2 : %10d\n", (int)p->stats.inspects2 );
// printf( "inspects2 : %10d\n", (int)p->stats.inspects2 );
}
}
...
...
src/sat/cnf/cnfUtil.c
View file @
fdf00d80
...
@@ -399,12 +399,12 @@ finish:
...
@@ -399,12 +399,12 @@ finish:
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
int
Cnf_DataSolveFromFile
(
char
*
pFileName
,
int
nConfLimit
,
int
nLearnedStart
,
int
nLearnedDelta
,
int
nLearnedPerce
,
int
fVerbose
,
int
**
ppModel
)
int
Cnf_DataSolveFromFile
(
char
*
pFileName
,
int
nConfLimit
,
int
nLearnedStart
,
int
nLearnedDelta
,
int
nLearnedPerce
,
int
fVerbose
,
int
**
ppModel
,
int
nPis
)
{
{
abctime
clk
=
Abc_Clock
();
abctime
clk
=
Abc_Clock
();
Cnf_Dat_t
*
pCnf
=
Cnf_DataReadFromFile
(
pFileName
);
Cnf_Dat_t
*
pCnf
=
Cnf_DataReadFromFile
(
pFileName
);
sat_solver
*
pSat
;
sat_solver
*
pSat
;
int
status
,
RetValue
=
-
1
;
int
i
,
status
,
RetValue
=
-
1
;
if
(
pCnf
==
NULL
)
if
(
pCnf
==
NULL
)
return
-
1
;
return
-
1
;
if
(
fVerbose
)
if
(
fVerbose
)
...
@@ -414,10 +414,10 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
...
@@ -414,10 +414,10 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
}
}
// convert into SAT solver
// convert into SAT solver
pSat
=
(
sat_solver
*
)
Cnf_DataWriteIntoSolver
(
pCnf
,
1
,
0
);
pSat
=
(
sat_solver
*
)
Cnf_DataWriteIntoSolver
(
pCnf
,
1
,
0
);
Cnf_DataFree
(
pCnf
);
if
(
pSat
==
NULL
)
if
(
pSat
==
NULL
)
{
{
printf
(
"The problem is trivially UNSAT.
\n
"
);
printf
(
"The problem is trivially UNSAT.
\n
"
);
Cnf_DataFree
(
pCnf
);
return
1
;
return
1
;
}
}
if
(
nLearnedStart
)
if
(
nLearnedStart
)
...
@@ -440,7 +440,6 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
...
@@ -440,7 +440,6 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
assert
(
0
);
assert
(
0
);
if
(
fVerbose
)
if
(
fVerbose
)
Sat_SolverPrintStats
(
stdout
,
pSat
);
Sat_SolverPrintStats
(
stdout
,
pSat
);
sat_solver_delete
(
pSat
);
if
(
RetValue
==
-
1
)
if
(
RetValue
==
-
1
)
Abc_Print
(
1
,
"UNDECIDED "
);
Abc_Print
(
1
,
"UNDECIDED "
);
else
if
(
RetValue
==
0
)
else
if
(
RetValue
==
0
)
...
@@ -449,6 +448,15 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
...
@@ -449,6 +448,15 @@ int Cnf_DataSolveFromFile( char * pFileName, int nConfLimit, int nLearnedStart,
Abc_Print
(
1
,
"UNSATISFIABLE "
);
Abc_Print
(
1
,
"UNSATISFIABLE "
);
//Abc_Print( -1, "\n" );
//Abc_Print( -1, "\n" );
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
// derive SAT assignment
if
(
RetValue
==
0
)
{
*
ppModel
=
ABC_ALLOC
(
int
,
nPis
);
for
(
i
=
0
;
i
<
nPis
;
i
++
)
(
*
ppModel
)[
i
]
=
sat_solver_var_value
(
pSat
,
pCnf
->
nVars
-
nPis
+
i
);
}
Cnf_DataFree
(
pCnf
);
sat_solver_delete
(
pSat
);
return
RetValue
;
return
RetValue
;
}
}
...
...
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