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

Have Z3_set_param_value indicate if a setting is being ignored #7100

Closed
facundominguez opened this issue Jan 25, 2024 · 3 comments
Closed

Have Z3_set_param_value indicate if a setting is being ignored #7100

facundominguez opened this issue Jan 25, 2024 · 3 comments

Comments

@facundominguez
Copy link
Contributor

Z3_set_param_value seems to ignore global parameters, for which Z3_global_param_set should be set. Unfortunately, this is not obvious to users when they interact with Z3 through another layer (like smtlib-backends).

Would it be possible to query the API to learn if some parameter set with Z3_set_param_value has been ignored? This would allow to give users an explicit error message when things don't go as expected.

This issue surfaced when a user was trying to start a Z3 context with dump_models set to true.

Another solution could be having a way to test whether a parameter is in the domain of Z3_set_param_value ahead of making the call. There is a call Z3_get_global_param_descrs, but it requires having a Z3 context first, which isn't necessary with Z3_set_param_value.

@NikolajBjorner
Copy link
Contributor

dump_models is defined two places:

  • for the command-context that processes formulas from input files. Global
  • for optimization. Local to optimization.

It means different things for the two uses.

  • for command context it means to always display the model after check-sat when available. It is like adding a default (get-model)
  • for optimization it is to display intermediary feasible, but not necessarily optimal models. You use this to glean for a best-effort result. "are we there yet".

They happen to have the same name, but may as well have been renamed apart.
If you set "dump_models" on other objects, such as a solver object, you will get an error message.

@facundominguez
Copy link
Contributor Author

for the command-context that processes formulas from input files. Global

If this is Z3_Context in the C API, then setting dump_models with Z3_set_param_value doesn't seem to have any effect, nor does it produce an error.

If helpful, I could try writing a C program that shows this behavior.

NikolajBjorner added a commit that referenced this issue Jan 31, 2024
@NikolajBjorner
Copy link
Contributor

Alright, dump_models is only intended to be used from the text API.
For programmatic API you can set a callback when there is a model, Z3_optimize_register_model_eh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants