mirror of
https://github.com/Z3Prover/z3
synced 2025-04-25 01:55:32 +00:00
Add initial value setting for variables in Z3 API, solver, and optimize modules
This commit is contained in:
parent
0ba306e7b3
commit
48712b4f60
31 changed files with 297 additions and 9 deletions
|
@ -7353,6 +7353,13 @@ class Solver(Z3PPObject):
|
|||
Z3_solver_get_levels(self.ctx.ref(), self.solver, trail.vector, len(trail), levels)
|
||||
return trail, levels
|
||||
|
||||
def set_initial_value(self, var, value):
|
||||
"""initialize the solver's state by setting the initial value of var to value
|
||||
"""
|
||||
s = var.sort()
|
||||
value = s.cast(value)
|
||||
Z3_solver_set_initial_value(self.ctx.ref(), self.solver, var.ast, value.ast)
|
||||
|
||||
def trail(self):
|
||||
"""Return trail of the solver state after a check() call.
|
||||
"""
|
||||
|
@ -8032,6 +8039,13 @@ class Optimize(Z3PPObject):
|
|||
return [asoft(a) for a in arg]
|
||||
return asoft(arg)
|
||||
|
||||
def set_initial_value(self, var, value):
|
||||
"""initialize the solver's state by setting the initial value of var to value
|
||||
"""
|
||||
s = var.sort()
|
||||
value = s.cast(value)
|
||||
Z3_optimize_set_initial_value(self.ctx.ref(), self.optimize, var.ast, value.ast)
|
||||
|
||||
def maximize(self, arg):
|
||||
"""Add objective function to maximize."""
|
||||
return OptimizeObjective(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue