mirror of
https://github.com/Z3Prover/z3
synced 2025-08-23 11:37:54 +00:00
Add initial value setting for variables in Z3 API, solver, and optimize modules
This commit is contained in:
parent
0ba306e7b3
commit
48712b4f60
31 changed files with 297 additions and 9 deletions
|
@ -1143,5 +1143,23 @@ extern "C" {
|
|||
Z3_CATCH_RETURN(nullptr);
|
||||
}
|
||||
|
||||
void Z3_API Z3_solver_set_initial_value(Z3_context c, Z3_solver s, Z3_ast var, Z3_ast value) {
|
||||
Z3_TRY;
|
||||
LOG_Z3_solver_set_initial_value(c, s, var, value);
|
||||
RESET_ERROR_CODE();
|
||||
if (to_expr(var)->get_sort() != to_expr(value)->get_sort()) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, "variable and value should have same sort");
|
||||
return;
|
||||
}
|
||||
ast_manager& m = mk_c(c)->m();
|
||||
if (!m.is_value(to_expr(value))) {
|
||||
SET_ERROR_CODE(Z3_INVALID_USAGE, "a proper value was not supplied");
|
||||
return;
|
||||
}
|
||||
to_solver_ref(s)->user_propagate_initialize_value(to_expr(var), to_expr(value));
|
||||
Z3_CATCH;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue