Common Definitions¶
Header: mp/common.h
-
enum
mp::var::Type¶ Variable type.
Values:
-
enumerator
CONTINUOUS¶ A continuous variable.
-
enumerator
INTEGER¶ An integer variable.
-
enumerator
-
enum
mp::obj::Type¶ Objective type.
Values:
-
enumerator
MIN= 0¶ A minimization objective.
-
enumerator
MAX= 1¶ A maximization objective.
-
enumerator
-
enum
mp::func::Type¶ Function type.
Values:
-
enumerator
NUMERIC= 0¶ A numeric function.
-
enumerator
SYMBOLIC= 1¶ A symbolic function accepting numeric and string arguments.
-
enumerator
-
class
mp::ComplInfo¶ Complementarity constraint information.
Public Functions
-
ComplInfo(int flags)¶ Constructs a
ComplInfo()object.
-
double
con_lb() const¶ Constraint lower bound.
-
double
con_ub() const¶ Constraint upper bound.
-
-
enum
mp::suf::Kind¶ Suffix kind.
Values:
-
enumerator
VAR= 0¶ Applies to variables.
-
enumerator
CON= 1¶ Applies to constraints.
-
enumerator
OBJ= 2¶ Applies to objectives.
-
enumerator
PROBLEM= 3¶ Applies to problems.
-
enumerator
-
enum
mp::sol::Status¶ Solution status.
Values:
-
enumerator
UNKNOWN= -1¶ Unknown status.
-
enumerator
SOLVED= 0¶ An optimal solution found for an optimization problem or a feasible solution found for a satisfaction problem.
-
enumerator
UNCERTAIN= 100¶ Solution returned but it can be non-optimal or even infeasible.
-
enumerator
INFEASIBLE= 200¶ Problem is infeasible.
-
enumerator
UNBOUNDED= 300¶ Problem is unbounded.
-
enumerator
LIMIT= 400¶ Stopped by a limit, e.g.
on iterations or time.
-
enumerator
FAILURE= 500¶ A solver error.
-
enumerator
INTERRUPTED= 600¶ Interrupted by the user.
-
enumerator
-
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= 0¶ An unknown expression.
-
enumerator
FIRST_EXPR¶ The first expression kind other than the unknown expression kind.
-
enumerator
FIRST_NUMERIC= FIRST_EXPR¶ The first numeric expression kind. Numeric expression kinds are in the range [
FIRST_NUMERIC,LAST_NUMERIC].
-
enumerator
NUMBER= FIRST_NUMERIC¶ 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= FIRST_REFERENCE¶ A reference to a variable.
-
enumerator
COMMON_EXPR¶ A reference to a common expression.
-
enumerator
LAST_REFERENCE= COMMON_EXPR¶ 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= FIRST_UNARY¶ 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
FIRST_BINARY¶ The first binary expression kind. Binary expression kinds are in the range [
FIRST_BINARY,LAST_BINARY].
-
enumerator
ADD= FIRST_BINARY¶ 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
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= FIRST_ITERATED¶ A vararg expression, \(\mathrm{min}\) or \(\mathrm{max}\). Vararg expression kinds are in the range [
FIRST_VARARG,LAST_VARARG].
-
enumerator
MIN= FIRST_VARARG¶ 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
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
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
FIRST_LOGICAL¶ The first logical expression kind. Logical expression kinds are in the range [
FIRST_LOGICAL,LAST_LOGICAL].
-
enumerator
BOOL= FIRST_LOGICAL¶ 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= FIRST_BINARY_LOGICAL¶ 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
FIRST_RELATIONAL¶ The first relational expression kind. Relational expression kinds are in the range [
FIRST_RELATIONAL,LAST_RELATIONAL].
-
enumerator
LT= FIRST_RELATIONAL¶ 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
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= FIRST_LOGICAL_COUNT¶ 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= NOT_EXACTLY¶ 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= FIRST_ITERATED_LOGICAL¶ 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
FIRST_PAIRWISE¶ The first pairwise expression kind. Pairwise expression kinds are in the range [
FIRST_PAIRWISE,LAST_PAIRWISE].
-
enumerator
ALLDIFF= FIRST_PAIRWISE¶ 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= NOT_ALLDIFF¶ The last pairwise expression kind.
-
enumerator
LAST_LOGICAL= LAST_PAIRWISE¶ 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
-
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_BASEandPOW_CONST_EXPall have the same representation “^”.
-
struct
mp::ProblemInfo¶ Information about an optimization problem.
Subclassed by mp::NLHeader
Public Functions
-
int
num_integer_vars() const¶ Returns the number of integer variables (includes binary variable).
-
int
num_continuous_vars() const¶ Returns the number of continuous variables.
-
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.
-
int