Skip to content

Commit 0ba306e

Browse files
y
1 parent 99a9a4a commit 0ba306e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/api/python/z3/z3.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -7926,9 +7926,12 @@ def _global_on_model(ctx):
79267926
class Optimize(Z3PPObject):
79277927
"""Optimize API provides methods for solving using objective functions and weighted soft constraints"""
79287928

7929-
def __init__(self, ctx=None):
7929+
def __init__(self, optimize=None, ctx=None):
79307930
self.ctx = _get_ctx(ctx)
7931-
self.optimize = Z3_mk_optimize(self.ctx.ref())
7931+
if optimize is None:
7932+
self.optimize = Z3_mk_optimize(self.ctx.ref())
7933+
else:
7934+
self.optimize = optimize
79327935
self._on_models_id = None
79337936
Z3_optimize_inc_ref(self.ctx.ref(), self.optimize)
79347937

0 commit comments

Comments
 (0)