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
b743298c
Commit
b743298c
authored
Dec 05, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proof-logging in the updated solver.
parent
df8b6361
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
32 deletions
+34
-32
src/sat/bsat/satProof.c
+29
-32
src/sat/bsat/satSolver2.c
+5
-0
No files found.
src/sat/bsat/satProof.c
View file @
b743298c
...
@@ -223,11 +223,10 @@ Vec_Int_t * Proof_CollectUsed( Vec_Int_t * vProof, Vec_Int_t * vRoots, int hRoot
...
@@ -223,11 +223,10 @@ Vec_Int_t * Proof_CollectUsed( Vec_Int_t * vProof, Vec_Int_t * vRoots, int hRoot
SeeAlso []
SeeAlso []
***********************************************************************/
***********************************************************************/
satset
*
Proof_ResolveOne
(
Vec_Int_t
*
p
,
satset
*
c1
,
satset
*
c2
)
satset
*
Proof_ResolveOne
(
Vec_Int_t
*
p
,
satset
*
c1
,
satset
*
c2
,
Vec_Int_t
*
vTemp
)
{
{
satset
*
c
;
satset
*
c
;
int
i
,
k
,
Id
,
Var
=
-
1
,
Count
=
0
;
int
i
,
k
,
hNode
,
Var
=
-
1
,
Count
=
0
;
// find resolution variable
// find resolution variable
for
(
i
=
0
;
i
<
(
int
)
c1
->
nEnts
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
c1
->
nEnts
;
i
++
)
for
(
k
=
0
;
k
<
(
int
)
c2
->
nEnts
;
k
++
)
for
(
k
=
0
;
k
<
(
int
)
c2
->
nEnts
;
k
++
)
...
@@ -247,31 +246,21 @@ satset * Proof_ResolveOne( Vec_Int_t * p, satset * c1, satset * c2 )
...
@@ -247,31 +246,21 @@ satset * Proof_ResolveOne( Vec_Int_t * p, satset * c1, satset * c2 )
return
NULL
;
return
NULL
;
}
}
// perform resolution
// perform resolution
Id
=
Vec_IntSize
(
p
);
Vec_IntClear
(
vTemp
);
Vec_IntPush
(
p
,
0
);
// placeholder
Vec_IntPush
(
p
,
0
);
for
(
i
=
0
;
i
<
(
int
)
c1
->
nEnts
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
c1
->
nEnts
;
i
++
)
{
if
(
(
c1
->
pEnts
[
i
]
>>
1
)
!=
Var
)
if
(
(
c1
->
pEnts
[
i
]
>>
1
)
==
Var
)
Vec_IntPush
(
vTemp
,
c1
->
pEnts
[
i
]
);
continue
;
for
(
k
=
Id
+
2
;
k
<
Vec_IntSize
(
p
);
k
++
)
if
(
p
->
pArray
[
k
]
==
c1
->
pEnts
[
i
]
)
break
;
if
(
k
==
Vec_IntSize
(
p
)
)
Vec_IntPush
(
p
,
c1
->
pEnts
[
i
]
);
}
for
(
i
=
0
;
i
<
(
int
)
c2
->
nEnts
;
i
++
)
for
(
i
=
0
;
i
<
(
int
)
c2
->
nEnts
;
i
++
)
{
if
(
(
c2
->
pEnts
[
i
]
>>
1
)
!=
Var
)
if
(
(
c2
->
pEnts
[
i
]
>>
1
)
==
Var
)
Vec_IntPushUnique
(
vTemp
,
c2
->
pEnts
[
i
]
);
continue
;
// move to the new one
for
(
k
=
Id
+
2
;
k
<
Vec_IntSize
(
p
);
k
++
)
hNode
=
Vec_IntSize
(
p
);
if
(
p
->
pArray
[
k
]
==
c2
->
pEnts
[
i
]
)
Vec_IntPush
(
p
,
0
);
// placeholder
break
;
Vec_IntPush
(
p
,
0
);
if
(
k
==
Vec_IntSize
(
p
)
)
Vec_IntForEachEntry
(
vTemp
,
Var
,
i
)
Vec_IntPush
(
p
,
c2
->
pEnts
[
i
]
);
Vec_IntPush
(
p
,
Var
);
}
c
=
Proof_NodeRead
(
p
,
hNode
);
c
=
Proof_NodeRead
(
p
,
Id
);
c
->
nEnts
=
Vec_IntSize
(
vTemp
);
c
->
nEnts
=
Vec_IntSize
(
p
)
-
Id
-
2
;
return
c
;
return
c
;
}
}
...
@@ -310,13 +299,14 @@ satset * Proof_CheckReadOne( Vec_Int_t * vClauses, Vec_Int_t * vProof, Vec_Int_t
...
@@ -310,13 +299,14 @@ satset * Proof_CheckReadOne( Vec_Int_t * vClauses, Vec_Int_t * vProof, Vec_Int_t
***********************************************************************/
***********************************************************************/
void
Proof_Check
(
Vec_Int_t
*
vClauses
,
Vec_Int_t
*
vProof
,
int
hRoot
)
void
Proof_Check
(
Vec_Int_t
*
vClauses
,
Vec_Int_t
*
vProof
,
int
hRoot
)
{
{
Vec_Int_t
*
vUsed
,
*
vResolves
;
Vec_Int_t
*
vUsed
,
*
vResolves
,
*
vTemp
;
satset
*
pSet
,
*
pSet0
,
*
pSet1
;
satset
*
pSet
,
*
pSet0
,
*
pSet1
;
int
i
,
k
,
Counter
=
0
;
int
i
,
k
,
Counter
=
0
,
clk
=
clock
()
;
// collect visited clauses
// collect visited clauses
vUsed
=
Proof_CollectUsed
(
vProof
,
NULL
,
hRoot
);
vUsed
=
Proof_CollectUsed
(
vProof
,
NULL
,
hRoot
);
Proof_CleanCollected
(
vProof
,
vUsed
);
Proof_CleanCollected
(
vProof
,
vUsed
);
// perform resolution steps
// perform resolution steps
vTemp
=
Vec_IntAlloc
(
1000
);
vResolves
=
Vec_IntAlloc
(
1000
);
vResolves
=
Vec_IntAlloc
(
1000
);
Vec_IntPush
(
vResolves
,
-
1
);
Vec_IntPush
(
vResolves
,
-
1
);
Proof_ForeachNodeVec
(
vUsed
,
vProof
,
pSet
,
i
)
Proof_ForeachNodeVec
(
vUsed
,
vProof
,
pSet
,
i
)
...
@@ -325,17 +315,24 @@ void Proof_Check( Vec_Int_t * vClauses, Vec_Int_t * vProof, int hRoot )
...
@@ -325,17 +315,24 @@ void Proof_Check( Vec_Int_t * vClauses, Vec_Int_t * vProof, int hRoot )
for
(
k
=
1
;
k
<
(
int
)
pSet
->
nEnts
;
k
++
)
for
(
k
=
1
;
k
<
(
int
)
pSet
->
nEnts
;
k
++
)
{
{
pSet1
=
Proof_CheckReadOne
(
vClauses
,
vProof
,
vResolves
,
pSet
->
pEnts
[
k
]
);
pSet1
=
Proof_CheckReadOne
(
vClauses
,
vProof
,
vResolves
,
pSet
->
pEnts
[
k
]
);
pSet0
=
Proof_ResolveOne
(
vResolves
,
pSet0
,
pSet1
);
pSet0
=
Proof_ResolveOne
(
vResolves
,
pSet0
,
pSet1
,
vTemp
);
}
}
pSet
->
Id
=
Proof_NodeHandle
(
vResolves
,
pSet0
);
pSet
->
Id
=
Proof_NodeHandle
(
vResolves
,
pSet0
);
//printf( "Clause for proof %d: ", Vec_IntEntry(vUsed, i) );
//satset_print( pSet0 );
Counter
++
;
Counter
++
;
}
}
Vec_IntFree
(
vTemp
);
// clean the proof
// clean the proof
Proof_ForeachNodeVec
(
vUsed
,
vProof
,
pSet
,
i
)
Proof_CleanCollected
(
vProof
,
vUsed
);
pSet
->
Id
=
0
;
// compare the final clause
// compare the final clause
printf
(
"Used %6.2f Mb for resolvents.
\n
"
,
4
.
0
*
Vec_IntSize
(
vResolves
)
/
(
1
<<
20
)
);
if
(
pSet0
->
nEnts
>
0
)
if
(
pSet0
->
nEnts
>
0
)
printf
(
"Cound not derive the empty clause
\n
"
);
printf
(
"Cound not derive the empty clause. "
);
else
printf
(
"Proof verification successful. "
);
Abc_PrintTime
(
1
,
"Time"
,
clock
()
-
clk
);
// cleanup
Vec_IntFree
(
vResolves
);
Vec_IntFree
(
vResolves
);
Vec_IntFree
(
vUsed
);
Vec_IntFree
(
vUsed
);
}
}
...
...
src/sat/bsat/satSolver2.c
View file @
b743298c
...
@@ -411,6 +411,9 @@ static int clause_new(sat_solver2* s, lit* begin, lit* end, int learnt, int proo
...
@@ -411,6 +411,9 @@ static int clause_new(sat_solver2* s, lit* begin, lit* end, int learnt, int proo
veci_push
(
&
s
->
claProofs
,
proof_id
);
veci_push
(
&
s
->
claProofs
,
proof_id
);
if
(
nLits
>
2
)
if
(
nLits
>
2
)
act_clause_bump
(
s
,
c
);
act_clause_bump
(
s
,
c
);
// printf( "Clause for proof %d: ", proof_id );
// satset_print( c );
}
}
else
else
{
{
...
@@ -672,6 +675,8 @@ static int solver2_lit_removable_rec(sat_solver2* s, int v)
...
@@ -672,6 +675,8 @@ static int solver2_lit_removable_rec(sat_solver2* s, int v)
}
}
// if (pfl && visit[p0] & 1){
// if (pfl && visit[p0] & 1){
// result.push(p0); }
// result.push(p0); }
if
(
s
->
fProofLogging
&&
(
var_tag
(
s
,
v
)
&
1
)
)
veci_push
(
&
s
->
min_lit_order
,
v
);
var_add_tag
(
s
,
v
,
6
);
var_add_tag
(
s
,
v
,
6
);
return
1
;
return
1
;
}
}
...
...
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