Public Member Functions | |
def | __init__ |
def | __deepcopy__ |
def | __del__ |
def | set |
def | help |
def | param_descrs |
def | assert_exprs |
def | add |
def | __iadd__ |
def | assert_and_track |
def | add_soft |
def | maximize |
def | minimize |
def | push |
def | pop |
def | check |
def | reason_unknown |
def | model |
def | unsat_core |
def | lower |
def | upper |
def | lower_values |
def | upper_values |
def | from_file |
def | from_string |
def | assertions |
def | objectives |
def | __repr__ |
def | sexpr |
def | statistics |
![]() | |
def | use_pp |
Data Fields | |
ctx | |
optimize | |
Optimize API provides methods for solving using objective functions and weighted soft constraints
def __del__ | ( | self | ) |
def __deepcopy__ | ( | self, | |
memo = {} |
|||
) |
Definition at line 7332 of file z3py.py.
def __iadd__ | ( | self, | |
fml | |||
) |
def __repr__ | ( | self | ) |
def add | ( | self, | |
args | |||
) |
Assert constraints as background axioms for the optimize solver. Alias for assert_expr.
Definition at line 7365 of file z3py.py.
Referenced by Optimize.__iadd__().
def add_soft | ( | self, | |
arg, | |||
weight = "1" , |
|||
id = None |
|||
) |
Add soft constraint with optional weight and optional identifier. If no weight is supplied, then the penalty for violating the soft constraint is 1. Soft constraints are grouped by identifiers. Soft constraints that are added without identifiers are grouped by default.
Definition at line 7402 of file z3py.py.
def assert_and_track | ( | self, | |
a, | |||
p | |||
) |
Assert constraint `a` and track it in the unsat core using the Boolean constant `p`. If `p` is a string, it will be automatically converted into a Boolean constant. >>> x = Int('x') >>> p3 = Bool('p3') >>> s = Optimize() >>> s.assert_and_track(x > 0, 'p1') >>> s.assert_and_track(x != 1, 'p2') >>> s.assert_and_track(x < 0, p3) >>> print(s.check()) unsat >>> c = s.unsat_core() >>> len(c) 2 >>> Bool('p1') in c True >>> Bool('p2') in c False >>> p3 in c True
Definition at line 7373 of file z3py.py.
def assert_exprs | ( | self, | |
args | |||
) |
Assert constraints as background axioms for the optimize solver.
Definition at line 7353 of file z3py.py.
Referenced by Optimize.add().
def assertions | ( | self | ) |
Return an AST vector containing all added constraints.
Definition at line 7488 of file z3py.py.
def check | ( | self, | |
assumptions | |||
) |
Check satisfiability while optimizing objective functions.
Definition at line 7437 of file z3py.py.
def from_file | ( | self, | |
filename | |||
) |
Parse assertions and objectives from a file
Definition at line 7480 of file z3py.py.
def from_string | ( | self, | |
s | |||
) |
Parse assertions and objectives from a string
Definition at line 7484 of file z3py.py.
def help | ( | self | ) |
def maximize | ( | self, | |
arg | |||
) |
Add objective function to maximize.
Definition at line 7421 of file z3py.py.
def minimize | ( | self, | |
arg | |||
) |
Add objective function to minimize.
Definition at line 7425 of file z3py.py.
def model | ( | self | ) |
Return a model for the last check().
Definition at line 7450 of file z3py.py.
Referenced by FuncInterp.translate().
def objectives | ( | self | ) |
returns set of objective functions
Definition at line 7492 of file z3py.py.
def param_descrs | ( | self | ) |
Return the parameter description set.
Definition at line 7349 of file z3py.py.
def pop | ( | self | ) |
def push | ( | self | ) |
def reason_unknown | ( | self | ) |
def set | ( | self, | |
args, | |||
keys | |||
) |
Set a configuration option. The method `help()` return a string containing all available options.
Definition at line 7339 of file z3py.py.
def sexpr | ( | self | ) |
Return a formatted string (in Lisp-like format) with all added constraints. We say the string is in s-expression format.
Definition at line 7500 of file z3py.py.
Referenced by Optimize.__repr__().
def statistics | ( | self | ) |
def unsat_core | ( | self | ) |
Definition at line 7457 of file z3py.py.
ctx |
Definition at line 7328 of file z3py.py.
Referenced by Optimize.__deepcopy__(), ApplyResult.__deepcopy__(), Tactic.__deepcopy__(), Probe.__deepcopy__(), Probe.__eq__(), Probe.__ge__(), ApplyResult.__getitem__(), Probe.__gt__(), Probe.__le__(), Probe.__lt__(), Probe.__ne__(), Optimize.add_soft(), Tactic.apply(), ApplyResult.as_expr(), Optimize.assert_and_track(), Optimize.assert_exprs(), Optimize.assertions(), Optimize.model(), Optimize.objectives(), Optimize.param_descrs(), Tactic.param_descrs(), Optimize.set(), Tactic.solver(), Optimize.statistics(), and Optimize.unsat_core().
optimize |
Definition at line 7329 of file z3py.py.
Referenced by Optimize.__deepcopy__(), Optimize.__del__(), Optimize.add_soft(), Optimize.assert_and_track(), Optimize.assert_exprs(), Optimize.assertions(), Optimize.check(), Optimize.from_file(), Optimize.from_string(), Optimize.help(), Optimize.maximize(), Optimize.minimize(), Optimize.model(), Optimize.objectives(), Optimize.param_descrs(), Optimize.pop(), Optimize.push(), Optimize.reason_unknown(), Optimize.set(), Optimize.sexpr(), Optimize.statistics(), and Optimize.unsat_core().