0

I'm trying to solve some smt equations with Z3 OCaml api. I need to add some soft constraint using Z3.Optimize.add_soft function, but I don't know what the parameters of the function mean and cannot find any description or example for that. Merlin just type that Z3.Optimize.add_soft : Z3.Optimize.optimize -> Z3.Expr.expr -> string -> Z3.Symbol.symbol -> Z3.Optimize.handle, and I found some descriptions in this page, but I don't know how to add option that means :weight 10, for example.

In other words, I want to call Z3.Optimize.add_soft function as following smt2 format

(assert-soft e :weight 10)

Thank you!

sangwoo-joh
  • 127
  • 6
  • Oh, never mind. I find it myself by using `Z3.Goal.to_string` function. It turns out that in `Z3.optimize.add_soft` function, the parameter of type `string` is weight value as string, and `Z3.Symbol.symbol` is `:id` as smt2 format. – sangwoo-joh Jul 27 '17 at 07:48
  • So, I just call `Z3.optimize.add_soft e "10" [some id symbol]` and is ok. – sangwoo-joh Jul 27 '17 at 07:49
  • you should make your comments a proper answer and the accept it, comments and unanswered questions may be deleted by the system eventually. – Patrick Trentin Aug 03 '17 at 08:16

0 Answers0