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
d1fa7f7a
Commit
d1fa7f7a
authored
Dec 07, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proof-logging in the updated solver.
parent
565fefec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
39 deletions
+21
-39
src/sat/bsat/satProof.c
+0
-0
src/sat/bsat/satSolver2.c
+18
-33
src/sat/bsat/satSolver2.h
+3
-6
No files found.
src/sat/bsat/satProof.c
View file @
d1fa7f7a
This diff is collapsed.
Click to expand it.
src/sat/bsat/satSolver2.c
View file @
d1fa7f7a
...
...
@@ -600,9 +600,7 @@ static int solver2_analyze_final(sat_solver2* s, satset* conf, int skip_first)
return
-
1
;
proof_chain_start
(
s
,
conf
);
assert
(
veci_size
(
&
s
->
tagged
)
==
0
);
for
(
i
=
skip_first
;
i
<
(
int
)
conf
->
nEnts
;
i
++
)
{
x
=
lit_var
(
conf
->
pEnts
[
i
]);
satset_foreach_var
(
conf
,
x
,
i
,
skip_first
){
if
(
var_level
(
s
,
x
)
)
var_set_tag
(
s
,
x
,
1
);
else
...
...
@@ -616,13 +614,12 @@ static int solver2_analyze_final(sat_solver2* s, satset* conf, int skip_first)
satset
*
c
=
clause_read
(
s
,
var_reason
(
s
,
x
));
if
(
c
){
proof_chain_resolve
(
s
,
c
,
x
);
for
(
j
=
1
;
j
<
(
int
)
c
->
nEnts
;
j
++
)
{
x
=
lit_var
(
c
->
pEnts
[
j
]);
satset_foreach_var
(
c
,
x
,
j
,
1
){
if
(
var_level
(
s
,
x
)
)
var_set_tag
(
s
,
x
,
1
);
else
proof_chain_resolve
(
s
,
NULL
,
x
);
}
}
}
else
{
assert
(
var_level
(
s
,
x
)
);
veci_push
(
&
s
->
conf_final
,
lit_neg
(
s
->
trail
[
i
]));
...
...
@@ -656,8 +653,7 @@ static int solver2_lit_removable_rec(sat_solver2* s, int v)
return
0
;
}
for
(
i
=
1
;
i
<
(
int
)
c
->
nEnts
;
i
++
){
x
=
lit_var
(
c
->
pEnts
[
i
]);
satset_foreach_var
(
c
,
x
,
i
,
1
){
if
(
var_tag
(
s
,
x
)
&
1
)
solver2_lit_removable_rec
(
s
,
x
);
else
{
...
...
@@ -704,8 +700,7 @@ static int solver2_lit_removable(sat_solver2* s, int x)
}
x
>>=
1
;
c
=
clause_read
(
s
,
var_reason
(
s
,
x
));
for
(
i
=
1
;
i
<
(
int
)
c
->
nEnts
;
i
++
){
x
=
lit_var
(
c
->
pEnts
[
i
]);
satset_foreach_var
(
c
,
x
,
i
,
1
){
if
(
var_tag
(
s
,
x
)
||
!
var_level
(
s
,
x
))
continue
;
if
(
!
var_reason
(
s
,
x
)
||
!
var_lev_mark
(
s
,
x
)){
...
...
@@ -740,8 +735,7 @@ static void solver2_logging_order(sat_solver2* s, int x)
c
=
clause_read
(
s
,
var_reason
(
s
,
x
));
// if ( !c )
// printf( "solver2_logging_order(): Error in conflict analysis!!!\n" );
for
(
i
=
1
;
i
<
(
int
)
c
->
nEnts
;
i
++
){
x
=
lit_var
(
c
->
pEnts
[
i
]);
satset_foreach_var
(
c
,
x
,
i
,
1
){
if
(
!
var_level
(
s
,
x
)
||
(
var_tag
(
s
,
x
)
&
1
)
)
continue
;
veci_push
(
&
s
->
stack
,
x
<<
1
);
...
...
@@ -757,11 +751,9 @@ static void solver2_logging_order_rec(sat_solver2* s, int x)
if
(
(
var_tag
(
s
,
x
)
&
8
)
)
return
;
c
=
clause_read
(
s
,
var_reason
(
s
,
x
));
for
(
i
=
1
;
i
<
(
int
)
c
->
nEnts
;
i
++
){
y
=
lit_var
(
c
->
pEnts
[
i
]);
satset_foreach_var
(
c
,
y
,
i
,
1
)
if
(
var_level
(
s
,
y
)
&&
(
var_tag
(
s
,
y
)
&
1
)
==
0
)
solver2_logging_order_rec
(
s
,
y
);
}
var_add_tag
(
s
,
x
,
8
);
veci_push
(
&
s
->
min_step_order
,
x
);
}
...
...
@@ -769,7 +761,7 @@ static void solver2_logging_order_rec(sat_solver2* s, int x)
static
int
solver2_analyze
(
sat_solver2
*
s
,
satset
*
c
,
veci
*
learnt
)
{
int
cnt
=
0
;
lit
p
=
lit_Undef
;
lit
p
=
0
;
int
x
,
ind
=
s
->
qtail
-
1
;
int
proof_id
=
0
;
lit
*
lits
,
*
vars
,
i
,
j
,
k
;
...
...
@@ -784,8 +776,7 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
assert
(
c
!=
0
);
if
(
c
->
learnt
)
act_clause_bump
(
s
,
c
);
for
(
j
=
(
int
)(
p
!=
lit_Undef
);
j
<
(
int
)
c
->
nEnts
;
j
++
){
x
=
lit_var
(
c
->
pEnts
[
j
]);
satset_foreach_var
(
c
,
x
,
j
,
(
int
)(
p
>
0
)
){
assert
(
x
>=
0
&&
x
<
s
->
size
);
if
(
var_tag
(
s
,
x
)
)
continue
;
...
...
@@ -822,7 +813,7 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
// simplify (full)
veci_resize
(
&
s
->
min_lit_order
,
0
);
for
(
i
=
j
=
1
;
i
<
veci_size
(
learnt
);
i
++
){
// if (!solver2_lit_removable( s,lit_var(lits[i]))
)
// if (!solver2_lit_removable( s,lit_var(lits[i])))
if
(
!
solver2_lit_removable_rec
(
s
,
lit_var
(
lits
[
i
])))
// changed to vars!!!
lits
[
j
++
]
=
lits
[
i
];
}
...
...
@@ -834,20 +825,17 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
veci_resize
(
&
s
->
min_step_order
,
0
);
vars
=
veci_begin
(
&
s
->
min_lit_order
);
for
(
i
=
0
;
i
<
veci_size
(
&
s
->
min_lit_order
);
i
++
)
// solver2_logging_order(
s, vars[i]
);
solver2_logging_order_rec
(
s
,
vars
[
i
]
);
// solver2_logging_order(
s, vars[i]
);
solver2_logging_order_rec
(
s
,
vars
[
i
]
);
// add them in the reverse order
vars
=
veci_begin
(
&
s
->
min_step_order
);
for
(
i
=
veci_size
(
&
s
->
min_step_order
);
i
>
0
;
)
{
i
--
;
c
=
clause_read
(
s
,
var_reason
(
s
,
vars
[
i
]));
proof_chain_resolve
(
s
,
c
,
vars
[
i
]
);
for
(
k
=
1
;
k
<
(
int
)
c
->
nEnts
;
k
++
)
{
x
=
lit_var
(
c
->
pEnts
[
k
]);
satset_foreach_var
(
c
,
x
,
k
,
1
)
if
(
var_level
(
s
,
x
)
==
0
)
proof_chain_resolve
(
s
,
NULL
,
x
);
}
}
proof_id
=
proof_chain_stop
(
s
);
}
...
...
@@ -940,13 +928,11 @@ satset* solver2_propagate(sat_solver2* s)
// Did not find watch -- clause is unit under assignment:
if
(
s
->
fProofLogging
&&
solver2_dlevel
(
s
)
==
0
){
int
k
,
proof_id
,
Cid
,
Var
=
lit_var
(
lits
[
0
]);
int
k
,
x
,
proof_id
,
Cid
,
Var
=
lit_var
(
lits
[
0
]);
int
fLitIsFalse
=
(
var_value
(
s
,
Var
)
==
!
lit_sign
(
lits
[
0
]));
// Log production of top-level unit clause:
proof_chain_start
(
s
,
c
);
for
(
k
=
1
;
k
<
(
int
)
c
->
nEnts
;
k
++
)
{
int
x
=
lit_var
(
c
->
pEnts
[
k
]);
satset_foreach_var
(
c
,
x
,
k
,
1
){
assert
(
var_level
(
s
,
x
)
==
0
);
proof_chain_resolve
(
s
,
NULL
,
x
);
}
...
...
@@ -1007,12 +993,11 @@ static void clause_remove(sat_solver2* s, satset* c)
static
lbool
clause_simplify
(
sat_solver2
*
s
,
satset
*
c
)
{
int
i
;
int
i
,
x
;
assert
(
solver2_dlevel
(
s
)
==
0
);
for
(
i
=
0
;
i
<
(
int
)
c
->
nEnts
;
i
++
){
if
(
var_value
(
s
,
lit_var
(
c
->
pEnts
[
i
])
)
==
lit_sign
(
c
->
pEnts
[
i
]))
satset_foreach_var
(
c
,
x
,
i
,
0
)
if
(
var_value
(
s
,
x
)
==
lit_sign
(
c
->
pEnts
[
i
]))
return
l_True
;
}
return
l_False
;
}
...
...
src/sat/bsat/satSolver2.h
View file @
d1fa7f7a
...
...
@@ -176,13 +176,10 @@ static inline void satset_print (satset * c) {
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) )
#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++ )
#define satset_foreach_var( p, var, i, start ) \
for ( i = start; (i < (int)(p)->nEnts) && ((var) = lit_var((p)->pEnts[i])); i++ )
//=================================================================================================
// Public APIs:
...
...
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