There was an error while loading. Please reload this page.
1 parent 99a9a4a commit 0ba306eCopy full SHA for 0ba306e
src/api/python/z3/z3.py
@@ -7926,9 +7926,12 @@ def _global_on_model(ctx):
7926
class Optimize(Z3PPObject):
7927
"""Optimize API provides methods for solving using objective functions and weighted soft constraints"""
7928
7929
- def __init__(self, ctx=None):
+ def __init__(self, optimize=None, ctx=None):
7930
self.ctx = _get_ctx(ctx)
7931
- self.optimize = Z3_mk_optimize(self.ctx.ref())
+ if optimize is None:
7932
+ self.optimize = Z3_mk_optimize(self.ctx.ref())
7933
+ else:
7934
+ self.optimize = optimize
7935
self._on_models_id = None
7936
Z3_optimize_inc_ref(self.ctx.ref(), self.optimize)
7937
0 commit comments