API specific to the OptiMathSAT OMT solver. More...
Reference to remaining OptiMathSAT API in common with MathSAT 5
is available at MathSAT 5 API.
NEW (1.3.8): functions pushing an objective on the formula stack now return a handler to the objective instance.
NEW (1.5.0): pareto optimization, optimization result is now distinct from search result, minor improvement.
Data types and special values | |
| struct | msat_env |
| MathSAT environment. | |
| struct | msat_objective |
| OptiMathSAT objective. | |
| struct | msat_objective_iterator |
| OptiMathSAT objective iterator. | |
| struct | msat_pareto_model_handler |
| MathSAT Model Handler. | |
| enum | msat_objective_value { MSAT_OPTIMUM = 0, MSAT_FINAL_LOWER = 1, MSAT_FINAL_UPPER = 2, MSAT_FINAL_ERROR = 3 } |
| enum | msat_objective_type { MSAT_OBJECTIVE_MINIMIZE = -1, MSAT_OBJECTIVE_MAXIMIZE = 1 } |
| enum | msat_opt_result { MSAT_OPT_UNKNOWN = -1, MSAT_OPT_UNSAT = 0, MSAT_OPT_SAT_PARTIAL = 1, MSAT_OPT_SAT_APPROX = 2, MSAT_OPT_SAT_OPTIMAL = 3 } |
Optimization Functions | |
Objectives creation | |
| msat_objective | msat_make_minimize (msat_env e, msat_term term) |
| Create the new objective 'min(term)'. | |
| msat_objective | msat_make_minimize_signed (msat_env e, msat_term term) |
| Create the new objective 'min(term)'. The goal is interpreted as signed if it is of BV type. | |
| msat_objective | msat_make_maximize (msat_env e, msat_term term) |
| Create the new objective 'max(term)'. | |
| msat_objective | msat_make_maximize_signed (msat_env e, msat_term term) |
| Create the new objective 'max(term)'. The goal is interpreted as signed if it is of BV type. | |
| msat_objective | msat_make_minmax (msat_env e, size_t len, msat_term terms[]) |
| Create the new objective 'min(max(term0), ..., max(termN))'. | |
| msat_objective | msat_make_minmax_signed (msat_env e, size_t len, msat_term terms[]) |
| Create the new objective 'min(max(term0), ..., max(termN))'. The goal is interpreted as signed if it is of BV type. | |
| msat_objective | msat_make_maxmin (msat_env e, size_t len, msat_term terms[]) |
| Create the new objective 'max(min(term0), ..., min(termN))'. | |
| msat_objective | msat_make_maxmin_signed (msat_env e, size_t len, msat_term terms[]) |
| Create the new objective 'max(min(term0), ..., min(termN))'. The goal is interpreted as signed if it is of BV type. | |
| int | msat_assert_objective (msat_env e, msat_objective o) |
| Push an objective on the internal stack of objectives | |
| int | msat_destroy_objective (msat_env e, msat_objective o) |
| Destroy an objective. | |
| int | msat_assert_soft_formula (msat_env e, msat_term term, msat_term weight, const char *id) |
| Associate a weight to a term declaration with respect to a MaxSMT group identified by a common id label. Assert-soft constraints are ineffective unless the id label is used by an objective that is pushed on the stack. | |
| int | msat_load_objective_model (msat_env e, msat_objective obj) |
| Load into memory the model associated with the objective, provided that there exists a solution. | |
Objectives iteration | |
| msat_objective_iterator | msat_create_objective_iterator (msat_env e) |
| Create an objective iterator. Allowed only after an ::msat_solve call. | |
| int | msat_objective_iterator_has_next (msat_objective_iterator i) |
| Checks whether i can be incremented. | |
| int | msat_objective_iterator_next (msat_objective_iterator i, msat_objective *o) |
| Returns the next objective on the stack, and increments the given iterator. | |
| void | msat_destroy_objective_iterator (msat_objective_iterator i) |
| Destroys an objective iterator. | |
Functions for objective state inspection | |
| msat_opt_result | msat_objective_result (msat_env e, msat_objective o) |
| Returns the optimization search state of the given objective. | |
| msat_term | msat_objective_get_term (msat_env e, msat_objective o) |
| Returns the term which is optimized by the objective. | |
| msat_objective_type | msat_objective_get_type (msat_env e, msat_objective o) |
| Returns the objective optimization type (min or max). | |
| msat_model | msat_get_model (msat_env e, msat_objective obj) |
| Returns the model associated with a given objective (if any). | |
| char * | msat_objective_get_search_stats (msat_env e, msat_objective o) |
| Returns optimization search statistics. | |
| int | msat_objective_value_is_unbounded (msat_env e, msat_objective o, msat_objective_value i) |
| Determines if the given objective value is unbounded. | |
| int | msat_objective_value_is_plus_inf (msat_env e, msat_objective o, msat_objective_value i) |
| Determines if the given objective value is +INF. | |
| int | msat_objective_value_is_minus_inf (msat_env e, msat_objective o, msat_objective_value i) |
| Determines if the given objective value is -INF. | |
| int | msat_objective_value_is_strict (msat_env e, msat_objective o, msat_objective_value i) |
| Determines if the given objective value is strict. | |
| int | msat_objective_value_get_epsilon (msat_env e, msat_objective o, msat_objective_value i) |
| Returns the value of epsilon of a strict objective value. | |
| msat_term | msat_objective_value_term (msat_env e, msat_objective o, msat_objective_value i, msat_term inf, msat_term eps) |
| Returns term representation of the given objective value. | |
API specific to the OptiMathSAT OMT solver.
| #define MSAT_ERROR_OBJECTIVE | ( | obj | ) | ((obj).repr == NULL) |
Error checking for objectives.
Use this macro to check whether returned values of type msat_objective are valid.
| #define MSAT_ERROR_OBJECTIVE_ITERATOR | ( | objiter | ) | ((objiter).repr == NULL) |
Error checking for objective iterators.
Use this macro to check whether returned values of type msat_objective_iterator are valid
| enum msat_objective_value |
OptiMathSAT codes for queries on values in objective items.
| enum msat_objective_type |
| enum msat_opt_result |
| msat_objective msat_make_minimize | ( | msat_env | e, |
| msat_term | term, | ||
| ) |
Create the new objective 'min(term)'.
| e | The environment in which to operate. | |
| term | A generic linear arithmetic term to be minimized. |
| msat_objective msat_make_minimize_signed | ( | msat_env | e, |
| msat_term | term, | ) |
Create the new objective 'min(term)'. The goal is interpreted as signed if it is of BV type.
| e | The environment in which to operate. | |
| term | A generic linear arithmetic term to be minimized. |
| msat_objective msat_make_maximize | ( | msat_env | e, |
| msat_term | term, | ||
| ) |
Create the new objective 'max(term)'.
| e | The environment in which to operate. | |
| term | A generic linear arithmetic term to be maximized. |
| msat_objective msat_make_maximize_signed | ( | msat_env | e, |
| msat_term | term, | ||
| ) |
Create the new objective 'max(term)'. The goal is interpreted as signed if it is of BV type.
| e | The environment in which to operate. | |
| term | A generic linear arithmetic term to be maximized. |
| msat_objective msat_make_minmax | ( | msat_env | e, |
| size_t | len, | ||
| msat_term | terms[], | ||
| ) |
Create the new objective 'min(max(term0), ..., max(termN))'.
| e | The environment in which to operate. | |
| len | The size of terms. | |
| terms | The array of terms to be optimized. |
| msat_objective msat_make_minmax_signed | ( | msat_env | e, |
| size_t | len, | ||
| msat_term | terms[], | ||
| ) |
Create the new objective 'min(max(term0), ..., max(termN))'. The goal is interpreted as signed if it is of BV type.
| e | The environment in which to operate. | |
| len | The size of terms. | |
| terms | The array of terms to be optimized. |
| msat_objective msat_make_maxmin | ( | msat_env | e, |
| size_t | len, | ||
| msat_term | terms[], | ||
| ) |
Create the new objective 'max(min(term0), ..., min(termN))'.
| e | The environment in which to operate. | |
| len | The size of terms. | |
| terms | The array of terms to be optimized. |
| msat_objective msat_make_maxmin_signed | ( | msat_env | e, |
| size_t | len, | ||
| msat_term | terms[], | ||
| ) |
Create the new objective 'max(min(term0), ..., min(termN))'. The goal is interpreted as signed if it is of BV type.
| e | The environment in which to operate. | |
| len | The size of terms. | |
| terms | The array of terms to be optimized. |
| int msat_assert_objective | ( | msat_env | e, |
| msat_objective | o | ) |
Push an objective on the internal stack of objectives.
| e | The environment in which to operate. | |
| o | The objective to be pushed. |
| int msat_destroy_objective | ( | msat_env | e, |
| msat_objective | o | ) |
Destroys an objective.
| e | The environment in which to operate. | |
| o | The objective to be destroyed. |
| int msat_assert_soft_formula | ( | msat_env | e, |
| msat_term | term, | ||
| msat_term | weight, | ||
| const char * | id | ) |
Associate a weight to a term declaration with respect to a MaxSMT group identified by a common id label. Assert-soft constraints are ineffective unless the id label is used by an objective that is pushed on the stack.
| e | The environment in which to operate. | |
| term | The term to which a weight is attached. | |
| weight | The weight of not satisfying this soft-clause, must be of a Real or Integer number. | |
| id | The MaxSMT sum onto which the weight contribution is added. |
| msat_objective_iterator msat_create_objective_iterator | ( | msat_env | e | ) |
Creates an objective iterator. It can only be used after an ::msat_solve call and prior to any further call to msat_assert_formula/msat_push/msat_pop or other functions for creating objectives.
| e | The environment in which to operate. |
| int msat_objective_iterator_has_next | ( | msat_objective_iterator | i | ) |
Checks whether i can be incremented.
| i | An objective stack iterator. |
| int msat_objective_iterator_next | ( | msat_objective_iterator | i, |
| msat_objective * | o | ) |
Returns the next objective on the stack, and increments the given iterator.
| i | The objective iterator to increment. | |
| o | Output value for the next objective on the stack. |
| void msat_destroy_objective_iterator | ( | msat_objective_iterator | i | ) |
Destroys an objective iterator.
| i | The objective iterator to destroy. |
| msat_opt_result msat_objective_result | ( | msat_env | e, |
| msat_objective | o | ) |
Returns the optimization search state of the given objective.
Possible values:
| e | The environment in which to operate. | |
| o | The objective. |
| msat_term msat_objective_get_term | ( | msat_env | e, |
| msat_objective | o | ) |
Returns the term which is optimized by the objective.
| e | The environment in which to operate. | |
| o | The objective. |
| msat_objective_type msat_objective_get_type | ( | msat_env | e, |
| msat_objective | o | ) |
Returns the objective optimization type (min or max).
| e | The environment in which to operate. | |
| o | The objective. |
| int msat_load_objective_model | ( | msat_env | e, |
| msat_objective | o | ) |
Load into memory the model associated with the given objective, provided that there exists a solution.
Notes:
| e | The environment in which to operate. | |
| o | The objective. |
| msat_model msat_get_model | ( | msat_env | e, |
| msat_objective | o | ) |
Returns the model associated with the given objective (if any).
| e | The environment in which to operate. | |
| o | The objective. |
| char * msat_objective_get_search_stats | ( | msat_env | e, |
| msat_objective | o | ) |
Returns optimization search statistics.
| e | The environment in which to operate. | |
| term | The cost function to match. | |
| select | The rule to be used to match the model, defaults to MSAT_ANY_MODEL. |
| int msat_objective_value_is_unbounded | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i | ) |
Determines if the given objective value is unbounded.
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to be tested. |
| int msat_objective_value_is_plus_inf | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i | ) |
Determines if the given objective value is +INF.
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to be tested. |
| int msat_objective_value_is_minus_inf | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i | ) |
Determines if the given objective value is -INF.
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to be tested. |
| int msat_objective_value_is_strict | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i, | ) |
Determines if the given objective value is strict.
Example:
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to be tested. |
| int msat_objective_value_get_epsilon | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i, | ) |
Returns the value of epsilon of a strict objective value.
Example:
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to be tested. |
| int msat_objective_value_term | ( | msat_env | e, |
| msat_objective | o, | ||
| msat_objective_value | i, | ||
| msat_term | fin, | ||
| msat_term | eps | ) |
Returns the term representation of the given objective value.
| e | The environment in which to operate. | |
| o | The objective providing the value. | |
| i | The objective field to retrieve. | |
| fin | The symbol / positive value representing infinity. If equal to MSAT_ERROR_TERM, OptiMathSAT picks his own value. | |
| eps | The symbol / positive value representing epsilon. If equal to MSAT_ERROR_TERM, OptiMathSAT picks his own value. |