Initializing help system before first use

utils

Utilities for modeling. More...

Functions

auto  abs (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for abs(value).
 
auto  arccos (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for arccos(value).
 
auto  arcsin (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for arcsin(value).
 
auto  arctan (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for arctan(value).
 
auto  cos (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for cos(value).
 
auto  div (double dividend, Expression divisor) -> xpress::objects::Expression
  Create an expression for dividend + divisor.
 
auto  div (Expression dividend, double divisor) -> xpress::objects::Expression
  Create an expression for dividend + divisor.
 
auto  div (Expression dividend, Expression divisor) -> xpress::objects::Expression
  Create an expression for dividend / divisor.
 
auto  exp (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for exp(value).
 
auto  ln (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for ln(value).
 
auto  log10 (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for log10(value).
 
template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto  max (VALUE... value) -> xpress::objects::InternalFunctionExpression
  Create an expression for max(value, ...).
 
auto  max (xpress::SizedArray< Expression const > const &value) -> xpress::objects::InternalFunctionExpression
  Create an expression for max(value, ...).
 
template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto  min (VALUE... value) -> xpress::objects::InternalFunctionExpression
  Create an expression for min(value, ...).
 
auto  min (xpress::SizedArray< Expression const > const &value) -> xpress::objects::InternalFunctionExpression
  Create an expression for min(value, ...).
 
auto  minus (double minuend, Expression subtrahend) -> xpress::objects::Expression
  Create an expression for minuend + subtrahend.
 
auto  minus (Expression minuend, double subtrahend) -> xpress::objects::Expression
  Create an expression for minuend + subtrahend.
 
auto  minus (Expression minuend, Expression subtrahend) -> xpress::objects::Expression
  Create an expression for minuend - subtrahend.
 
auto  mul (double factor1, Expression factor2) -> xpress::objects::Expression
  Create an expression for factor1 + factor2.
 
auto  mul (Expression factor1, double factor2) -> xpress::objects::Expression
  Create an expression for factor1 + factor2.
 
auto  mul (Expression factor1, Expression factor2) -> xpress::objects::Expression
  Create an expression for factor1 * factor2.
 
auto  plus (double augend, Expression addend) -> xpress::objects::Expression
  Create an expression for augend + addend.
 
auto  plus (Expression augend, double addend) -> xpress::objects::Expression
  Create an expression for augend + addend.
 
auto  plus (Expression augend, Expression addend) -> xpress::objects::Expression
  Create an expression for augend + addend.
 
auto  pow (double basis, Expression exp) -> xpress::objects::BinaryExpression
  Create an expression for base ^ exp.
 
auto  pow (Expression basis, double exp) -> xpress::objects::BinaryExpression
  Create an expression for base ^ exp.
 
auto  pow (Expression basis, Expression exp) -> xpress::objects::BinaryExpression
  Create an expression for base ^ exp.
 
template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto  prod (VALUE... value) -> xpress::objects::Expression
  Create an expression for prod(value, ...).
 
auto  prod (xpress::SizedArray< Expression const > const &value) -> xpress::objects::Expression
  Create an expression for prod(value, ...).
 
template<typename K >
auto  scalarProduct (std::unordered_map< K, Variable > variables, std::unordered_map< K, double > coefs) -> xpress::objects::LinExpression
  Compute the scalar product between a map of variables and a map of coefficients.
 
template<typename Strm0 , typename Strm1 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Strm1IsStream = typename std::enable_if<xpress::is_stream<Strm1>::value>::type>
auto  scalarProduct (Strm0 const &variables, Strm1 const &coefs) -> xpress::objects::LinExpression
  Compute the scalar product between a vector of variables and a vector of coefficients.
 
template<typename Strm0 , typename Strm1 , typename Strm2 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Strm1IsStream = typename std::enable_if<xpress::is_stream<Strm1>::value>::type, typename Strm2IsStream = typename std::enable_if<xpress::is_stream<Strm2>::value>::type>
auto  scalarProduct (Strm0 const &variables1, Strm1 const &variables2, Strm2 const &coefs) -> xpress::objects::QuadExpression
  Compute the elementwise product between two vectors of variables and a vector of coefficients.
 
auto  sign (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for sign(value).
 
auto  sin (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for sin(value).
 
auto  sqrt (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for sqrt(value).
 
template<typename... MORETERMS, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, MORETERMS...>::value>::type>
auto  sum (Expression firstTerm, MORETERMS... moreTerms) -> xpress::objects::SumExpression
  Create an expression from an array of other expressions.
 
template<typename A = Expression, typename Func0 , typename Func0Invocable = typename std::enable_if<std::is_convertible<typename std::invoke_result<Func0,int const &>::type,A>::value>::type>
auto  sum (int count, Func0 makeTerm) -> xpress::objects::SumExpression
  Create a sum of expressions.
 
template<typename Strm0 , typename A = Expression, typename T = typename Strm0::value_type, typename Func0 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Func0Invocable = typename std::enable_if<std::is_convertible<typename std::invoke_result<Func0,T const &>::type,A>::value>::type>
auto  sum (Strm0 const &data, Func0 makeTerm) -> xpress::objects::SumExpression
  Create a sum of expressions.
 
template<typename Strm0 , typename T = typename Strm0::value_type, typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type>
auto  sum (Strm0 const &terms) -> xpress::objects::SumExpression
  Create an expression from a stream of other expressions.
 
auto  tan (Expression value) -> xpress::objects::InternalFunctionExpression
  Create an expression for tan(value).
 
auto  uminus (Expression value) -> xpress::objects::Expression
  Create an expression for -value.
 

Detailed Description

Utilities for modeling.

Since
44.00

Function Documentation

abs()

auto xpress::objects::utils::abs ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for abs(value).

Parameters
value Function argument.
Returns
abs(value).
Since
44.00

arccos()

auto xpress::objects::utils::arccos ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for arccos(value).

Parameters
value Function argument.
Returns
arccos(value).
Since
44.00

arcsin()

auto xpress::objects::utils::arcsin ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for arcsin(value).

Parameters
value Function argument.
Returns
arcsin(value).
Since
44.00

arctan()

auto xpress::objects::utils::arctan ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for arctan(value).

Parameters
value Function argument.
Returns
arctan(value).
Since
44.00

cos()

auto xpress::objects::utils::cos ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for cos(value).

Parameters
value Function argument.
Returns
cos(value).
Since
44.00

div() [1/3]

auto xpress::objects::utils::div ( double dividend,
Expression divisor ) -> xpress::objects::Expression
inline

Create an expression for dividend + divisor.

This is equivalent to ConstantExpression(dividend).div(divisor) and is only provided for completeness.

Parameters
dividend dividend.
divisor divisor.
Returns
quotient of dividend and divisor.
Since
44.00

div() [2/3]

auto xpress::objects::utils::div ( Expression dividend,
double divisor ) -> xpress::objects::Expression
inline

Create an expression for dividend + divisor.

This is equivalent to dividend.div(divisor) and is only provided for completeness.

Parameters
dividend dividend.
divisor divisor.
Returns
quotient of dividend and divisor.
Since
44.00

div() [3/3]

auto xpress::objects::utils::div ( Expression dividend,
Expression divisor ) -> xpress::objects::Expression
inline

Create an expression for dividend / divisor.

This is equivalent to dividend.div(divisor) and is only provided for completeness.

Parameters
dividend dividend.
divisor divisor.
Returns
quotient of dividend and divisor.
Since
44.00

exp()

auto xpress::objects::utils::exp ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for exp(value).

Parameters
value Function argument.
Returns
exp(value).
Since
44.00

ln()

auto xpress::objects::utils::ln ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for ln(value).

Parameters
value Function argument.
Returns
ln(value).
Since
44.00

log10()

auto xpress::objects::utils::log10 ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for log10(value).

Parameters
value Function argument.
Returns
log10(value).
Since
44.00

max() [1/2]

template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto xpress::objects::utils::max ( VALUE... value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for max(value, ...).

Consider also using Variable.maxOf.

Parameters
value Arguments.
Returns
max(value...).
Since
44.00

max() [2/2]

auto xpress::objects::utils::max ( xpress::SizedArray< Expression const > const & value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for max(value, ...).

Consider also using Variable.maxOf.

Parameters
value Arguments.
Returns
max(value...).
Since
44.00

min() [1/2]

template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto xpress::objects::utils::min ( VALUE... value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for min(value, ...).

Consider also using Variable.minOf(...).

Parameters
value Arguments.
Returns
min(value...).
Since
44.00

min() [2/2]

auto xpress::objects::utils::min ( xpress::SizedArray< Expression const > const & value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for min(value, ...).

Consider also using Variable.minOf(...).

Parameters
value Arguments-
Returns
min(value...).
Since
44.00

minus() [1/3]

auto xpress::objects::utils::minus ( double minuend,
Expression subtrahend ) -> xpress::objects::Expression
inline

Create an expression for minuend + subtrahend.

This is equivalent to ConstantExpression(minuend).minus(subtrahend) and is only provided for completeness.

Parameters
minuend minuend.
subtrahend subtrahend.
Returns
difference of minuend and subtrahend.
Since
44.00

minus() [2/3]

auto xpress::objects::utils::minus ( Expression minuend,
double subtrahend ) -> xpress::objects::Expression
inline

Create an expression for minuend + subtrahend.

This is equivalent to minuend.minus(subtrahend) and is only provided for completeness.

Parameters
minuend minuend.
subtrahend subtrahend.
Returns
difference of minuend and subtrahend.
Since
44.00

minus() [3/3]

auto xpress::objects::utils::minus ( Expression minuend,
Expression subtrahend ) -> xpress::objects::Expression
inline

Create an expression for minuend - subtrahend.

This is equivalent to minuend.minus(subtrahend) and is only provided for completeness.

Parameters
minuend minuend.
subtrahend subtrahend.
Returns
difference of minuend and subtrahend.
Since
44.00

mul() [1/3]

auto xpress::objects::utils::mul ( double factor1,
Expression factor2 ) -> xpress::objects::Expression
inline

Create an expression for factor1 + factor2.

This is equivalent to ConstantExpression(factor1).mul(factor2) and is only provided for completeness.

Parameters
factor1 factor1.
factor2 factor2.
Returns
product of factor1 and factor2.
Since
44.00

mul() [2/3]

auto xpress::objects::utils::mul ( Expression factor1,
double factor2 ) -> xpress::objects::Expression
inline

Create an expression for factor1 + factor2.

This is equivalent to factor1.mul(factor2) and is only provided for completeness.

Parameters
factor1 factor1.
factor2 factor2.
Returns
product of factor1 and factor2.
Since
44.00

mul() [3/3]

auto xpress::objects::utils::mul ( Expression factor1,
Expression factor2 ) -> xpress::objects::Expression
inline

Create an expression for factor1 * factor2.

This is equivalent to factor1.mul(factor2) and is only provided for completeness.

Parameters
factor1 factor1.
factor2 factor2.
Returns
product of factor1 and factor2.
Since
44.00

plus() [1/3]

auto xpress::objects::utils::plus ( double augend,
Expression addend ) -> xpress::objects::Expression
inline

Create an expression for augend + addend.

This is equivalent to ConstantExpression(augend).plus(addend) and is only provided for completeness.

Parameters
augend augend.
addend addend.
Returns
sum of augend and addend.
Since
44.00

plus() [2/3]

auto xpress::objects::utils::plus ( Expression augend,
double addend ) -> xpress::objects::Expression
inline

Create an expression for augend + addend.

This is equivalent to augend.plus(addend) and is only provided for completeness.

Parameters
augend augend.
addend addend.
Returns
sum of augend and addend.
Since
44.00

plus() [3/3]

auto xpress::objects::utils::plus ( Expression augend,
Expression addend ) -> xpress::objects::Expression
inline

Create an expression for augend + addend.

This is equivalent to augend.plus(addend) and is only provided for completeness.

Parameters
augend augend.
addend addend.
Returns
sum of augend and addend.
Since
44.00

pow() [1/3]

auto xpress::objects::utils::pow ( double basis,
Expression exp ) -> xpress::objects::BinaryExpression
inline

Create an expression for base ^ exp.

Note that adding the result of pow to your model in any way will turn the model into a non-linear model. In order to square a variable or linear expression, use one of Variable#square(), LinTerm#square(), or LinExpression#square(). They all create linear or quadratic expressions.

Parameters
basis Base.
exp Exponent.
Returns
basis raised to the power of exp.
Since
44.00

pow() [2/3]

auto xpress::objects::utils::pow ( Expression basis,
double exp ) -> xpress::objects::BinaryExpression
inline

Create an expression for base ^ exp.

Note that adding the result of pow to your model in any way will turn the model into a non-linear model. In order to square a variable or linear expression, use one of Variable#square(), LinTerm#square(), or LinExpression#square(). They all create linear or quadratic expressions.

Parameters
basis Base.
exp Exponent.
Returns
basis raised to the power of exp.
Since
44.00

pow() [3/3]

auto xpress::objects::utils::pow ( Expression basis,
Expression exp ) -> xpress::objects::BinaryExpression
inline

Create an expression for base ^ exp.

Note that adding the result of pow to your model in any way will turn the model into a non-linear model. In order to square a variable or linear expression, use one of Variable#square(), LinTerm#square(), or LinExpression#square(). They all create linear or quadratic expressions.

Parameters
basis Base.
exp Exponent.
Returns
basis raised to the power of exp.
Since
44.00

prod() [1/2]

template<typename... VALUE, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, VALUE...>::value>::type>
auto xpress::objects::utils::prod ( VALUE... value ) -> xpress::objects::Expression
inline

Create an expression for prod(value, ...).

Parameters
value Expressions to multiply.
Returns
The product of the expression in value.
Since
44.00

prod() [2/2]

auto xpress::objects::utils::prod ( xpress::SizedArray< Expression const > const & value ) -> xpress::objects::Expression
inline

Create an expression for prod(value, ...).

Since
44.00

scalarProduct() [1/3]

template<typename K >
auto xpress::objects::utils::scalarProduct ( std::unordered_map< K, Variable > variables,
std::unordered_map< K, double > coefs ) -> xpress::objects::LinExpression
inline

Compute the scalar product between a map of variables and a map of coefficients.

The function assumes that variables and coefs have the same keys (missing keys in coefs are treated as zero) and creates a linear expression by iterating over the keys in variables and adding up the variable/coefficient pair for each key.

Parameters
variables Map of variables.
coefs Map of coefficients for the variables in variables.
Template Parameters
K Key type.
Returns
The linear expression.
Since
44.00

scalarProduct() [2/3]

template<typename Strm0 , typename Strm1 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Strm1IsStream = typename std::enable_if<xpress::is_stream<Strm1>::value>::type>
auto xpress::objects::utils::scalarProduct ( Strm0 const & variables,
Strm1 const & coefs ) -> xpress::objects::LinExpression
inline

Compute the scalar product between a vector of variables and a vector of coefficients.

Both vectors are specified as streams of elements.

Parameters
variables Variables in the scalar product.
coefs Coefficients in the scalar product.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type xpress::objects::Variable.
Strm1 Something that supports begin() and end() and contains values of type double.
Returns
The sum of the specified terms.
Since
44.00

scalarProduct() [3/3]

template<typename Strm0 , typename Strm1 , typename Strm2 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Strm1IsStream = typename std::enable_if<xpress::is_stream<Strm1>::value>::type, typename Strm2IsStream = typename std::enable_if<xpress::is_stream<Strm2>::value>::type>
auto xpress::objects::utils::scalarProduct ( Strm0 const & variables1,
Strm1 const & variables2,
Strm2 const & coefs ) -> xpress::objects::QuadExpression
inline

Compute the elementwise product between two vectors of variables and a vector of coefficients.

All vectors are specified as streams of elements.

Parameters
variables1 First variables in the product.
variables2 Second variables in the product.
coefs Coefficients in the product.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type Variable.
Strm1 Something that supports begin() and end() and contains values of type Variable.
Strm2 Something that supports begin() and end() and contains values of type double.
Returns
The sum of the specified terms.
Since
44.00

sign()

auto xpress::objects::utils::sign ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for sign(value).

Parameters
value Function argument.
Returns
sign(value).
Since
44.00

sin()

auto xpress::objects::utils::sin ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for sin(value).

Parameters
value Function argument.
Returns
sin(value).
Since
44.00

sqrt()

auto xpress::objects::utils::sqrt ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for sqrt(value).

Parameters
value Function argument.
Returns
sqrt(value).
Since
44.00

sum() [1/4]

template<typename... MORETERMS, typename RestrictPack = typename std::enable_if<xpress::AllConvertible<Expression, MORETERMS...>::value>::type>
auto xpress::objects::utils::sum ( Expression firstTerm,
MORETERMS... moreTerms ) -> xpress::objects::SumExpression
inline

Create an expression from an array of other expressions.

Note that the other expressions are copied by reference, so changing them later will affect the returned expression.

Parameters
firstTerm The first term to sum up.
moreTerms The other terms to sum up.
Returns
The expression.
Since
44.00

sum() [2/4]

template<typename A = Expression, typename Func0 , typename Func0Invocable = typename std::enable_if<std::is_convertible<typename std::invoke_result<Func0,int const &>::type,A>::value>::type>
auto xpress::objects::utils::sum ( int count,
Func0 makeTerm ) -> xpress::objects::SumExpression
inline

Create a sum of expressions.

Note that the terms are captured by reference, i.e., changing those terms later will affect the return sum.

Parameters
count Number of elements in the sum.
makeTerm Function to produce an expression for each data element.
Template Parameters
A Type of expressions that are summed up.
Func0 auto (int const &) -> A: Maps (int const &) to A.
Returns
The sum.
Since
44.00

sum() [3/4]

template<typename Strm0 , typename A = Expression, typename T = typename Strm0::value_type, typename Func0 , typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type, typename Func0Invocable = typename std::enable_if<std::is_convertible<typename std::invoke_result<Func0,T const &>::type,A>::value>::type>
auto xpress::objects::utils::sum ( Strm0 const & data,
Func0 makeTerm ) -> xpress::objects::SumExpression
inline

Create a sum of expressions.

Note that the terms are captured by reference, i.e., changing those terms later will affect the return sum.

Parameters
data Data to iterate.
makeTerm Function to create terms.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type T.
Func0 auto (T const &) -> A: Maps (T const &) to A.
Returns
The expression.
Since
44.00

sum() [4/4]

template<typename Strm0 , typename T = typename Strm0::value_type, typename Strm0IsStream = typename std::enable_if<xpress::is_stream<Strm0>::value>::type>
auto xpress::objects::utils::sum ( Strm0 const & terms ) -> xpress::objects::SumExpression
inline

Create an expression from a stream of other expressions.

Note that the other expressions are copied by reference, so changing them later will affect the returned expression.

Parameters
terms The expression to sum up.
Template Parameters
Strm0 Something that supports begin() and end() and contains values of type T.
T The actual term type.
Returns
The expression.
Since
44.00

tan()

auto xpress::objects::utils::tan ( Expression value ) -> xpress::objects::InternalFunctionExpression
inline

Create an expression for tan(value).

Parameters
value Function argument.
Returns
tan(value).
Since
44.00

uminus()

auto xpress::objects::utils::uminus ( Expression value ) -> xpress::objects::Expression
inline

Create an expression for -value.

Parameters
value The value to negate.
Returns
An expression representing -value.
Since
44.00

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.