I was considering using z3 to minimize problems involving squares. But when I write this simple example (z3opt in python 3) :
from z3 import * a = Real('a') b = Real('b') cost = Real('cost') opt = Optimize() opt.add(a + b == 3) opt.add(And(a >= 0, a <= 10)) opt.add(And(b >= 0, b <= 10)) opt.add(cost == a * 10.0 + b ** 2.0) h = opt.minimize(cost) print(opt.check()) print(opt.reason_unknown()) print(opt.lower(h)) print(opt.model()) The check returns "unknown":
unknown (incomplete (theory arithmetic)) -1*oo [b = 0, cost = 30, a = 3] Am I defining the problem in the wrong way or is this an intrinsic limitation of z3?