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
565fefec
Commit
565fefec
authored
Dec 06, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proof-logging in the updated solver.
parent
35733eb1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
26 deletions
+17
-26
src/sat/bsat/satProof.c
+0
-0
src/sat/bsat/satSolver2.c
+9
-21
src/sat/bsat/satSolver2.h
+8
-5
No files found.
src/sat/bsat/satProof.c
View file @
565fefec
This diff is collapsed.
Click to expand it.
src/sat/bsat/satSolver2.c
View file @
565fefec
...
@@ -85,13 +85,13 @@ struct varinfo_t
...
@@ -85,13 +85,13 @@ struct varinfo_t
{
{
unsigned
val
:
2
;
// variable value
unsigned
val
:
2
;
// variable value
unsigned
pol
:
1
;
// last polarity
unsigned
pol
:
1
;
// last polarity
unsigned
glo
:
1
;
// global
variable
unsigned
partA
:
1
;
// partA
variable
unsigned
tag
:
4
;
// conflict analysis tags
unsigned
tag
:
4
;
// conflict analysis tags
unsigned
lev
:
24
;
// variable level
unsigned
lev
:
24
;
// variable level
};
};
int
var_is_
global
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
glo
;
}
int
var_is_
partA
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
partA
;
}
void
var_set_
global
(
sat_solver2
*
s
,
int
v
,
int
glo
)
{
s
->
vi
[
v
].
glo
=
glo
;
if
(
glo
)
veci_push
(
&
s
->
glob_vars
,
v
)
;
}
void
var_set_
partA
(
sat_solver2
*
s
,
int
v
,
int
partA
)
{
s
->
vi
[
v
].
partA
=
partA
;
}
static
inline
int
var_value
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
val
;
}
static
inline
int
var_value
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
val
;
}
static
inline
int
var_polar
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
pol
;
}
static
inline
int
var_polar
(
sat_solver2
*
s
,
int
v
)
{
return
s
->
vi
[
v
].
pol
;
}
...
@@ -145,7 +145,7 @@ static inline void solver2_clear_marks(sat_solver2* s) {
...
@@ -145,7 +145,7 @@ static inline void solver2_clear_marks(sat_solver2* s) {
static
inline
satset
*
clause_read
(
sat_solver2
*
s
,
cla
h
)
{
return
satset_read
(
&
s
->
clauses
,
h
);
}
static
inline
satset
*
clause_read
(
sat_solver2
*
s
,
cla
h
)
{
return
satset_read
(
&
s
->
clauses
,
h
);
}
static
inline
cla
clause_handle
(
sat_solver2
*
s
,
satset
*
c
)
{
return
satset_handle
(
&
s
->
clauses
,
c
);
}
static
inline
cla
clause_handle
(
sat_solver2
*
s
,
satset
*
c
)
{
return
satset_handle
(
&
s
->
clauses
,
c
);
}
static
inline
int
clause_check
(
sat_solver2
*
s
,
satset
*
c
)
{
return
satset_check
(
&
s
->
clauses
,
c
);
}
static
inline
int
clause_check
(
sat_solver2
*
s
,
satset
*
c
)
{
return
satset_check
(
&
s
->
clauses
,
c
);
}
static
inline
int
clause_proofid
(
sat_solver2
*
s
,
satset
*
c
)
{
return
c
->
learnt
?
veci_begin
(
&
s
->
claProofs
)[
c
->
Id
]
<<
1
:
(
clause_handle
(
s
,
c
)
<<
1
)
|
1
;
}
static
inline
int
clause_proofid
(
sat_solver2
*
s
,
satset
*
c
,
int
partA
)
{
return
c
->
learnt
?
(
veci_begin
(
&
s
->
claProofs
)[
c
->
Id
]
<<
2
)
|
(
partA
<<
1
)
:
(
clause_handle
(
s
,
c
)
<<
2
)
|
1
;
}
//static inline int var_reason (sat_solver2* s, int v) { return (s->reasons[v]&1) ? 0 : s->reasons[v] >> 1; }
//static inline int var_reason (sat_solver2* s, int v) { return (s->reasons[v]&1) ? 0 : s->reasons[v] >> 1; }
//static inline int lit_reason (sat_solver2* s, int l) { return (s->reasons[lit_var(l)&1]) ? 0 : s->reasons[lit_var(l)] >> 1; }
//static inline int lit_reason (sat_solver2* s, int l) { return (s->reasons[lit_var(l)&1]) ? 0 : s->reasons[lit_var(l)] >> 1; }
...
@@ -180,10 +180,7 @@ static inline void proof_chain_start( sat_solver2* s, satset* c )
...
@@ -180,10 +180,7 @@ static inline void proof_chain_start( sat_solver2* s, satset* c )
s
->
iStartChain
=
veci_size
(
&
s
->
proof_clas
);
s
->
iStartChain
=
veci_size
(
&
s
->
proof_clas
);
veci_push
(
&
s
->
proof_clas
,
0
);
veci_push
(
&
s
->
proof_clas
,
0
);
veci_push
(
&
s
->
proof_clas
,
0
);
veci_push
(
&
s
->
proof_clas
,
0
);
veci_push
(
&
s
->
proof_clas
,
clause_proofid
(
s
,
c
)
);
veci_push
(
&
s
->
proof_clas
,
clause_proofid
(
s
,
c
,
0
)
);
veci_push
(
&
s
->
proof_vars
,
0
);
veci_push
(
&
s
->
proof_vars
,
0
);
veci_push
(
&
s
->
proof_vars
,
0
);
}
}
}
}
...
@@ -192,8 +189,7 @@ static inline void proof_chain_resolve( sat_solver2* s, satset* cls, int Var )
...
@@ -192,8 +189,7 @@ static inline void proof_chain_resolve( sat_solver2* s, satset* cls, int Var )
if
(
s
->
fProofLogging
)
if
(
s
->
fProofLogging
)
{
{
satset
*
c
=
cls
?
cls
:
var_unit_clause
(
s
,
Var
);
satset
*
c
=
cls
?
cls
:
var_unit_clause
(
s
,
Var
);
veci_push
(
&
s
->
proof_clas
,
clause_proofid
(
s
,
c
)
);
veci_push
(
&
s
->
proof_clas
,
clause_proofid
(
s
,
c
,
var_is_partA
(
s
,
Var
))
);
veci_push
(
&
s
->
proof_vars
,
Var
);
// printf( "%d %d ", clause_proofid(s, c), Var );
// printf( "%d %d ", clause_proofid(s, c), Var );
}
}
}
}
...
@@ -1225,9 +1221,7 @@ sat_solver2* sat_solver2_new(void)
...
@@ -1225,9 +1221,7 @@ sat_solver2* sat_solver2_new(void)
veci_new
(
&
s
->
mark_levels
);
veci_new
(
&
s
->
mark_levels
);
veci_new
(
&
s
->
min_lit_order
);
veci_new
(
&
s
->
min_lit_order
);
veci_new
(
&
s
->
min_step_order
);
veci_new
(
&
s
->
min_step_order
);
veci_new
(
&
s
->
glob_vars
);
veci_new
(
&
s
->
proof_clas
);
veci_push
(
&
s
->
proof_clas
,
-
1
);
veci_new
(
&
s
->
proof_clas
);
veci_push
(
&
s
->
proof_clas
,
-
1
);
veci_new
(
&
s
->
proof_vars
);
veci_push
(
&
s
->
proof_vars
,
-
1
);
veci_new
(
&
s
->
claActs
);
veci_push
(
&
s
->
claActs
,
-
1
);
veci_new
(
&
s
->
claActs
);
veci_push
(
&
s
->
claActs
,
-
1
);
veci_new
(
&
s
->
claProofs
);
veci_push
(
&
s
->
claProofs
,
-
1
);
veci_new
(
&
s
->
claProofs
);
veci_push
(
&
s
->
claProofs
,
-
1
);
...
@@ -1256,8 +1250,6 @@ sat_solver2* sat_solver2_new(void)
...
@@ -1256,8 +1250,6 @@ sat_solver2* sat_solver2_new(void)
{
{
s
->
proof_clas
.
cap
=
(
1
<<
20
);
s
->
proof_clas
.
cap
=
(
1
<<
20
);
s
->
proof_clas
.
ptr
=
ABC_REALLOC
(
int
,
s
->
proof_clas
.
ptr
,
s
->
proof_clas
.
cap
);
s
->
proof_clas
.
ptr
=
ABC_REALLOC
(
int
,
s
->
proof_clas
.
ptr
,
s
->
proof_clas
.
cap
);
s
->
proof_vars
.
cap
=
(
1
<<
20
);
s
->
proof_vars
.
ptr
=
ABC_REALLOC
(
int
,
s
->
proof_vars
.
ptr
,
s
->
proof_clas
.
cap
);
}
}
return
s
;
return
s
;
}
}
...
@@ -1306,16 +1298,14 @@ void sat_solver2_delete(sat_solver2* s)
...
@@ -1306,16 +1298,14 @@ void sat_solver2_delete(sat_solver2* s)
{
{
satset
*
c
=
clause_read
(
s
,
s
->
iLearntLast
);
satset
*
c
=
clause_read
(
s
,
s
->
iLearntLast
);
// report statistics
// report statistics
assert
(
veci_size
(
&
s
->
proof_clas
)
==
veci_size
(
&
s
->
proof_vars
)
);
printf
(
"Used %6.2f Mb for proof-logging. Unit clauses = %d.
\n
"
,
2
.
0
*
veci_size
(
&
s
->
proof_clas
)
/
(
1
<<
20
),
s
->
nUnits
);
printf
(
"Used %6.2f Mb for proof-logging. Unit clauses = %d.
\n
"
,
8
.
0
*
veci_size
(
&
s
->
proof_clas
)
/
(
1
<<
20
),
s
->
nUnits
);
Sat_ProofTest
(
Sat_ProofTest
(
&
s
->
clauses
,
// clauses
&
s
->
clauses
,
// clauses
&
s
->
proof_clas
,
// proof clauses
&
s
->
proof_clas
,
// proof clauses
&
s
->
proof_vars
,
// proof variables
NULL
,
// proof roots
NULL
,
// proof roots
veci_begin
(
&
s
->
claProofs
)[
c
->
Id
]
,
// one root
veci_begin
(
&
s
->
claProofs
)[
c
->
Id
]
// one root
&
s
->
glob_vars
);
// global variables (for interpolation)
);
// delete vectors
// delete vectors
veci_delete
(
&
s
->
order
);
veci_delete
(
&
s
->
order
);
...
@@ -1328,9 +1318,7 @@ void sat_solver2_delete(sat_solver2* s)
...
@@ -1328,9 +1318,7 @@ void sat_solver2_delete(sat_solver2* s)
veci_delete
(
&
s
->
mark_levels
);
veci_delete
(
&
s
->
mark_levels
);
veci_delete
(
&
s
->
min_lit_order
);
veci_delete
(
&
s
->
min_lit_order
);
veci_delete
(
&
s
->
min_step_order
);
veci_delete
(
&
s
->
min_step_order
);
veci_delete
(
&
s
->
glob_vars
);
veci_delete
(
&
s
->
proof_clas
);
veci_delete
(
&
s
->
proof_clas
);
veci_delete
(
&
s
->
proof_vars
);
veci_delete
(
&
s
->
claActs
);
veci_delete
(
&
s
->
claActs
);
veci_delete
(
&
s
->
claProofs
);
veci_delete
(
&
s
->
claProofs
);
veci_delete
(
&
s
->
clauses
);
veci_delete
(
&
s
->
clauses
);
...
...
src/sat/bsat/satSolver2.h
View file @
565fefec
...
@@ -68,8 +68,8 @@ extern void sat_solver2_store_mark_clauses_a( sat_solver2 * s );
...
@@ -68,8 +68,8 @@ extern void sat_solver2_store_mark_clauses_a( sat_solver2 * s );
extern
void
*
sat_solver2_store_release
(
sat_solver2
*
s
);
extern
void
*
sat_solver2_store_release
(
sat_solver2
*
s
);
// global variables
// global variables
extern
int
var_is_
global
(
sat_solver2
*
s
,
int
v
);
extern
int
var_is_
partA
(
sat_solver2
*
s
,
int
v
);
extern
void
var_set_
global
(
sat_solver2
*
s
,
int
v
,
int
glo
);
extern
void
var_set_
partA
(
sat_solver2
*
s
,
int
v
,
int
partA
);
// clause grouping (these two only work after creating a clause before the solver is called)
// clause grouping (these two only work after creating a clause before the solver is called)
extern
int
clause_is_partA
(
sat_solver2
*
s
,
int
handle
);
extern
int
clause_is_partA
(
sat_solver2
*
s
,
int
handle
);
extern
void
clause_set_partA
(
sat_solver2
*
s
,
int
handle
,
int
partA
);
extern
void
clause_set_partA
(
sat_solver2
*
s
,
int
handle
,
int
partA
);
...
@@ -143,7 +143,6 @@ struct sat_solver2_t
...
@@ -143,7 +143,6 @@ struct sat_solver2_t
// proof logging
// proof logging
veci
proof_clas
;
// sequence of proof clauses
veci
proof_clas
;
// sequence of proof clauses
veci
proof_vars
;
// sequence of proof variables
int
iStartChain
;
// temporary variable to remember beginning of the current chain in proof logging
int
iStartChain
;
// temporary variable to remember beginning of the current chain in proof logging
int
nUnits
;
// the total number of unit clauses
int
nUnits
;
// the total number of unit clauses
...
@@ -177,9 +176,13 @@ static inline void satset_print (satset * c) {
...
@@ -177,9 +176,13 @@ static inline void satset_print (satset * c) {
printf
(
"}
\n
"
);
printf
(
"}
\n
"
);
}
}
#define satset_foreach_entry( p, c, h, s ) \
#define satset_foreach_entry( p, c, h, s ) \
for ( h = s; (h < veci_size(p)) && (((c) = satset_read(p, h)), 1); h += satset_size(c->nEnts) )
for ( h = s; (h < veci_size(p)) && (((c) = satset_read(p, h)), 1); h += satset_size(c->nEnts) )
#define satset_foreach_var( p, var, i ) \
for ( i = 0; (i < (int)(p)->nEnts) && ((var) = lit_var((p)->pEnts[i])); i++ )
#define satset_foreach_lit( p, lit, i ) \
for ( i = 0; (i < (int)(p)->nEnts) && ((lit) = (p)->pEnts[i]); i++ )
//=================================================================================================
//=================================================================================================
// Public APIs:
// Public APIs:
...
@@ -245,7 +248,7 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom)
...
@@ -245,7 +248,7 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom)
return
fNotUseRandomOld
;
return
fNotUseRandomOld
;
}
}
extern
void
Sat_ProofTest
(
veci
*
pClauses
,
veci
*
pProof
,
veci
*
p
Vars
,
veci
*
pRoots
,
int
hRoot
,
veci
*
pGlobVars
);
extern
void
Sat_ProofTest
(
veci
*
pClauses
,
veci
*
pProof
,
veci
*
p
Roots
,
int
hRoot
);
ABC_NAMESPACE_HEADER_END
ABC_NAMESPACE_HEADER_END
...
...
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