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
6c766b4f
Commit
6c766b4f
authored
Dec 10, 2011
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementing rollback in the updated solver.
parent
dea5708d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
13 deletions
+24
-13
src/sat/bsat/satProof.c
+12
-12
src/sat/bsat/satSolver2.c
+0
-0
src/sat/bsat/satSolver2.h
+12
-1
No files found.
src/sat/bsat/satProof.c
View file @
6c766b4f
...
...
@@ -215,7 +215,7 @@ void Proof_CleanCollected( Vec_Int_t * vProof, Vec_Int_t * vUsed )
SeeAlso []
***********************************************************************/
void
Proof_CollectUsed_iter
(
Vec_Int_t
*
p
,
satset
*
pNode
,
Vec_Int_t
*
vUsed
,
Vec_Int_t
*
vStack
)
void
Proof_CollectUsed_iter
(
Vec_Int_t
*
vProof
,
satset
*
pNode
,
Vec_Int_t
*
vUsed
,
Vec_Int_t
*
vStack
)
{
satset
*
pNext
;
int
i
,
hNode
;
...
...
@@ -223,7 +223,7 @@ void Proof_CollectUsed_iter( Vec_Int_t * p, satset * pNode, Vec_Int_t * vUsed, V
return
;
// start with node
pNode
->
Id
=
1
;
Vec_IntPush
(
vStack
,
Proof_NodeHandle
(
p
,
pNode
)
<<
1
);
Vec_IntPush
(
vStack
,
Proof_NodeHandle
(
vProof
,
pNode
)
<<
1
);
// perform DFS search
while
(
Vec_IntSize
(
vStack
)
)
{
...
...
@@ -236,12 +236,12 @@ void Proof_CollectUsed_iter( Vec_Int_t * p, satset * pNode, Vec_Int_t * vUsed, V
// extracted first time
Vec_IntPush
(
vStack
,
hNode
^
1
);
// add second time
// add its anticedents ;
pNode
=
Proof_NodeRead
(
p
,
hNode
>>
1
);
Proof_NodeForeachFanin
(
p
,
pNode
,
pNext
,
i
)
pNode
=
Proof_NodeRead
(
vProof
,
hNode
>>
1
);
Proof_NodeForeachFanin
(
vProof
,
pNode
,
pNext
,
i
)
if
(
pNext
&&
!
pNext
->
Id
)
{
pNext
->
Id
=
1
;
Vec_IntPush
(
vStack
,
Proof_NodeHandle
(
p
,
pNext
)
<<
1
);
// add first time
Vec_IntPush
(
vStack
,
Proof_NodeHandle
(
vProof
,
pNext
)
<<
1
);
// add first time
}
}
}
...
...
@@ -314,17 +314,17 @@ Vec_Int_t * Proof_CollectUsedIter( Vec_Int_t * vProof, Vec_Int_t * vRoots, int h
SeeAlso []
***********************************************************************/
void
Proof_CollectUsed_rec
(
Vec_Int_t
*
p
,
satset
*
pNode
,
Vec_Int_t
*
vUsed
)
void
Proof_CollectUsed_rec
(
Vec_Int_t
*
vProof
,
satset
*
pNode
,
Vec_Int_t
*
vUsed
)
{
satset
*
pNext
;
int
i
;
if
(
pNode
->
Id
)
return
;
pNode
->
Id
=
1
;
Proof_NodeForeachFanin
(
p
,
pNode
,
pNext
,
i
)
Proof_NodeForeachFanin
(
vProof
,
pNode
,
pNext
,
i
)
if
(
pNext
&&
!
pNext
->
Id
)
Proof_CollectUsed_rec
(
p
,
pNext
,
vUsed
);
Vec_IntPush
(
vUsed
,
Proof_NodeHandle
(
p
,
pNode
)
);
Proof_CollectUsed_rec
(
vProof
,
pNext
,
vUsed
);
Vec_IntPush
(
vUsed
,
Proof_NodeHandle
(
vProof
,
pNode
)
);
}
/**Function*************************************************************
...
...
@@ -637,7 +637,7 @@ void Sat_ProofCheck( sat_solver2 * s )
{
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
clauses
,
s
->
hLearntLast
)
->
Id
];
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Rec_Int_t
*
vResolves
;
Vec_Int_t
*
vUsed
,
*
vTemp
;
...
...
@@ -731,7 +731,7 @@ void * Sat_ProofInterpolant( sat_solver2 * s, void * pGloVars )
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
Vec_Int_t
*
vGlobVars
=
(
Vec_Int_t
*
)
pGloVars
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
clauses
,
s
->
hLearntLast
)
->
Id
];
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Int_t
*
vUsed
,
*
vCore
,
*
vCoreNums
,
*
vVarMap
;
satset
*
pNode
,
*
pFanin
;
...
...
@@ -822,7 +822,7 @@ void * Sat_ProofCore( sat_solver2 * s )
{
Vec_Int_t
*
vClauses
=
(
Vec_Int_t
*
)
&
s
->
clauses
;
Vec_Int_t
*
vProof
=
(
Vec_Int_t
*
)
&
s
->
proofs
;
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
clauses
,
s
->
hLearntLast
)
->
Id
];
int
hRoot
=
veci_begin
(
&
s
->
claProofs
)[
satset_read
(
&
s
->
learnts
,
s
->
hLearntLast
>>
1
)
->
Id
];
Vec_Int_t
*
vCore
,
*
vUsed
;
// collect visited clauses
...
...
src/sat/bsat/satSolver2.c
View file @
6c766b4f
This diff is collapsed.
Click to expand it.
src/sat/bsat/satSolver2.h
View file @
6c766b4f
...
...
@@ -46,6 +46,7 @@ extern void sat_solver2_delete(sat_solver2* s);
extern
int
sat_solver2_addclause
(
sat_solver2
*
s
,
lit
*
begin
,
lit
*
end
);
extern
int
sat_solver2_simplify
(
sat_solver2
*
s
);
extern
int
sat_solver2_solve
(
sat_solver2
*
s
,
lit
*
begin
,
lit
*
end
,
ABC_INT64_T
nConfLimit
,
ABC_INT64_T
nInsLimit
,
ABC_INT64_T
nConfLimitGlobal
,
ABC_INT64_T
nInsLimitGlobal
);
extern
void
sat_solver2_rollback
(
sat_solver2
*
s
);
extern
void
sat_solver2_setnvars
(
sat_solver2
*
s
,
int
n
);
...
...
@@ -112,9 +113,12 @@ struct sat_solver2_t
// clauses
veci
clauses
;
// clause memory
veci
learnts
;
// learnt memory
veci
*
wlists
;
// watcher lists (for each literal)
int
hLearntFirst
;
// the first learnt clause
int
hClausePivot
;
// the pivot among problem clause
int
hLearntPivot
;
// the pivot among learned clause
int
hLearntLast
;
// in proof-logging mode, the ID of the final conflict clause (conf_final)
int
iVarPivot
;
// the pivot among the variables
veci
claActs
;
// clause activities
veci
claProofs
;
// clause proofs
...
...
@@ -245,6 +249,13 @@ static inline int sat_solver2_set_random(sat_solver2* s, int fNotUseRandom)
return
fNotUseRandomOld
;
}
static
inline
int
sat_solver2_bookmark
(
sat_solver2
*
s
)
{
s
->
hLearntPivot
=
veci_size
(
&
s
->
learnts
);
s
->
hClausePivot
=
veci_size
(
&
s
->
clauses
);
s
->
iVarPivot
=
s
->
size
;
}
ABC_NAMESPACE_HEADER_END
#endif
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