-2

I'm using the minimize function in Z3 a lot and I'm worrying about some scalability issues (when the number of variables I'm minimizing grows). What is the underlying algorithm of "minimize" and is there a general way to speed things up?

Halaby
  • 49
  • 4

1 Answers1

1

See this paper for details on the optimization algorithms used in Z3. Regarding your question about "general way to speed things up:" Impossible to tell without seeing exactly what you're trying to do and how you are encoding it. Posting a concrete example where things don't "scale" might be helpful.

alias
  • 28,120
  • 2
  • 23
  • 40
  • 1
    My problem setup is simple: I'm working on satisfying the maximum number of multi-valued logical clauses C_1,...,C_m. I use bit-vectors. For each clause C_i, I disjunct it with a fresh variable (bit-vector) b_i: C_1 or b_1 C_2 or b_2 ... C_m or b_m and I minimize b_i's: (minimize b_1) (minimize b_2) ... (minimize b_m) So my question is specifically about how minimizing bit-vectors works and if there are tricks to speed it up. – Halaby Aug 26 '17 at 02:25
  • 1
    Sounds like you're solving max-sat? If that's the case, soft constraints is the way to go: http://rise4fun.com/Z3/tutorialcontent/optimization#h23 The idea is that Z3 will try to satisfy as many of the soft-constraints as it can, while trying to keep the associated penalty to a minimum for those it cannot satisfy. – alias Aug 26 '17 at 17:13
  • 1
    I'm solving MaxSAT, yes, but in many-valued logic. The problem is (in my understanding) assert-soft accepts boolean constraints and I'm dealing with many-valued constraints. – Halaby Aug 26 '17 at 18:46
  • The link is broken. – Rodrigo de Azevedo Jan 21 '18 at 11:22
  • The site was rebuilt using wasm: https://www.philipzucker.com/z3-rise4fun/optimization.html – Karussell Jan 15 '22 at 19:02