#include <z3++.h>
|
| | optimize (context &c) |
| | optimize (context &c, optimize const &src, translate) |
| | optimize (optimize const &o) |
| | optimize (context &c, optimize &src) |
| optimize & | operator= (optimize const &o) |
| | ~optimize () override |
| | operator Z3_optimize () const |
| void | add (expr const &e) |
| void | add (expr_vector const &es) |
| void | add (expr const &e, expr const &t) |
| void | add (expr const &e, char const *p) |
| handle | add_soft (expr const &e, unsigned weight) |
| handle | add_soft (expr const &e, char const *weight) |
| handle | add (expr const &e, unsigned weight) |
| void | set_initial_value (expr const &var, expr const &value) |
| void | set_initial_value (expr const &var, int i) |
| void | set_initial_value (expr const &var, bool b) |
| handle | maximize (expr const &e) |
| handle | minimize (expr const &e) |
| void | push () |
| void | pop () |
| check_result | check () |
| check_result | check (expr_vector const &asms) |
| model | get_model () const |
| expr_vector | unsat_core () const |
| void | set (params const &p) |
| expr | lower (handle const &h) |
| expr_vector | lower_as_vector (handle const &h) const |
| expr | upper (handle const &h) |
| expr_vector | upper_as_vector (handle const &h) const |
| expr_vector | assertions () const |
| expr_vector | objectives () const |
| stats | statistics () const |
| void | from_file (char const *filename) |
| void | from_string (char const *constraints) |
| std::string | help () const |
| | object (context &c) |
| virtual | ~object ()=default |
| context & | ctx () const |
| Z3_error_code | check_error () const |
Definition at line 3643 of file z3++.h.
◆ optimize() [1/4]
Definition at line 3654 of file z3++.h.
void Z3_API Z3_optimize_inc_ref(Z3_context c, Z3_optimize d)
Increment the reference counter of the given optimize context.
Z3_optimize Z3_API Z3_mk_optimize(Z3_context c)
Create a new optimize context.
Referenced by operator<<, operator=(), optimize(), optimize(), and optimize().
◆ optimize() [2/4]
Definition at line 3655 of file z3++.h.
3655 : object(c) {
3657 check_error();
3658 m_opt = o;
3660 }
Z3_optimize Z3_API Z3_optimize_translate(Z3_context c, Z3_optimize o, Z3_context target)
Copy an optimization context from a source to a target context.
◆ optimize() [3/4]
| optimize |
( |
optimize const & | o | ) |
|
|
inline |
Definition at line 3661 of file z3++.h.
3661 :object(o), m_opt(o.m_opt) {
3663 }
◆ optimize() [4/4]
| optimize |
( |
context & | c, |
|
|
optimize & | src ) |
|
inline |
Definition at line 3664 of file z3++.h.
3664 :object(c) {
3669 for (expr_vector::iterator it = v.begin(); it != v.end(); ++it) minimize(*it);
3670 }
ast_vector_tpl< expr > expr_vector
◆ ~optimize()
Definition at line 3678 of file z3++.h.
void Z3_API Z3_optimize_dec_ref(Z3_context c, Z3_optimize d)
Decrement the reference counter of the given optimize context.
◆ add() [1/5]
| void add |
( |
expr const & | e | ) |
|
|
inline |
Definition at line 3680 of file z3++.h.
3680 {
3681 assert(e.is_bool());
3683 }
void Z3_API Z3_optimize_assert(Z3_context c, Z3_optimize o, Z3_ast a)
Assert hard constraint to the optimization context.
Referenced by add(), add(), and optimize().
◆ add() [2/5]
| void add |
( |
expr const & | e, |
|
|
char const * | p ) |
|
inline |
Definition at line 3691 of file z3++.h.
3691 {
3692 assert(e.is_bool());
3693 add(e, ctx().bool_const(p));
3694 }
◆ add() [3/5]
| void add |
( |
expr const & | e, |
|
|
expr const & | t ) |
|
inline |
Definition at line 3687 of file z3++.h.
3687 {
3688 assert(e.is_bool());
3690 }
void Z3_API Z3_optimize_assert_and_track(Z3_context c, Z3_optimize o, Z3_ast a, Z3_ast t)
Assert tracked hard constraint to the optimization context.
◆ add() [4/5]
Definition at line 3704 of file z3++.h.
3704 {
3705 return add_soft(e, weight);
3706 }
◆ add() [5/5]
Definition at line 3684 of file z3++.h.
3684 {
3685 for (expr_vector::iterator it = es.begin(); it != es.end(); ++it) add(*it);
3686 }
◆ add_soft() [1/2]
| handle add_soft |
( |
expr const & | e, |
|
|
char const * | weight ) |
|
inline |
Definition at line 3700 of file z3++.h.
3700 {
3701 assert(e.is_bool());
3703 }
unsigned Z3_API Z3_optimize_assert_soft(Z3_context c, Z3_optimize o, Z3_ast a, Z3_string weight, Z3_symbol id)
Assert soft constraint to the optimization context.
◆ add_soft() [2/2]
| handle add_soft |
( |
expr const & | e, |
|
|
unsigned | weight ) |
|
inline |
Definition at line 3695 of file z3++.h.
3695 {
3696 assert(e.is_bool());
3697 auto str = std::to_string(weight);
3699 }
Referenced by add().
◆ assertions()
Definition at line 3765 of file z3++.h.
Z3_ast_vector Z3_API Z3_optimize_get_assertions(Z3_context c, Z3_optimize o)
Return the set of asserted formulas on the optimization context.
Referenced by optimize().
◆ check() [1/2]
Definition at line 3730 of file z3++.h.
Z3_lbool
Lifted Boolean type: false, undefined, true.
Z3_lbool Z3_API Z3_optimize_check(Z3_context c, Z3_optimize o, unsigned num_assumptions, Z3_ast const assumptions[])
Check consistency and produce optimal values.
check_result to_check_result(Z3_lbool l)
◆ check() [2/2]
Definition at line 3731 of file z3++.h.
3731 {
3732 unsigned n = asms.size();
3733 array<Z3_ast> _asms(n);
3734 for (unsigned i = 0; i < n; ++i) {
3736 _asms[i] = asms[i];
3737 }
3739 check_error();
3741 }
void check_context(object const &a, object const &b)
◆ from_file()
| void from_file |
( |
char const * | filename | ) |
|
|
inline |
Definition at line 3769 of file z3++.h.
void Z3_API Z3_optimize_from_file(Z3_context c, Z3_optimize o, Z3_string s)
Parse an SMT-LIB2 file with assertions, soft constraints and optimization objectives....
◆ from_string()
| void from_string |
( |
char const * | constraints | ) |
|
|
inline |
Definition at line 3770 of file z3++.h.
void Z3_API Z3_optimize_from_string(Z3_context c, Z3_optimize o, Z3_string s)
Parse an SMT-LIB2 string with assertions, soft constraints and optimization objectives....
◆ get_model()
| model get_model |
( |
| ) |
const |
|
inline |
Definition at line 3742 of file z3++.h.
Z3_model Z3_API Z3_optimize_get_model(Z3_context c, Z3_optimize o)
Retrieve the model for the last Z3_optimize_check.
◆ help()
| std::string help |
( |
| ) |
const |
|
inline |
Definition at line 3771 of file z3++.h.
Z3_string Z3_API Z3_optimize_get_help(Z3_context c, Z3_optimize t)
Return a string containing a description of parameters accepted by optimize.
◆ lower()
Definition at line 3745 of file z3++.h.
3745 {
3747 check_error();
3748 return expr(ctx(), r);
3749 }
Z3_ast Z3_API Z3_optimize_get_lower(Z3_context c, Z3_optimize o, unsigned idx)
Retrieve lower bound value or approximation for the i'th optimization objective.
◆ lower_as_vector()
Definition at line 3750 of file z3++.h.
3750 {
3752 check_error();
3754 }
Z3_ast_vector Z3_API Z3_optimize_get_lower_as_vector(Z3_context c, Z3_optimize o, unsigned idx)
Retrieve lower bound value or approximation for the i'th optimization objective. The returned vector ...
◆ maximize()
Definition at line 3718 of file z3++.h.
3718 {
3720 }
unsigned Z3_API Z3_optimize_maximize(Z3_context c, Z3_optimize o, Z3_ast t)
Add a maximization constraint.
◆ minimize()
Definition at line 3721 of file z3++.h.
3721 {
3723 }
unsigned Z3_API Z3_optimize_minimize(Z3_context c, Z3_optimize o, Z3_ast t)
Add a minimization constraint.
Referenced by optimize().
◆ objectives()
Definition at line 3766 of file z3++.h.
Z3_ast_vector Z3_API Z3_optimize_get_objectives(Z3_context c, Z3_optimize o)
Return objectives on the optimization context. If the objective function is a max-sat objective it is...
Referenced by optimize().
◆ operator Z3_optimize()
| operator Z3_optimize |
( |
| ) |
const |
|
inline |
◆ operator=()
Definition at line 3671 of file z3++.h.
3671 {
3674 m_opt = o.m_opt;
3675 object::operator=(o);
3676 return *this;
3677 }
◆ pop()
Definition at line 3727 of file z3++.h.
3727 {
3729 }
void Z3_API Z3_optimize_pop(Z3_context c, Z3_optimize d)
Backtrack one level.
◆ push()
Definition at line 3724 of file z3++.h.
3724 {
3726 }
void Z3_API Z3_optimize_push(Z3_context c, Z3_optimize d)
Create a backtracking point.
◆ set()
Definition at line 3744 of file z3++.h.
void Z3_API Z3_optimize_set_params(Z3_context c, Z3_optimize o, Z3_params p)
Set parameters on optimization context, including parameters for the underlying SMT solver.
◆ set_initial_value() [1/3]
| void set_initial_value |
( |
expr const & | var, |
|
|
bool | b ) |
|
inline |
Definition at line 3714 of file z3++.h.
3714 {
3715 set_initial_value(var, ctx().bool_val(b));
3716 }
◆ set_initial_value() [2/3]
| void set_initial_value |
( |
expr const & | var, |
|
|
expr const & | value ) |
|
inline |
Definition at line 3707 of file z3++.h.
3707 {
3709 check_error();
3710 }
void Z3_API Z3_optimize_set_initial_value(Z3_context c, Z3_optimize o, Z3_ast v, Z3_ast val)
provide an initialization hint to the solver. The initialization hint is used to calibrate an initial...
Referenced by set_initial_value(), and set_initial_value().
◆ set_initial_value() [3/3]
| void set_initial_value |
( |
expr const & | var, |
|
|
int | i ) |
|
inline |
Definition at line 3711 of file z3++.h.
3711 {
3712 set_initial_value(var, ctx().num_val(i, var.get_sort()));
3713 }
◆ statistics()
| stats statistics |
( |
| ) |
const |
|
inline |
Definition at line 3767 of file z3++.h.
Z3_stats Z3_API Z3_optimize_get_statistics(Z3_context c, Z3_optimize d)
Retrieve statistics information from the last call to Z3_optimize_check.
◆ unsat_core()
Definition at line 3743 of file z3++.h.
Z3_ast_vector Z3_API Z3_optimize_get_unsat_core(Z3_context c, Z3_optimize o)
Retrieve the unsat core for the last Z3_optimize_check The unsat core is a subset of the assumptions ...
◆ upper()
Definition at line 3755 of file z3++.h.
3755 {
3757 check_error();
3758 return expr(ctx(), r);
3759 }
Z3_ast Z3_API Z3_optimize_get_upper(Z3_context c, Z3_optimize o, unsigned idx)
Retrieve upper bound value or approximation for the i'th optimization objective.
◆ upper_as_vector()
Definition at line 3760 of file z3++.h.
3760 {
3762 check_error();
3764 }
Z3_ast_vector Z3_API Z3_optimize_get_upper_as_vector(Z3_context c, Z3_optimize o, unsigned idx)
Retrieve upper bound value or approximation for the i'th optimization objective.
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
optimize const & | s ) |
|
friend |
Definition at line 3773 of file z3++.h.
Z3_string Z3_API Z3_optimize_to_string(Z3_context c, Z3_optimize o)
Print the current context as a string.
Referenced by operator<<.