1

I have a rather specific question about using the optimization features of the Z3 opt-branch.

Namely, I can add assertions to the "opt" context using z3_optimize_assert, and those constraints do work. However, all constraints added to the original z3_context, which was used to create the optimization context are ignored. Is it a bug or a feature? What is the purpose of having two contexts?

George Karpenkov
  • 2,094
  • 1
  • 16
  • 36

1 Answers1

2

The only function that adds constraints to the context is called Z3_assert_cnstr. It is a deprecated function. You should assert constraints to the engine that you want to use. There are now the following engines:

 Z3_solver_assert
 Z3_fixedpoint_assert
 Z3_optimzie_assert
 Z3_goal_assert

Assertions are local to the solver, fixed-point context, optimize context or goal, respectively.

Nikolaj Bjorner
  • 8,229
  • 14
  • 15