Skip to content

Commit

Permalink
clear bool values
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-irfan committed Nov 15, 2024
1 parent 21f876b commit 6708397
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/mcsat/trail.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,24 @@ void trail_copy_unassigned_cache(mcsat_trail_t* trail, mcsat_model_t* to_cache,
}
}

inline static
void trail_clear_unassigned_bool_cache(mcsat_trail_t* trail, mcsat_model_t* cache) {
for (variable_t var = 0; var < cache->size; ++var) {
if (!trail_has_value(trail, var) && mcsat_model_get_value(cache, var)->type == VALUE_BOOLEAN) {
mcsat_model_unset_value(cache, var);
}
}
}

void trail_recache(mcsat_trail_t* trail, uint32_t round) {
// clear target or copy best into target at each recache iteration
switch (round % 2) {
case 0:
// unlike modern SAT solvers, we don't clear model cache (called phase saving in SAT solvers)
// the reason being we are dealing with possibly (infinite) large domains
clear_cache(&trail->target_cache);
// unlike modern SAT solvers, we don't fully clear model cache (called phase saving in SAT solvers)
// the reason being we are dealing with possibly (infinite) large domains
// only clear boolean values
trail_clear_unassigned_bool_cache(trail, &trail->model);
break;
case 1:
// set model cache to best cache so far; only set unassigned variables
Expand Down

0 comments on commit 6708397

Please sign in to comment.