2

I'm aware that there is a simplex solver implemented in z3. Is it possible to use the solver for linear optimization? Where is the interface for the solver located in the z3 source code?

liyistc
  • 83
  • 1
  • 5

1 Answers1

4

Yes, Z3 has a solver based on the Simplex method. It is implemented in the files src\smt\theory_arith*. The main files are src\smt\theory_arith.h and src\smt\theory_arith_core.h. This solver has very basic support for optimization in the file src\smt\theory_arith_aux.h. This functionality is not "exposed" by the solver. It is used internally in the extensions/heuristics for integer and nonlinear arithmetic.

BTW, recall that Z3 solver is based on rational (precise) arithmetic. So, it is much slower than solvers based on floating point arithmetic. Moreover, this solver does not use the revised simplex method.

Leonardo de Moura
  • 21,065
  • 2
  • 47
  • 53
  • There are a group of functions called 'max_min' in 'theory_arith_aux.h'. Are they doing global optimization? – liyistc Jun 04 '13 at 16:40
  • 1
    I'm not sure what you mean by global optimization. The method `max_min(theory_var v, bool max)` is maximizing/minimizing the given internal theory variable `v` with respect to the current simplex tableau and asserted bounds. The function is ignoring whether `v` is integer or not. It is just executing a simplex-like algorithm for maximizing (minimizing) `v`. – Leonardo de Moura Jun 05 '13 at 01:09