Public Member Functions | |
__init__ (self, optimize=None, ctx=None) | |
__deepcopy__ (self, memo={}) | |
__del__ (self) | |
__enter__ (self) | |
__exit__ (self, *exc_info) | |
set (self, *args, **keys) | |
help (self) | |
param_descrs (self) | |
assert_exprs (self, *args) | |
add (self, *args) | |
__iadd__ (self, fml) | |
assert_and_track (self, a, p) | |
add_soft (self, arg, weight="1", id=None) | |
set_initial_value (self, var, value) | |
maximize (self, arg) | |
minimize (self, arg) | |
push (self) | |
pop (self) | |
check (self, *assumptions) | |
reason_unknown (self) | |
model (self) | |
unsat_core (self) | |
lower (self, obj) | |
upper (self, obj) | |
lower_values (self, obj) | |
upper_values (self, obj) | |
from_file (self, filename) | |
from_string (self, s) | |
assertions (self) | |
objectives (self) | |
__repr__ (self) | |
sexpr (self) | |
statistics (self) | |
set_on_model (self, on_model) | |
![]() | |
use_pp (self) | |
Data Fields | |
ctx = _get_ctx(ctx) | |
optimize = Z3_mk_optimize(self.ctx.ref()) | |
Protected Attributes | |
_on_models_id = None | |
Additional Inherited Members | |
![]() | |
_repr_html_ (self) | |
Optimize API provides methods for solving using objective functions and weighted soft constraints
__init__ | ( | self, | |
optimize = None, | |||
ctx = None ) |
Definition at line 8026 of file z3py.py.
__del__ | ( | self | ) |
Definition at line 8038 of file z3py.py.
__deepcopy__ | ( | self, | |
memo = {} ) |
__enter__ | ( | self | ) |
__exit__ | ( | self, | |
* | exc_info ) |
__iadd__ | ( | self, | |
fml ) |
__repr__ | ( | self | ) |
add | ( | self, | |
* | args ) |
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 8115 of file z3py.py.
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 8086 of file z3py.py.
assert_exprs | ( | self, | |
* | args ) |
Assert constraints as background axioms for the optimize solver.
Definition at line 8066 of file z3py.py.
assertions | ( | self | ) |
Return an AST vector containing all added constraints.
Definition at line 8221 of file z3py.py.
check | ( | self, | |
* | assumptions ) |
Check consistency and produce optimal values.
Definition at line 8170 of file z3py.py.
from_file | ( | self, | |
filename ) |
Parse assertions and objectives from a file
Definition at line 8213 of file z3py.py.
from_string | ( | self, | |
s ) |
Parse assertions and objectives from a string
Definition at line 8217 of file z3py.py.
help | ( | self | ) |
Display a string describing all available options.
Definition at line 8058 of file z3py.py.
lower | ( | self, | |
obj ) |
lower_values | ( | self, | |
obj ) |
maximize | ( | self, | |
arg ) |
Add objective function to maximize.
Definition at line 8146 of file z3py.py.
minimize | ( | self, | |
arg ) |
Add objective function to minimize.
Definition at line 8154 of file z3py.py.
model | ( | self | ) |
Return a model for the last check().
Definition at line 8183 of file z3py.py.
objectives | ( | self | ) |
returns set of objective functions
Definition at line 8225 of file z3py.py.
param_descrs | ( | self | ) |
Return the parameter description set.
Definition at line 8062 of file z3py.py.
pop | ( | self | ) |
restore to previously created backtracking point
Definition at line 8166 of file z3py.py.
push | ( | self | ) |
create a backtracking point for added rules, facts and assertions
Definition at line 8162 of file z3py.py.
reason_unknown | ( | self | ) |
Return a string that describes why the last `check()` returned `unknown`.
Definition at line 8179 of file z3py.py.
set | ( | self, | |
* | args, | ||
** | keys ) |
Set a configuration option. The method `help()` return a string containing all available options.
Definition at line 8051 of file z3py.py.
set_initial_value | ( | self, | |
var, | |||
value ) |
initialize the solver's state by setting the initial value of var to value
Definition at line 8139 of file z3py.py.
set_on_model | ( | self, | |
on_model ) |
Register a callback that is invoked with every incremental improvement to objective values. The callback takes a model as argument. The life-time of the model is limited to the callback so the model has to be (deep) copied if it is to be used after the callback
Definition at line 8244 of file z3py.py.
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 8233 of file z3py.py.
statistics | ( | self | ) |
Return statistics for the last check`.
Definition at line 8239 of file z3py.py.
unsat_core | ( | self | ) |
upper | ( | self, | |
obj ) |
upper_values | ( | self, | |
obj ) |
optimize = Z3_mk_optimize(self.ctx.ref()) |