Common Definitions¶
Header: mp/common.h
-
enum mp::var::Type¶
Variable type.
Values:
-
enumerator CONTINUOUS¶
A continuous variable.
-
enumerator INTEGER¶
An integer variable.
-
enumerator CONTINUOUS¶
-
enum mp::obj::Type¶
Objective type.
Values:
-
enumerator MIN¶
A minimization objective.
-
enumerator MAX¶
A maximization objective.
-
enumerator MIN¶
-
enum mp::func::Type¶
Function type.
Values:
-
enumerator NUMERIC¶
A numeric function.
-
enumerator SYMBOLIC¶
A symbolic function accepting numeric and string arguments.
-
enumerator NUMERIC¶
-
class mp::ComplInfo¶
Complementarity constraint information.
Public Functions
-
inline explicit ComplInfo(int flags)¶
Constructs a
ComplInfo()
object.
-
inline double con_lb() const¶
Constraint lower bound.
-
inline double con_ub() const¶
Constraint upper bound.
-
inline explicit ComplInfo(int flags)¶
-
enum mp::suf::Kind¶
Suffix kind.
Values:
-
enumerator VAR¶
Applies to variables.
-
enumerator CON¶
Applies to constraints.
-
enumerator OBJ¶
Applies to objectives.
-
enumerator PROBLEM¶
Applies to problems.
-
enumerator VAR¶
-
enum mp::sol::Status¶
Solution status.
Values:
-
enumerator UNKNOWN¶
Unknown status.
-
enumerator SOLVED¶
An optimal solution found for an optimization problem or a feasible solution found for a satisfaction problem.
-
enumerator UNCERTAIN¶
Solution returned but it can be non-optimal or even infeasible.
-
enumerator INFEASIBLE¶
Problem is infeasible.
-
enumerator UNBOUNDED¶
Problem is unbounded.
-
enumerator LIMIT¶
Stopped by a limit, e.g.
on iterations or time.
-
enumerator FAILURE¶
A solver error.
-
enumerator INTERRUPTED¶
Interrupted by the user.
-
enumerator UNKNOWN¶
-
enum mp::expr::Kind¶
Expression kind. Both AMPL-like and mathematical notation is given for each expression in the descriptions below as in \(\mathrm{abs}(x) = |x|\), unless they are identical such as \(\mathrm{sin}(x)\) or there is no standard mathematical notation.
Values:
-
enumerator UNKNOWN¶
An unknown expression.
-
enumerator FIRST_EXPR¶
The first expression kind other than the unknown expression kind.
-
enumerator FIRST_NUMERIC¶
The first numeric expression kind. Numeric expression kinds are in the range [
FIRST_NUMERIC
,LAST_NUMERIC
].
-
enumerator NUMBER¶
A number such as 42 or -1.23e-4.
-
enumerator FIRST_REFERENCE¶
The first reference expression kind. Reference expression kinds are in the range [
FIRST_REFERENCE
,LAST_REFERENCE
].
-
enumerator VARIABLE¶
A reference to a variable.
-
enumerator COMMON_EXPR¶
A reference to a common expression.
-
enumerator LAST_REFERENCE¶
The last reference expression kind.
-
enumerator FIRST_UNARY¶
The first unary numeric expression kind. Unary numeric expression kinds are in the range [
FIRST_UNARY
,LAST_UNARY
].
-
enumerator MINUS¶
A unary minus, \(-x\).
-
enumerator ABS¶
The absolute value function, \(\mathrm{abs}(x) = |x|\).
-
enumerator FLOOR¶
The floor function, \(\mathrm{floor}(x) = \lfloor x \rfloor\).
-
enumerator CEIL¶
The ceiling function, \(\mathrm{ceil}(x) = \lceil x \rceil\).
-
enumerator SQRT¶
The square root function, \(\mathrm{sqrt}(x) = \sqrt{x}\).
-
enumerator POW2¶
Squaring: \(x \mathop{\verb!^!} 2 = x^2\).
-
enumerator EXP¶
The natural exponential function, \(\mathrm{exp}(x) = e^x\).
-
enumerator LOG¶
The natural logarithmic function, \(\mathrm{log}(x) = \mathrm{ln}(x)\).
-
enumerator LOG10¶
The base 10 logarithmic function, \(\mathrm{log10}(x) = \mathrm{log}_{10}(x)\).
-
enumerator SIN¶
Sine, \(\mathrm{sin}(x)\).
-
enumerator SINH¶
Hyperbolic sine, \(\mathrm{sinh}(x)\).
-
enumerator COS¶
Cosine, \(\mathrm{cos}(x)\).
-
enumerator COSH¶
Hyperbolic cosine, \(\mathrm{cosh}(x)\).
-
enumerator TAN¶
Tangent, \(\mathrm{tan}(x)\).
-
enumerator TANH¶
Hyperbolic tangent, \(\mathrm{tan}(x)\).
-
enumerator ASIN¶
Inverse sine, \(\mathrm{asin}(x) = \mathrm{sin}^{-1}(x)\).
-
enumerator ASINH¶
Inverse hyperbolic sine, \(\mathrm{asinh}(x) = \mathrm{sinh}^{-1}(x)\).
-
enumerator ACOS¶
Inverse cosine, \(\mathrm{acos}(x) = \mathrm{cos}^{-1}(x)\).
-
enumerator ACOSH¶
Inverse hyperbolic cosine, \(\mathrm{acosh}(x) = \mathrm{cosh}^{-1}(x)\).
-
enumerator ATAN¶
Inverse tangent, \(\mathrm{atan}(x) = \mathrm{tan}^{-1}(x)\).
-
enumerator ATANH¶
Inverse hyperbolic tangent, \(\mathrm{atanh}(x) = \mathrm{tanh}^{-1}(x)\).
-
enumerator LAST_UNARY¶
The last unary numeric expression kind.
-
enumerator FIRST_BINARY¶
The first binary expression kind. Binary expression kinds are in the range [
FIRST_BINARY
,LAST_BINARY
].
-
enumerator ADD¶
Addition, \(x + y\).
-
enumerator SUB¶
Subtraction, \(x - y\).
-
enumerator LESS¶
The \(\mathrm{less}\) operation, \(x \mathop{\rm less} y = \mathrm{max}(x - y, 0)\).
-
enumerator MUL¶
Multiplication, \(x * y = x y\).
-
enumerator DIV¶
Division, \(x / y\).
-
enumerator TRUNC_DIV¶
Truncated division, \(x \mathop{\rm div} y = \mathrm{trunc}(x / y)\).
-
enumerator MOD¶
The modulo operation, \(x \mathop{\rm mod} y\).
-
enumerator POW¶
Exponentiation, \(x \mathop{\verb!^!} y = x^y\).
-
enumerator POW_CONST_BASE¶
Exponentiation with a constant base, \(a^x\).
-
enumerator POW_CONST_EXP¶
Exponentiation with a constant exponent \(x^a\).
-
enumerator ATAN2¶
Inverse tangent, \(\mathrm{atan2}(y, x) = \mathrm{tan}^{-1}(y/x)\).
-
enumerator PRECISION¶
The function \(\mathrm{precision}(x, n)\) which returns \(x\) rounded to \(n\) significant decimal digits.
-
enumerator ROUND¶
The function \(\mathrm{round}(x, n)\) which returns \(x\) rounded to \(n\) digits past decimal point.
-
enumerator TRUNC¶
The function \(\mathrm{trunc}(x, n)\) which returns \(x\) truncated to \(n\) digits past decimal point.
-
enumerator LAST_BINARY¶
The last binary numeric expression kind.
-
enumerator IF¶
An if-then-else expression, \(\mathrm{if}\;c\;\mathrm{then}\;e_1\;[\mathrm{else}\;e_2]\), where \(c\) is a logical expression representing condition, while \(e_1\) and \(e_2\) are numeric expressions. The expression evaluates to \(e_1\) if \(c\) is true and to \(e_2\) otherwise. If the else clause is omitted, \(e_2\) is assumed to be zero.
-
enumerator PLTERM¶
A piecewise-linear term, \(\verb|<<|b_1, ..., b_n; s_1, ..., s_{n + 1}\verb|>> | r\), where \(b_i\) are breakpoints, \(s_i\) are slopes and \(r\) is a
reference
.
-
enumerator CALL¶
A function call, \(f(e_1, ..., e_n)\), where \(f\) is a function name and \(e_i\) are numeric or string expressions.
-
enumerator FIRST_ITERATED¶
The first iterated expression kind. Iterated expression kinds are in the range [
FIRST_ITERATED
,LAST_ITERATED
].The term “iterated” in the context of operators and expressions comes from the article AMPL: A Mathematical Programming Language and is used to denote operators indexed over sets.
-
enumerator FIRST_VARARG¶
A vararg expression, \(\mathrm{min}\) or \(\mathrm{max}\). Vararg expression kinds are in the range [
FIRST_VARARG
,LAST_VARARG
].
-
enumerator MIN¶
Minimum, \(\mathrm{min}(e_1, ..., e_n) = \min_{i=1,...,n} e_i\).
-
enumerator MAX¶
Maximum, \(\mathrm{max}(e_1, ..., e_n) = \max_{i=1,...,n} e_i\).
-
enumerator LAST_VARARG¶
The last vararg expression kind.
-
enumerator SUM¶
Summation, \(\mathrm{sum}(e_1, ..., e_n) = \sum_{i=1}^n e_i\).
-
enumerator NUMBEROF¶
A \(\mathrm{numberof}\) expression, \(\mathrm{numberof}\;e_0\;\mathrm{in}\;(e_1, ..., e_n)\), which evaluates to the number of times the value of \(e_0\) appears among the values of \(e_1, ..., e_n\).
-
enumerator LAST_ITERATED¶
The last iterated expression kind.
-
enumerator NUMBEROF_SYM¶
A symbolic \(\mathrm{numberof}\) expression. \(\mathrm{numberof}\;s_0\;\mathrm{in}\;(s_1, ..., s_n)\), which evaluates to the number of times the value of \(s_0\) appears among the values of \(s_1, ..., s_n\).
-
enumerator COUNT¶
A \(\mathrm{count}\) expression, \(\mathrm{count}(l_1, ..., l_n)\), where \(l_i\) are logical expressions. This expression evaluates to the number of \(l_i\) whose values are true.
-
enumerator LAST_NUMERIC¶
The last numeric expression kind.
-
enumerator FIRST_LOGICAL¶
The first logical expression kind. Logical expression kinds are in the range [
FIRST_LOGICAL
,LAST_LOGICAL
].
-
enumerator BOOL¶
A Boolean (logical) constant, true or false.
-
enumerator NOT¶
A logical not, \(!l\), where \(l\) is a logical expression.
-
enumerator FIRST_BINARY_LOGICAL¶
The first binary logical expression kind. Binary logical expression kinds are in the range [
FIRST_BINARY_LOGICAL
,LAST_BINARY_LOGICAL
].
-
enumerator OR¶
Logical or, \(l_1\) || \(l_2\).
-
enumerator AND¶
Logical and, \(l_1\) && \(l_2\).
-
enumerator IFF¶
If and only if, \(l_1\) <==> \(l_2\).
-
enumerator LAST_BINARY_LOGICAL¶
The last binary logical expression kind.
-
enumerator FIRST_RELATIONAL¶
The first relational expression kind. Relational expression kinds are in the range [
FIRST_RELATIONAL
,LAST_RELATIONAL
].
-
enumerator LT¶
Less than, \(e_1\) < \(e_2\).
-
enumerator LE¶
Less or equal to, \(e_1\) <= \(e_2\).
-
enumerator EQ¶
Equal to, \(e_1\) = \(e_2\).
-
enumerator GE¶
Greater or equal to, \(e_1\) >= \(e_2\).
-
enumerator GT¶
Greater than, \(e_1\) > \(e_2\).
-
enumerator NE¶
Not equal to, \(e_1\) != \(e_2\).
-
enumerator LAST_RELATIONAL¶
The last relational expression kind.
-
enumerator FIRST_LOGICAL_COUNT¶
The first logical count expression kind. Logical count expression kinds are in the range [
FIRST_LOGICAL_COUNT
,LAST_LOGICAL_COUNT
].
-
enumerator ATLEAST¶
An \(\mathrm{atleast}\) expression, \(\mathrm{atleast}\;e\;(l_1, ..., l_n)\), where \(e\) is a numeric expression and \(l_i\) are logical expressions. It evaluates to true if at least \(e\) expressions \(l_i\) are true.
-
enumerator ATMOST¶
An \(\mathrm{atmost}\) expression, \(\mathrm{atmost}\;e\;(l_1, ..., l_n)\), where \(e\) is a numeric expression and \(l_i\) are logical expressions. It evaluates to true if at most \(e\) expressions \(l_i\) are true.
-
enumerator EXACTLY¶
An \(\mathrm{exactly}\) expression, \(\mathrm{exactly}\;e\;(l_1, ..., l_n)\), where \(e\) is a numeric expression and \(l_i\) are logical expressions. It evaluates to true if exactly \(e\) expressions \(l_i\) are true.
-
enumerator NOT_ATLEAST¶
The negation of an \(\mathrm{atleast}\) expression, \(!\mathrm{atleast}\;e\;(l_1, ..., l_n)\).
-
enumerator NOT_ATMOST¶
The negation of an \(\mathrm{atmost}\) expression, \(!\mathrm{atmost}\;e\;(l_1, ..., l_n)\).
-
enumerator NOT_EXACTLY¶
The negation of an \(\mathrm{exactly}\) expression, \(!\mathrm{exactly}\;e\;(l_1, ..., l_n)\).
-
enumerator LAST_LOGICAL_COUNT¶
The last logical count expression kind.
-
enumerator IMPLICATION¶
An implication expression, \(c\;\verb|==>|\;l_1\;[\mathrm{else}\;l_2]\), where \(c\) is a logical expression representing condition, while \(l_1\) and \(l_2\) are logical expressions. The expression evaluates to \(l_1\) if \(c\) is true and to \(l_2\) otherwise. If the else clause is omitted, \(l_2\) is assumed to be true.
-
enumerator FIRST_ITERATED_LOGICAL¶
The first iterated logical expression kind. Iterated logical expression kinds are in the range [
FIRST_ITERATED_LOGICAL
,LAST_ITERATED_LOGICAL
].
-
enumerator EXISTS¶
An \(\mathrm{exists}\) expression, \(\mathrm{exists}(l_1, ..., l_n)\), where \(l_i\) are logical expressions. It evaluates to true if at least one \(l_i\) is true.
-
enumerator FORALL¶
A \(\mathrm{forall}\) expression, \(\mathrm{forall}(l_1, ..., l_n)\), where \(l_i\) are logical expressions. It evaluates to true if all \(l_i\) are true.
-
enumerator LAST_ITERATED_LOGICAL¶
The last iterated logical expression kind.
-
enumerator FIRST_PAIRWISE¶
The first pairwise expression kind. Pairwise expression kinds are in the range [
FIRST_PAIRWISE
,LAST_PAIRWISE
].
-
enumerator ALLDIFF¶
An alldifferent expression, \(\mathrm{alldiff}(e_1, ..., e_n)\), where \(e_i\) are numeric expressions. It evaluates to true if all \(e_i\) take different values.
-
enumerator NOT_ALLDIFF¶
The negation of an alldifferent expression, \(!\mathrm{alldiff}(e_1, ..., e_n)\).
-
enumerator LAST_PAIRWISE¶
The last pairwise expression kind.
-
enumerator LAST_LOGICAL¶
The last logical expression kind.
-
enumerator STRING¶
A string such as “abc”.
-
enumerator IFSYM¶
A symbolic if-then-else expression. \(\mathrm{if}\;c\;\mathrm{then}\;e_1\;[\mathrm{else}\;e_2]\), where \(c\) is a logical expression representing condition, while \(e_1\) and \(e_2\) are numeric or string expressions. The expression evaluates to \(e_1\) if \(c\) is true and to \(e_2\) otherwise. If \(e_2\) is omitted, it is assumed to be zero.
-
enumerator LAST_EXPR¶
The last expression kind.
-
enumerator UNKNOWN¶
-
inline const char *mp::expr::str(expr::Kind kind)¶
Returns the string representation of the given expression kind. Expressions of different kinds can have identical strings. For example,
POW
,POW_CONST_BASE
andPOW_CONST_EXP
all have the same representation “^”.
-
inline int mp::expr::nl_opcode(expr::Kind kind)¶
Returns the NL opcode for the given expression kind.
-
struct mp::ProblemInfo¶
Information about an optimization problem.
Subclassed by mp::NLHeader
Public Functions
-
inline int num_integer_vars() const¶
Returns the number of integer variables (includes binary variable).
-
inline int num_continuous_vars() const¶
Returns the number of continuous variables.
-
inline int num_common_exprs() const¶
Returns the total number of common expressions.
Public Members
-
int num_vars¶
Total number of variables.
-
int num_algebraic_cons¶
Number of algebraic constraints including ranges and equality constraints.
It doesn’t include logical constraints.
-
int num_objs¶
Total number of objectives.
-
int num_ranges¶
Number of ranges (constraints with -Infinity < LHS < RHS < Infinity).
-
int num_eqns¶
Number of equality constraints or -1 if unknown (AMPL prior to 19970627).
-
int num_logical_cons¶
Number of logical constraints.
-
int num_nl_cons¶
Total number of nonlinear constraints.
-
int num_nl_objs¶
Total number of nonlinear objectives.
-
int num_compl_conds¶
Total number of complementarity conditions.
-
int num_nl_compl_conds¶
Number of nonlinear complementarity conditions.
-
int num_compl_dbl_ineqs¶
Number of complementarities involving double inequalities.
-
int num_compl_vars_with_nz_lb¶
Number of complemented variables with a nonzero lower bound.
-
int num_nl_net_cons¶
Number of nonlinear network constraints.
-
int num_linear_net_cons¶
Number of linear network constraints.
-
int num_nl_vars_in_cons¶
Number of nonlinear variables in constraints including nonlinear variables in both constraints and objectives.
-
int num_nl_vars_in_objs¶
Number of nonlinear variables in objectives including nonlinear variables in both constraints and objectives.
-
int num_nl_vars_in_both¶
Number of nonlinear variables in both constraints and objectives.
-
int num_linear_net_vars¶
Number of linear network variables (arcs).
-
int num_funcs¶
Number of functions.
-
int num_linear_binary_vars¶
Number of linear binary variables.
-
int num_linear_integer_vars¶
Number of linear non-binary integer variables.
-
int num_nl_integer_vars_in_both¶
Number of integer nonlinear variables in both constraints and objectives.
-
int num_nl_integer_vars_in_cons¶
Number of integer nonlinear variables just in constraints.
-
int num_nl_integer_vars_in_objs¶
Number of integer nonlinear variables just in objectives.
-
std::size_t num_con_nonzeros¶
Number of nonzeros in constraints’ Jacobian.
-
std::size_t num_obj_nonzeros¶
Number of nonzeros in all objective gradients.
-
int max_con_name_len¶
Length of longest constraint name if names are available.
-
int max_var_name_len¶
Length of longest variable name if names are available.
-
int num_common_exprs_in_both¶
Number of common expressions that appear both in constraints and objectives.
-
int num_common_exprs_in_cons¶
Number of common expressions that appear in multiple constraints and don’t appear in objectives.
-
int num_common_exprs_in_objs¶
Number of common expressions that appear in multiple objective and don’t appear in constraints.
-
int num_common_exprs_in_single_cons¶
Number of common expressions that only appear in a single constraint and don’t appear in objectives.
-
int num_common_exprs_in_single_objs¶
Number of common expressions that only appear in a single objective and don’t appear in constraints.
-
inline int num_integer_vars() const¶