Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decision hint queue #494

Merged
merged 23 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/exists_forall/ef_values.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ void postprocess_ef_table(ef_table_t *vtable, bool check) {
}
}
}
m = queue.size;
m = queue.capacity;
j = 0;
while(!int_queue_is_empty(&queue)) {
tvalue = int_queue_pop(&queue);
Expand Down
26 changes: 16 additions & 10 deletions src/mcsat/nra/nra_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,18 +860,24 @@ void nra_plugin_process_unit_constraint(nra_plugin_t* nra, trail_token_t* prop,
}
lp_value_destruct(&v);
}
// If the value is implied at zero level, propagate it
if (!nra->ctx->options->model_interpolation && !x_in_conflict && !trail_has_value(nra->ctx->trail, x) && trail_is_at_base_level(nra->ctx->trail)) {
const lp_feasibility_set_t* feasible = feasible_set_db_get(nra->feasible_set_db, x);
if (lp_feasibility_set_is_point(feasible)) {
if (!x_in_conflict && !trail_has_value(nra->ctx->trail, x)) {
const lp_feasibility_set_t *feasible_set = feasible_set_db_get(nra->feasible_set_db, x);
if (lp_feasibility_set_is_point(feasible_set)) {
lp_value_t x_value;
lp_value_construct_none(&x_value);
lp_feasibility_set_pick_value(feasible, &x_value);
lp_feasibility_set_pick_value(feasible_set, &x_value);
if (lp_value_is_rational(&x_value)) {
mcsat_value_t value;
mcsat_value_construct_lp_value(&value, &x_value);
prop->add_at_level(prop, x, &value, nra->ctx->trail->decision_level_base);
mcsat_value_destruct(&value);
if (trail_is_at_base_level(nra->ctx->trail) && !nra->ctx->options->model_interpolation) {
mcsat_value_t value;
mcsat_value_construct_lp_value(&value, &x_value);
prop->add_at_level(prop, x, &value, nra->ctx->trail->decision_level_base);
mcsat_value_destruct(&value);
} else {
if (ctx_trace_enabled(nra->ctx, "nra::propagate")) {
ctx_trace_printf(nra->ctx, "nra: hinting variable = %d\n", x);
}
nra->ctx->hint_next_decision(nra->ctx, x);
}
}
lp_value_destruct(&x_value);
}
Expand Down Expand Up @@ -1069,7 +1075,7 @@ void nra_plugin_propagate(plugin_t* plugin, trail_token_t* prop) {
}

// Propagate
while(trail_is_consistent(trail) && nra->trail_i < trail_size(trail)) {
while (trail_is_consistent(trail) && nra->trail_i < trail_size(trail)) {
// Current trail element
var = trail_at(trail, nra->trail_i);
nra->trail_i ++;
Expand Down
6 changes: 4 additions & 2 deletions src/mcsat/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ struct plugin_context_s {
/** Request a variable to be a top decision variable */
void (*request_top_decision) (plugin_context_t* self, variable_t x);

/** Request a variable to be a next decision variable */
void (*hint_next_decision) (plugin_context_t* self, variable_t x);

};

/** Token to add entries to the trail */
Expand Down Expand Up @@ -334,10 +337,9 @@ void plugin_construct(plugin_t* plugin) {
plugin->pop = NULL;
plugin->build_model = NULL;
plugin->gc_mark = NULL;
plugin->gc_mark_and_clear = NULL;
plugin->gc_mark_and_clear = NULL;
plugin->gc_sweep = NULL;
plugin->set_exception_handler = NULL;
}


#endif /* PLUGIN_H_ */
Loading
Loading