Skip to content

Commit

Permalink
update on caches when setting model hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-irfan committed Oct 15, 2024
1 parent 1939303 commit fcfebee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/mcsat/solver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2654,6 +2654,7 @@ void mcsat_set_model_hint(mcsat_solver_t* mcsat, model_t* mdl, uint32_t n_mdl_fi

value_table_t* vtbl = model_get_vtbl(mdl);

trail_clear_extra_cache(mcsat->trail);
trail_update_extra_cache(mcsat->trail);

for (uint32_t i = 0; i < n_mdl_filter; ++i) {
Expand Down
12 changes: 8 additions & 4 deletions src/mcsat/trail.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ uint32_t trail_pop_base_level(mcsat_trail_t* trail) {
assert(trail->decision_level_base > 0);

// clear target and best cache, setting their depths to zero
clear_cache(&trail->target_cache);
clear_cache(&trail->best_cache);
trail->best_depth = 0;
trail->target_depth = 0;
trail_clear_extra_cache(trail);

trail->decision_level_base --;
return trail->decision_level_base;
Expand Down Expand Up @@ -434,3 +431,10 @@ void trail_update_extra_cache(mcsat_trail_t* trail) {
trail->target_depth = trail->elements.size;
}
}

void trail_clear_extra_cache(mcsat_trail_t* trail) {
clear_cache(&trail->target_cache);
clear_cache(&trail->best_cache);
trail->target_depth = 0;
trail->best_depth = 0;
}
9 changes: 6 additions & 3 deletions src/mcsat/trail.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,15 @@ void trail_gc_mark(mcsat_trail_t* trail, gc_info_t* gc_vars);
void trail_gc_sweep(mcsat_trail_t* trail, const gc_info_t* gc_vars);

/** compare variables based on the trail level, unassigned to the front, then assigned ones by decreasing level */
bool trail_variable_compare(const mcsat_trail_t *trail, variable_t t1, variable_t t2);
bool trail_variable_compare(const mcsat_trail_t* trail, variable_t t1, variable_t t2);

/** Recache */
void trail_recache(mcsat_trail_t* trail, uint32_t round);

/** save target cache */
void trail_update_extra_cache(mcsat_trail_t *trail);
/** save target/best cache */
void trail_update_extra_cache(mcsat_trail_t* trail);

/** clear target/best cache */
void trail_clear_extra_cache(mcsat_trail_t* trail);

#endif /* MCSAT_TRAIL_H_ */

0 comments on commit fcfebee

Please sign in to comment.