@@ -270,7 +270,7 @@ static double distinct_paths (factoring *factoring, unsigned src_lit,
270
270
const unsigned signed_src_lit = src_lit ^ sign ;
271
271
watches * const watches = & WATCHES (signed_src_lit );
272
272
uint64_t ticks =
273
- 1 + kissat_cache_lines (SIZE_STACK (* watches ), sizeof (watch ));
273
+ 1 + kissat_cache_lines (SIZE_WATCHES (* watches ), sizeof (watch ));
274
274
for (all_binary_large_watches (watch , * watches )) {
275
275
if (watch .type .binary ) {
276
276
const unsigned other = watch .binary .lit ;
@@ -559,7 +559,7 @@ static void factorize_next (factoring *factoring, unsigned next,
559
559
assert (min_lit != INVALID_LIT );
560
560
watches * min_watches = all_watches + min_lit ;
561
561
unsigned c_size = c -> size ;
562
- ticks += 1 + kissat_cache_lines (SIZE_STACK (* min_watches ),
562
+ ticks += 1 + kissat_cache_lines (SIZE_WATCHES (* min_watches ),
563
563
sizeof (watch ));
564
564
for (all_binary_large_watches (min_watch , * min_watches )) {
565
565
if (min_watch .type .binary )
@@ -893,7 +893,7 @@ adjust_scores_and_phases_of_fresh_varaibles (factoring *factoring) {
893
893
}
894
894
}
895
895
896
- static void run_factorization (kissat * solver , uint64_t limit ) {
896
+ static bool run_factorization (kissat * solver , uint64_t limit ) {
897
897
factoring factoring ;
898
898
init_factoring (solver , & factoring , limit );
899
899
schedule_factorization (& factoring );
@@ -903,7 +903,7 @@ static void run_factorization (kissat *solver, uint64_t limit) {
903
903
#endif
904
904
uint64_t * ticks = & solver -> statistics .factor_ticks ;
905
905
kissat_extremely_verbose (
906
- solver , "factorization limit of %" PRIu64 " ticks" , limit );
906
+ solver , "factorization limit of %" PRIu64 " ticks" , limit - * ticks );
907
907
while (!done && !kissat_empty_heap (& factoring .schedule )) {
908
908
const unsigned first =
909
909
kissat_pop_max_heap (solver , & factoring .schedule );
@@ -946,9 +946,11 @@ static void run_factorization (kissat *solver, uint64_t limit) {
946
946
}
947
947
release_quotients (& factoring );
948
948
}
949
+ bool completed = kissat_empty_heap (& factoring .schedule );
949
950
adjust_scores_and_phases_of_fresh_varaibles (& factoring );
950
951
release_factoring (& factoring );
951
952
REPORT (!factored , 'f' );
953
+ return completed ;
952
954
}
953
955
954
956
static void connect_clauses_to_factor (kissat * solver ) {
@@ -1069,8 +1071,14 @@ void kissat_factor (kissat *solver) {
1069
1071
if (!GET_OPTION (factor ))
1070
1072
return ;
1071
1073
statistics * s = & solver -> statistics ;
1072
- if (solver -> limits .factor .marked >= s -> literals_factor )
1074
+ if (solver -> limits .factor .marked >= s -> literals_factor ) {
1075
+ kissat_extremely_verbose (
1076
+ solver ,
1077
+ "factorization skipped as no literals have been marked to be added "
1078
+ "(%" PRIu64 " < %" PRIu64 ,
1079
+ solver -> limits .factor .marked , s -> literals_factor );
1073
1080
return ;
1081
+ }
1074
1082
START (factor );
1075
1083
INC (factorizations );
1076
1084
kissat_phase (solver , "factorization" , GET (factorizations ),
@@ -1089,33 +1097,40 @@ void kissat_factor (kissat *solver) {
1089
1097
}
1090
1098
#ifndef QUIET
1091
1099
struct {
1092
- int64_t variables , clauses , ticks ;
1100
+ int64_t variables , binary , clauses , ticks ;
1093
1101
} before , after , delta ;
1094
1102
before .variables = s -> variables_extension + s -> variables_original ;
1095
- before .clauses = BINARY_CLAUSES ;
1103
+ before .binary = BINARY_CLAUSES ;
1104
+ before .clauses = IRREDUNDANT_CLAUSES ;
1096
1105
before .ticks = s -> factor_ticks ;
1097
1106
#endif
1098
1107
kissat_enter_dense_mode (solver , 0 );
1099
1108
connect_clauses_to_factor (solver );
1100
- run_factorization (solver , limit );
1109
+ bool completed = run_factorization (solver , limit );
1101
1110
kissat_resume_sparse_mode (solver , false, 0 );
1102
1111
#ifndef QUIET
1103
1112
after .variables = s -> variables_extension + s -> variables_original ;
1104
- after .clauses = BINARY_CLAUSES ;
1113
+ after .binary = BINARY_CLAUSES ;
1114
+ after .clauses = IRREDUNDANT_CLAUSES ;
1105
1115
after .ticks = s -> factor_ticks ;
1106
1116
delta .variables = after .variables - before .variables ;
1117
+ delta .binary = before .binary - after .binary ;
1107
1118
delta .clauses = before .clauses - after .clauses ;
1108
- delta .ticks = before .ticks - after .ticks ;
1119
+ delta .ticks = after .ticks - before .ticks ;
1109
1120
kissat_very_verbose (solver , "used %f million factorization ticks" ,
1110
1121
delta .ticks * 1e-6 );
1111
1122
kissat_phase (solver , "factorization" , GET (factorizations ),
1112
1123
"introduced %" PRId64 " extension variables %.0f%%" ,
1113
1124
delta .variables ,
1114
1125
kissat_percent (delta .variables , before .variables ));
1115
1126
kissat_phase (solver , "factorization" , GET (factorizations ),
1116
- "removed %" PRId64 " binary clauses %.0f%%" , delta .clauses ,
1127
+ "removed %" PRId64 " binary clauses %.0f%%" , delta .binary ,
1128
+ kissat_percent (delta .binary , before .binary ));
1129
+ kissat_phase (solver , "factorization" , GET (factorizations ),
1130
+ "removed %" PRId64 " large clauses %.0f%%" , delta .clauses ,
1117
1131
kissat_percent (delta .clauses , before .clauses ));
1118
1132
#endif
1119
- solver -> limits .factor .marked = s -> literals_factor ;
1133
+ if (completed )
1134
+ solver -> limits .factor .marked = s -> literals_factor ;
1120
1135
STOP (factor );
1121
1136
}
0 commit comments