Overview
The Optimization API provides functions for solving optimization problems - finding models that maximize or minimize objective functions while satisfying constraints.Types
Z3_optimize
Context for solving optimization queries. Supports hard constraints, soft constraints, and multiple objectives.Optimizer Creation
Z3_mk_optimize
New optimizer instance
Z3_optimize_inc_ref
Z3_optimize_dec_ref
Hard Constraints
Z3_optimize_assert
Z3_optimize_assert_and_track
Soft Constraints
Z3_optimize_assert_soft
Index of the soft constraint
Objectives
Z3_optimize_maximize
Objective handle
Z3_optimize_minimize
Objective handle
Checking and Results
Z3_optimize_check
Z3_L_TRUE if satisfiable, Z3_L_FALSE if unsatisfiable, Z3_L_UNDEF if unknown
Z3_optimize_get_model
Model (must increment reference)
Z3_optimize_get_upper
Upper bound expression
Z3_optimize_get_lower
Lower bound expression
Backtracking
Z3_optimize_push
Z3_optimize_pop
Information Retrieval
Z3_optimize_get_reason_unknown
Reason string
Z3_optimize_to_string
String representation
Z3_optimize_get_assertions
Vector of assertions
Z3_optimize_get_objectives
Vector of objective expressions
Z3_optimize_get_unsat_core
Unsat core (subset of assertions)
