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
6097ac1d
Commit
6097ac1d
authored
Feb 02, 2022
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding option to dump CNF after preprocessing in &glucose.
parent
0b4350a0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
8 deletions
+22
-8
src/sat/bsat2/Solver.cpp
+1
-1
src/sat/glucose/AbcGlucose.cpp
+10
-1
src/sat/glucose/AbcGlucose.h
+1
-1
src/sat/glucose/AbcGlucoseCmd.cpp
+8
-3
src/sat/glucose/Glucose.cpp
+1
-1
src/sat/glucose2/Glucose2.cpp
+1
-1
No files found.
src/sat/bsat2/Solver.cpp
View file @
6097ac1d
...
@@ -820,7 +820,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
...
@@ -820,7 +820,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
{
{
FILE
*
f
=
fopen
(
file
,
"w
r
"
);
FILE
*
f
=
fopen
(
file
,
"w
b
"
);
if
(
f
==
NULL
)
if
(
f
==
NULL
)
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
toDimacs
(
f
,
assumps
);
toDimacs
(
f
,
assumps
);
...
...
src/sat/glucose/AbcGlucose.cpp
View file @
6097ac1d
...
@@ -818,7 +818,7 @@ void Glucose_ReadDimacs( char * pFileName, SimpSolver& s )
...
@@ -818,7 +818,7 @@ void Glucose_ReadDimacs( char * pFileName, SimpSolver& s )
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
void
Glucose_SolveCnf
(
char
*
pFileName
,
Glucose_Pars
*
pPars
)
void
Glucose_SolveCnf
(
char
*
pFileName
,
Glucose_Pars
*
pPars
,
int
fDumpCnf
)
{
{
abctime
clk
=
Abc_Clock
();
abctime
clk
=
Abc_Clock
();
...
@@ -844,6 +844,15 @@ void Glucose_SolveCnf( char * pFileName, Glucose_Pars * pPars )
...
@@ -844,6 +844,15 @@ void Glucose_SolveCnf( char * pFileName, Glucose_Pars * pPars )
S
.
eliminate
(
true
);
S
.
eliminate
(
true
);
printf
(
"c Simplication removed %d variables and %d clauses. "
,
S
.
eliminated_vars
,
S
.
eliminated_clauses
);
printf
(
"c Simplication removed %d variables and %d clauses. "
,
S
.
eliminated_vars
,
S
.
eliminated_clauses
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
Abc_PrintTime
(
1
,
"Time"
,
Abc_Clock
()
-
clk
);
if
(
fDumpCnf
)
{
char
*
pFileCnf
=
Extra_FileNameGenericAppend
(
pFileName
,
"_out.cnf"
);
S
.
toDimacs
(
pFileCnf
);
printf
(
"Finished dumping CNF after preprocessing into file
\"
%s
\"
.
\n
"
,
pFileCnf
);
printf
(
"SAT solving is not performed.
\n
"
);
return
;
}
}
}
vec
<
Lit
>
dummy
;
vec
<
Lit
>
dummy
;
...
...
src/sat/glucose/AbcGlucose.h
View file @
6097ac1d
...
@@ -105,7 +105,7 @@ extern void bmcg_sat_solver_start_new_round( bmcg_sat_solver * s );
...
@@ -105,7 +105,7 @@ extern void bmcg_sat_solver_start_new_round( bmcg_sat_solver * s );
extern
void
bmcg_sat_solver_mark_cone
(
bmcg_sat_solver
*
s
,
int
var
);
extern
void
bmcg_sat_solver_mark_cone
(
bmcg_sat_solver
*
s
,
int
var
);
extern
void
Glucose_SolveCnf
(
char
*
pFilename
,
Glucose_Pars
*
pPars
);
extern
void
Glucose_SolveCnf
(
char
*
pFilename
,
Glucose_Pars
*
pPars
,
int
fDumpCnf
);
extern
int
Glucose_SolveAig
(
Gia_Man_t
*
p
,
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 @
6097ac1d
...
@@ -81,10 +81,11 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -81,10 +81,11 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
int
pre
=
1
;
int
pre
=
1
;
int
verb
=
0
;
int
verb
=
0
;
int
nConfls
=
0
;
int
nConfls
=
0
;
int
fDumpCnf
=
0
;
Glucose_Pars
pPars
;
Glucose_Pars
pPars
;
Extra_UtilGetoptReset
();
Extra_UtilGetoptReset
();
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Cpvh"
)
)
!=
EOF
)
while
(
(
c
=
Extra_UtilGetopt
(
argc
,
argv
,
"Cp
d
vh"
)
)
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
{
{
...
@@ -102,6 +103,9 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -102,6 +103,9 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
case
'p'
:
case
'p'
:
pre
^=
1
;
pre
^=
1
;
break
;
break
;
case
'd'
:
fDumpCnf
^=
1
;
break
;
case
'v'
:
case
'v'
:
verb
^=
1
;
verb
^=
1
;
break
;
break
;
...
@@ -116,7 +120,7 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -116,7 +120,7 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
argc
==
globalUtilOptind
+
1
)
if
(
argc
==
globalUtilOptind
+
1
)
{
{
Glucose_SolveCnf
(
argv
[
globalUtilOptind
],
&
pPars
);
Glucose_SolveCnf
(
argv
[
globalUtilOptind
],
&
pPars
,
fDumpCnf
);
return
0
;
return
0
;
}
}
...
@@ -132,10 +136,11 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
...
@@ -132,10 +136,11 @@ int Abc_CommandGlucose( Abc_Frame_t * pAbc, int argc, char ** argv )
return
0
;
return
0
;
usage:
usage:
Abc_Print
(
-
2
,
"usage: &glucose [-C num] [-pvh] <file.cnf>
\n
"
);
Abc_Print
(
-
2
,
"usage: &glucose [-C num] [-p
d
vh] <file.cnf>
\n
"
);
Abc_Print
(
-
2
,
"
\t
run Glucose 3.0 by Gilles Audemard and Laurent Simon
\n
"
);
Abc_Print
(
-
2
,
"
\t
run Glucose 3.0 by Gilles Audemard and Laurent Simon
\n
"
);
Abc_Print
(
-
2
,
"
\t
-C num : conflict limit [default = %d]
\n
"
,
nConfls
);
Abc_Print
(
-
2
,
"
\t
-C num : conflict limit [default = %d]
\n
"
,
nConfls
);
Abc_Print
(
-
2
,
"
\t
-p : enable preprocessing [default = %d]
\n
"
,
pre
);
Abc_Print
(
-
2
,
"
\t
-p : enable preprocessing [default = %d]
\n
"
,
pre
);
Abc_Print
(
-
2
,
"
\t
-d : enable dumping CNF after proprocessing [default = %d]
\n
"
,
fDumpCnf
);
Abc_Print
(
-
2
,
"
\t
-v : verbosity [default = %d]
\n
"
,
verb
);
Abc_Print
(
-
2
,
"
\t
-v : verbosity [default = %d]
\n
"
,
verb
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
-h : print the command usage
\n
"
);
Abc_Print
(
-
2
,
"
\t
<file.cnf> : (optional) CNF file to solve
\n
"
);
Abc_Print
(
-
2
,
"
\t
<file.cnf> : (optional) CNF file to solve
\n
"
);
...
...
src/sat/glucose/Glucose.cpp
View file @
6097ac1d
...
@@ -1330,7 +1330,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
...
@@ -1330,7 +1330,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
{
{
FILE
*
f
=
fopen
(
file
,
"w
r
"
);
FILE
*
f
=
fopen
(
file
,
"w
b
"
);
if
(
f
==
NULL
)
if
(
f
==
NULL
)
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
toDimacs
(
f
,
assumps
);
toDimacs
(
f
,
assumps
);
...
...
src/sat/glucose2/Glucose2.cpp
View file @
6097ac1d
...
@@ -1535,7 +1535,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
...
@@ -1535,7 +1535,7 @@ void Solver::toDimacs(FILE* f, Clause& c, vec<Var>& map, Var& max)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
void
Solver
::
toDimacs
(
const
char
*
file
,
const
vec
<
Lit
>&
assumps
)
{
{
FILE
*
f
=
fopen
(
file
,
"w
r
"
);
FILE
*
f
=
fopen
(
file
,
"w
b
"
);
if
(
f
==
NULL
)
if
(
f
==
NULL
)
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
fprintf
(
stderr
,
"could not open file %s
\n
"
,
file
),
exit
(
1
);
toDimacs
(
f
,
assumps
);
toDimacs
(
f
,
assumps
);
...
...
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