3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

generator

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2021-01-25 19:18:55 -08:00
parent 4b6d7ca097
commit dccfecb488

View file

@ -7490,13 +7490,12 @@ class Optimize(Z3PPObject):
if id is None: if id is None:
id = "" id = ""
id = to_symbol(id, self.ctx) id = to_symbol(id, self.ctx)
def asoft(a):
v = Z3_optimize_assert_soft(self.ctx.ref(), self.optimize, a.as_ast(), weight, id)
return OptimizeObjective(self, v, False)
if isinstance(arg, iterable): if isinstance(arg, iterable):
for a in arg: return [asoft(a) for a in arg]
v = Z3_optimize_assert_soft(self.ctx.ref(), self.optimize, a.as_ast(), weight, id) return asoft(arg)
yield OptimizeObjective(self, v, False)
return
v = Z3_optimize_assert_soft(self.ctx.ref(), self.optimize, arg.as_ast(), weight, id)
return OptimizeObjective(self, v, False)
def maximize(self, arg): def maximize(self, arg):
"""Add objective function to maximize.""" """Add objective function to maximize."""