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
12d9aaa7
Commit
12d9aaa7
authored
Mar 03, 2012
by
Niklas Een
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some fixes for VTA under Bridge.
parent
5b800e05
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
35 deletions
+34
-35
src/misc/util/utilBridge.c
+1
-1
src/sat/bsat/satSolver2.c
+33
-34
No files found.
src/misc/util/utilBridge.c
View file @
12d9aaa7
...
...
@@ -129,7 +129,7 @@ void Gia_CreateHeader( FILE * pFile, int Type, int Size, unsigned char * pBuffer
fprintf
(
pFile
,
"%.16d"
,
Size
);
fprintf
(
pFile
,
" "
);
RetValue
=
fwrite
(
pBuffer
,
Size
,
1
,
pFile
);
assert
(
RetValue
==
1
);
assert
(
RetValue
==
1
||
Size
==
0
);
fflush
(
pFile
);
}
...
...
src/sat/bsat/satSolver2.c
View file @
12d9aaa7
...
...
@@ -44,7 +44,7 @@ static void printlits(lit* begin, lit* end)
{
int
i
;
for
(
i
=
0
;
i
<
end
-
begin
;
i
++
)
printf
(
L_LIT
" "
,
L_lit
(
begin
[
i
]));
Abc_Print
(
1
,
L_LIT
" "
,
L_lit
(
begin
[
i
]));
}
//=================================================================================================
...
...
@@ -300,7 +300,7 @@ static inline void act_clause_rescale(sat_solver2* s) {
s
->
cla_inc
*=
(
float
)
1e-20
;
Total
+=
clock
()
-
clk
;
printf
(
"Rescaling... Cla inc = %10.3f Conf = %10d "
,
s
->
cla_inc
,
s
->
stats
.
conflicts
);
Abc_Print
(
1
,
"Rescaling... Cla inc = %10.3f Conf = %10d "
,
s
->
cla_inc
,
s
->
stats
.
conflicts
);
Abc_PrintTime
(
1
,
"Time"
,
Total
);
}
static
inline
void
act_var_bump
(
sat_solver2
*
s
,
int
v
)
{
...
...
@@ -340,7 +340,7 @@ static inline void act_clause_rescale(sat_solver2* s) {
s
->
cla_inc
=
Abc_MaxInt
(
s
->
cla_inc
,
(
1
<<
10
)
);
// Total += clock() - clk;
//
printf(
"Rescaling... Cla inc = %5d Conf = %10d ", s->cla_inc, s->stats.conflicts );
//
Abc_Print(1,
"Rescaling... Cla inc = %5d Conf = %10d ", s->cla_inc, s->stats.conflicts );
// Abc_PrintTime( 1, "Time", Total );
}
static
inline
void
act_var_bump
(
sat_solver2
*
s
,
int
v
)
{
...
...
@@ -382,7 +382,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
{
int
nMemAlloc
=
s
->
learnts
.
cap
?
2
*
s
->
learnts
.
cap
:
(
1
<<
20
);
s
->
learnts
.
ptr
=
ABC_REALLOC
(
int
,
veci_begin
(
&
s
->
learnts
),
nMemAlloc
);
//
printf(
"Reallocing from %d to %d...\n", s->learnts.cap, nMemAlloc );
//
Abc_Print(1,
"Reallocing from %d to %d...\n", s->learnts.cap, nMemAlloc );
s
->
learnts
.
cap
=
nMemAlloc
;
if
(
veci_size
(
&
s
->
learnts
)
==
0
)
veci_push
(
&
s
->
learnts
,
-
1
);
...
...
@@ -409,7 +409,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
s
->
learnts
.
size
+=
satset_size
(
nLits
);
assert
(
veci_size
(
&
s
->
learnts
)
<=
s
->
learnts
.
cap
);
assert
(((
ABC_PTRUINT_T
)
c
&
3
)
==
0
);
//
printf(
"Clause for proof %d: ", proof_id );
//
Abc_Print(1,
"Clause for proof %d: ", proof_id );
// satset_print( c );
// remember the last one
s
->
hLearntLast
=
Cid
;
...
...
@@ -420,7 +420,7 @@ static int clause_create_new(sat_solver2* s, lit* begin, lit* end, int learnt, i
{
int
nMemAlloc
=
s
->
clauses
.
cap
?
2
*
s
->
clauses
.
cap
:
(
1
<<
20
);
s
->
clauses
.
ptr
=
ABC_REALLOC
(
int
,
veci_begin
(
&
s
->
clauses
),
nMemAlloc
);
//
printf(
"Reallocing from %d to %d...\n", s->clauses.cap, nMemAlloc );
//
Abc_Print(1,
"Reallocing from %d to %d...\n", s->clauses.cap, nMemAlloc );
s
->
clauses
.
cap
=
nMemAlloc
;
if
(
veci_size
(
&
s
->
clauses
)
==
0
)
veci_push
(
&
s
->
clauses
,
-
1
);
...
...
@@ -457,14 +457,14 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from)
{
int
v
=
lit_var
(
l
);
#ifdef VERBOSEDEBUG
printf
(
L_IND
"enqueue("
L_LIT
")
\n
"
,
L_ind
,
L_lit
(
l
));
Abc_Print
(
1
,
L_IND
"enqueue("
L_LIT
")
\n
"
,
L_ind
,
L_lit
(
l
));
#endif
if
(
var_value
(
s
,
v
)
!=
varX
)
return
var_value
(
s
,
v
)
==
lit_sign
(
l
);
else
{
// New fact -- store it.
#ifdef VERBOSEDEBUG
printf
(
L_IND
"bind("
L_LIT
")
\n
"
,
L_ind
,
L_lit
(
l
));
Abc_Print
(
1
,
L_IND
"bind("
L_LIT
")
\n
"
,
L_ind
,
L_lit
(
l
));
#endif
var_set_value
(
s
,
v
,
lit_sign
(
l
)
);
var_set_level
(
s
,
v
,
solver2_dlevel
(
s
)
);
...
...
@@ -475,11 +475,11 @@ static inline int solver2_enqueue(sat_solver2* s, lit l, cla from)
if ( solver2_dlevel(s) == 0 )
{
satset * c = from ? clause_read( s, from ) : NULL;
printf(
"Enqueing var %d on level %d with reason clause ", v, solver2_dlevel(s) );
Abc_Print(1,
"Enqueing var %d on level %d with reason clause ", v, solver2_dlevel(s) );
if ( c )
satset_print( c );
else
printf(
"<none>\n" );
Abc_Print(1,
"<none>\n" );
}
*/
return
true
;
...
...
@@ -491,8 +491,8 @@ static inline int solver2_assume(sat_solver2* s, lit l)
assert
(
s
->
qtail
==
s
->
qhead
);
assert
(
var_value
(
s
,
lit_var
(
l
))
==
varX
);
#ifdef VERBOSEDEBUG
printf
(
L_IND
"assume("
L_LIT
") "
,
L_ind
,
L_lit
(
l
));
printf
(
"act = %.20f
\n
"
,
s
->
activity
[
lit_var
(
l
)]
);
Abc_Print
(
1
,
L_IND
"assume("
L_LIT
") "
,
L_ind
,
L_lit
(
l
));
Abc_Print
(
1
,
"act = %.20f
\n
"
,
s
->
activity
[
lit_var
(
l
)]
);
#endif
veci_push
(
&
s
->
trail_lim
,
s
->
qtail
);
return
solver2_enqueue
(
s
,
l
,
0
);
...
...
@@ -764,7 +764,7 @@ static void solver2_logging_order(sat_solver2* s, int x)
x
>>=
1
;
c
=
clause_read
(
s
,
var_reason
(
s
,
x
));
// if ( !c )
//
printf(
"solver2_logging_order(): Error in conflict analysis!!!\n" );
//
Abc_Print(1,
"solver2_logging_order(): Error in conflict analysis!!!\n" );
satset_foreach_var
(
c
,
x
,
i
,
1
){
if
(
!
var_level
(
s
,
x
)
||
(
var_tag
(
s
,
x
)
&
1
)
)
continue
;
...
...
@@ -886,8 +886,8 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
#endif
#ifdef VERBOSEDEBUG
printf
(
L_IND
"Learnt {"
,
L_ind
);
for
(
i
=
0
;
i
<
veci_size
(
learnt
);
i
++
)
printf
(
" "
L_LIT
,
L_lit
(
lits
[
i
]));
Abc_Print
(
1
,
L_IND
"Learnt {"
,
L_ind
);
for
(
i
=
0
;
i
<
veci_size
(
learnt
);
i
++
)
Abc_Print
(
1
,
" "
L_LIT
,
L_lit
(
lits
[
i
]));
#endif
if
(
veci_size
(
learnt
)
>
1
){
lit
tmp
;
...
...
@@ -906,7 +906,7 @@ static int solver2_analyze(sat_solver2* s, satset* c, veci* learnt)
#ifdef VERBOSEDEBUG
{
int
lev
=
veci_size
(
learnt
)
>
1
?
var_level
(
s
,
lit_var
(
lits
[
1
]))
:
0
;
printf
(
" } at level %d
\n
"
,
lev
);
Abc_Print
(
1
,
" } at level %d
\n
"
,
lev
);
}
#endif
return
proof_id
;
...
...
@@ -1029,7 +1029,7 @@ static lbool solver2_search(sat_solver2* s, ABC_INT64_T nof_conflicts)
int
blevel
;
#ifdef VERBOSEDEBUG
printf
(
L_IND
"**CONFLICT**
\n
"
,
L_ind
);
Abc_Print
(
1
,
L_IND
"**CONFLICT**
\n
"
,
L_ind
);
#endif
s
->
stats
.
conflicts
++
;
conflictC
++
;
if
(
solver2_dlevel
(
s
)
<=
s
->
root_level
){
...
...
@@ -1242,7 +1242,7 @@ void sat_solver2_delete(sat_solver2* s)
if
(
fVerify
)
{
veci
*
pCore
=
(
veci
*
)
Sat_ProofCore
(
s
);
printf
(
"UNSAT core contains %d clauses (%6.2f %%).
\n
"
,
veci_size
(
pCore
),
100
.
0
*
veci_size
(
pCore
)
/
veci_size
(
&
s
->
clauses
)
);
Abc_Print
(
1
,
"UNSAT core contains %d clauses (%6.2f %%).
\n
"
,
veci_size
(
pCore
),
100
.
0
*
veci_size
(
pCore
)
/
veci_size
(
&
s
->
clauses
)
);
veci_delete
(
pCore
);
ABC_FREE
(
pCore
);
if
(
s
->
fProofLogging
)
...
...
@@ -1250,7 +1250,7 @@ void sat_solver2_delete(sat_solver2* s)
}
// report statistics
printf
(
"Used %6.2f Mb for proof-logging. Unit clauses = %d.
\n
"
,
1
.
0
*
Vec_SetMemory
(
&
s
->
Proofs
)
/
(
1
<<
20
),
s
->
nUnits
);
Abc_Print
(
1
,
"Used %6.2f Mb for proof-logging. Unit clauses = %d.
\n
"
,
1
.
0
*
Vec_SetMemory
(
&
s
->
Proofs
)
/
(
1
<<
20
),
s
->
nUnits
);
// delete vectors
veci_delete
(
&
s
->
order
);
...
...
@@ -1390,8 +1390,8 @@ void luby2_test()
{
int
i
;
for
(
i
=
0
;
i
<
20
;
i
++
)
printf
(
"%d "
,
(
int
)
luby2
(
2
,
i
)
);
printf
(
"
\n
"
);
Abc_Print
(
1
,
"%d "
,
(
int
)
luby2
(
2
,
i
)
);
Abc_Print
(
1
,
"
\n
"
);
}
...
...
@@ -1434,7 +1434,7 @@ void sat_solver2_reducedb(sat_solver2* s)
}
// report the results
if
(
s
->
fVerbose
)
printf
(
"reduceDB: Keeping %7d out of %7d clauses (%5.2f %%) "
,
Abc_Print
(
1
,
"reduceDB: Keeping %7d out of %7d clauses (%5.2f %%) "
,
veci_size
(
&
s
->
learnt_live
),
s
->
stats
.
learnts
,
100
.
0
*
veci_size
(
&
s
->
learnt_live
)
/
s
->
stats
.
learnts
);
// remap clause proofs and clauses
...
...
@@ -1631,7 +1631,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose )
if
(
(
pArray
[
k
]
>>
1
)
==
Hand
)
{
if
(
fVerbose
)
printf
(
"Clause found in list %d at position %d.
\n
"
,
i
,
k
);
Abc_Print
(
1
,
"Clause found in list %d at position %d.
\n
"
,
i
,
k
);
Found
=
1
;
break
;
}
...
...
@@ -1639,7 +1639,7 @@ int sat_solver2_find_clause( sat_solver2* s, int Hand, int fVerbose )
if
(
Found
==
0
)
{
if
(
fVerbose
)
printf
(
"Clause with handle %d is not found.
\n
"
,
Hand
);
Abc_Print
(
1
,
"Clause with handle %d is not found.
\n
"
,
Hand
);
}
return
Found
;
}
...
...
@@ -1659,16 +1659,16 @@ void sat_solver2_verify( sat_solver2* s )
}
if
(
k
==
(
int
)
c
->
nEnts
)
{
printf
(
"Clause %d is not satisfied. "
,
c
->
Id
);
Abc_Print
(
1
,
"Clause %d is not satisfied. "
,
c
->
Id
);
satset_print
(
c
);
sat_solver2_find_clause
(
s
,
satset_handle
(
&
s
->
clauses
,
c
),
1
);
Counter
++
;
}
}
if
(
Counter
!=
0
)
printf
(
"Verification failed!
\n
"
);
Abc_Print
(
1
,
"Verification failed!
\n
"
);
// else
//
printf(
"Verification passed.\n" );
//
Abc_Print(1,
"Verification passed.\n" );
}
...
...
@@ -1775,16 +1775,16 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
assert
(
s
->
root_level
==
solver2_dlevel
(
s
));
if
(
s
->
verbosity
>=
1
){
printf
(
"==================================[MINISAT]===================================
\n
"
);
printf
(
"| Conflicts | ORIGINAL | LEARNT | Progress |
\n
"
);
printf
(
"| | Clauses Literals | Limit Clauses Literals Lit/Cl | |
\n
"
);
printf
(
"==============================================================================
\n
"
);
Abc_Print
(
1
,
"==================================[MINISAT]===================================
\n
"
);
Abc_Print
(
1
,
"| Conflicts | ORIGINAL | LEARNT | Progress |
\n
"
);
Abc_Print
(
1
,
"| | Clauses Literals | Limit Clauses Literals Lit/Cl | |
\n
"
);
Abc_Print
(
1
,
"==============================================================================
\n
"
);
}
while
(
status
==
l_Undef
){
if
(
s
->
verbosity
>=
1
)
{
printf
(
"| %9.0f | %7.0f %8.0f | %7.0f %7.0f %8.0f %7.1f | %6.3f %% |
\n
"
,
Abc_Print
(
1
,
"| %9.0f | %7.0f %8.0f | %7.0f %7.0f %8.0f %7.1f | %6.3f %% |
\n
"
,
(
double
)
s
->
stats
.
conflicts
,
(
double
)
s
->
stats
.
clauses
,
(
double
)
s
->
stats
.
clauses_literals
,
...
...
@@ -1809,7 +1809,7 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
break
;
}
if
(
s
->
verbosity
>=
1
)
printf
(
"==============================================================================
\n
"
);
Abc_Print
(
1
,
"==============================================================================
\n
"
);
solver2_canceluntil
(
s
,
0
);
// assert( s->qhead == s->qtail );
...
...
@@ -1820,4 +1820,3 @@ int sat_solver2_solve(sat_solver2* s, lit* begin, lit* end, ABC_INT64_T nConfLim
ABC_NAMESPACE_IMPL_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