Utils
- java.lang.Object
-  
  - com.dashoptimization.objects.Utils
 
-  
   
 public final class Utils extends java.lang.ObjectUtilities for modeling.- Since:
- 43.00
 
-  
    
   -  
         Constructor SummaryConstructor Description Utils()
 -  
         Method SummaryModifier and Type Method Description static InternalFunctionExpressionabs(Expression value)Create an expression forabs(value).static InternalFunctionExpressionarccos(Expression value)Create an expression forarccos(value).static InternalFunctionExpressionarcsin(Expression value)Create an expression forarcsin(value).static InternalFunctionExpressionarctan(Expression value)Create an expression forarctan(value).static InternalFunctionExpressioncos(Expression value)Create an expression forcos(value).static Expressiondiv(double dividend, Expression divisor)Create an expression fordividend + divisor.static Expressiondiv(Expression dividend, double divisor)Create an expression fordividend + divisor.static Expressiondiv(Expression dividend, Expression divisor)Create an expression fordividend / divisor.static InternalFunctionExpressionexp(Expression value)Create an expression forexp(value).static InternalFunctionExpressionln(Expression value)Create an expression forln(value).static InternalFunctionExpressionlog10(Expression value)Create an expression forlog10(value).static InternalFunctionExpressionmax(Expression... value)Create an expression formax(value, ...).static InternalFunctionExpressionmin(Expression... value)Create an expression formin(value, ...).static Expressionminus(double minuend, Expression subtrahend)Create an expression forminuend + subtrahend.static Expressionminus(Expression minuend, double subtrahend)Create an expression forminuend + subtrahend.static Expressionminus(Expression minuend, Expression subtrahend)Create an expression forminuend - subtrahend.static Expressionmul(double factor1, Expression factor2)Create an expression forfactor1 + factor2.static Expressionmul(Expression factor1, double factor2)Create an expression forfactor1 + factor2.static Expressionmul(Expression factor1, Expression factor2)Create an expression forfactor1 * factor2.static Expressionplus(double augend, Expression addend)Create an expression foraugend + addend.static Expressionplus(Expression augend, double addend)Create an expression foraugend + addend.static Expressionplus(Expression augend, Expression addend)Create an expression foraugend + addend.static BinaryExpressionpow(double basis, Expression exp)Create an expression forbase ^ exp.static BinaryExpressionpow(Expression basis, double exp)Create an expression forbase ^ exp.static BinaryExpressionpow(Expression basis, Expression exp)Create an expression forbase ^ exp.static Expressionprod(Expression... value)Create an expression forprod(value, ...).static LinExpressionscalarProduct(Variable[] variables, double[] coefs)Compute the scalar product between a vector of variables and a vector of coefficients.static QuadExpressionscalarProduct(Variable[] variables1, Variable[] variables2, double[] coefs)Compute the elementwise product between two vectors of variables and a vector of coefficients.static QuadExpressionscalarProduct(java.lang.Iterable<Variable> variables1, java.lang.Iterable<Variable> variables2, java.lang.Iterable<java.lang.Double> coefs)Compute the elementwise product between two vectors of variables and a vector of coefficients.static LinExpressionscalarProduct(java.lang.Iterable<Variable> variables, java.lang.Iterable<java.lang.Double> coefs)Compute the scalar product between a vector of variables and a vector of coefficients.static <K> LinExpressionscalarProduct(java.util.Map<K,Variable> variables, java.util.Map<K,java.lang.Double> coefs)Compute the scalar product between a map of variables and a map of coefficients.static QuadExpressionscalarProduct(java.util.stream.Stream<Variable> variables1, java.util.stream.Stream<Variable> variables2, java.util.stream.Stream<java.lang.Double> coefs)Compute the elementwise product between two vectors of variables and a vector of coefficients.static LinExpressionscalarProduct(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> coefs)Compute the scalar product between a vector of variables and a vector of coefficients.static InternalFunctionExpressionsign(Expression value)Create an expression forsign(value).static InternalFunctionExpressionsin(Expression value)Create an expression forsin(value).static InternalFunctionExpressionsqrt(Expression value)Create an expression forsqrt(value).static <T,A extends Expression>
 SumExpressionsum(int[] data, java.util.function.IntFunction<A> makeTerm)Create a sum of expressions.static <A extends Expression>
 SumExpressionsum(int count, java.util.function.Function<java.lang.Integer,A> makeTerm)Create a sum of expressions.static SumExpressionsum(Expression firstTerm, Expression... moreTerms)Create a expression from an array of other expressions.static <T extends Expression>
 SumExpressionsum(java.lang.Iterable<T> terms)Create an expression from a collection of other expressions.static <T,A extends Expression>
 SumExpressionsum(java.lang.Iterable<T> data, java.util.function.Function<? super T,A> makeTerm)Create a sum of expressions.static <T,A extends Expression>
 SumExpressionsum(java.util.stream.IntStream data, java.util.function.IntFunction<A> makeTerm)Create a sum of expressions.static <T extends Expression>
 SumExpressionsum(java.util.stream.Stream<T> terms)Create an expression from a stream of other expressions.static <T,A extends Expression>
 SumExpressionsum(java.util.stream.Stream<T> data, java.util.function.Function<? super T,A> makeTerm)Create a sum of expressions.static <T extends Expression>
 SumExpressionsum(T[] terms)Create a sum of expressions.static <T,A extends Expression>
 SumExpressionsum(T[] data, java.util.function.Function<? super T,A> makeTerm)Create a sum of expressions.static InternalFunctionExpressiontan(Expression value)Create an expression fortan(value).static Expressionuminus(Expression value)Create an expression for-value.
 
-  
         
-  
    
   -  
         Method Detail-  sumpublic static <A extends Expression> SumExpression sum(int count, java.util.function.Function<java.lang.Integer,A> makeTerm) 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.
- Returns:
- The sum.
- Since:
- 43.00
 
 -  sumpublic static <T,A extends Expression> SumExpression sum(java.util.stream.Stream<T> data, java.util.function.Function<? super T,A> makeTerm) 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.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T,A extends Expression> SumExpression sum(java.lang.Iterable<T> data, java.util.function.Function<? super T,A> makeTerm) 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- The data from which to build the sum.
- 
          makeTerm- Function to produce an expression for each data element.
- Returns:
- The sum.
- Since:
- 43.00
 
 -  sumpublic static <T,A extends Expression> SumExpression sum(T[] data, java.util.function.Function<? super T,A> makeTerm) Create a sum of expressions. Note that the terms are captured by reference, i.e., changing those terms later will affect the returned sum.- Parameters:
- 
          data- Data to iterate.
- 
          makeTerm- Function to create terms.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T,A extends Expression> SumExpression sum(int[] data, java.util.function.IntFunction<A> makeTerm) Create a sum of expressions. Note that the terms are captured by reference, i.e., changing those terms later will affect the returned sum.- Parameters:
- 
          data- Data to iterate.
- 
          makeTerm- Function to create terms.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T,A extends Expression> SumExpression sum(java.util.stream.IntStream data, java.util.function.IntFunction<A> makeTerm) Create a sum of expressions. Note that the terms are captured by reference, i.e., changing those terms later will affect the returned sum.- Parameters:
- 
          data- Data to iterate.
- 
          makeTerm- Function to create terms.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T extends Expression> SumExpression sum(java.util.stream.Stream<T> terms) 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.- Type Parameters:
- 
          T- The actual term type.
- Parameters:
- 
          terms- The expression to sum up.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T extends Expression> SumExpression sum(java.lang.Iterable<T> terms) Create an expression from a collection of other expressions. Note that the other expressions are copied by reference, so changing them later will affect the returned expression.- Type Parameters:
- 
          T- The actual term type.
- Parameters:
- 
          terms- The expression to sum up.
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static <T extends Expression> SumExpression sum(T[] terms) 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:
- 
          terms- Terms to sum up
- Returns:
- The new expression.
- Since:
- 43.00
 
 -  sumpublic static SumExpression sum(Expression firstTerm, Expression... moreTerms) Create a 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 new expression.
- Since:
- 43.00
 
 -  uminuspublic static Expression uminus(Expression value) Create an expression for-value.- Since:
- 43.00
 
 -  pluspublic static Expression plus(Expression augend, Expression addend) Create an expression foraugend + addend. This is equivalent toaugend.plus(addend)and is only provided for completeness.- Parameters:
- 
          augend- augend.
- 
          addend- addend.
- Returns:
- sum of augend and addend.
- Since:
- 43.00
 
 -  pluspublic static Expression plus(double augend, Expression addend) Create an expression foraugend + addend. This is equivalent tonew ConstantExpression(augend).plus(addend)and is only provided for completeness.- Parameters:
- 
          augend- augend.
- 
          addend- addend.
- Returns:
- sum of augend and addend.
- Since:
- 43.00
 
 -  pluspublic static Expression plus(Expression augend, double addend) Create an expression foraugend + addend. This is equivalent toaugend.plus(addend)and is only provided for completeness.- Parameters:
- 
          augend- augend.
- 
          addend- addend.
- Returns:
- sum of augend and addend.
- Since:
- 43.00
 
 -  minuspublic static Expression minus(Expression minuend, Expression subtrahend) Create an expression forminuend - subtrahend. This is equivalent tominuend.minus(subtrahend)and is only provided for completeness.- Parameters:
- 
          minuend- minuend.
- 
          subtrahend- subtrahend.
- Returns:
- difference of minuend and subtrahend.
- Since:
- 43.00
 
 -  minuspublic static Expression minus(double minuend, Expression subtrahend) Create an expression forminuend + subtrahend. This is equivalent tonew ConstantExpression(minuend).minus(subtrahend)and is only provided for completeness.- Parameters:
- 
          minuend- minuend.
- 
          subtrahend- subtrahend.
- Returns:
- difference of minuend and subtrahend.
- Since:
- 43.00
 
 -  minuspublic static Expression minus(Expression minuend, double subtrahend) Create an expression forminuend + subtrahend. This is equivalent tominuend.minus(subtrahend)and is only provided for completeness.- Parameters:
- 
          minuend- minuend.
- 
          subtrahend- subtrahend.
- Returns:
- difference of minuend and subtrahend.
- Since:
- 43.00
 
 -  divpublic static Expression div(Expression dividend, Expression divisor) Create an expression fordividend / divisor. This is equivalent todividend.div(divisor)and is only provided for completeness.- Parameters:
- 
          dividend- dividend.
- 
          divisor- divisor.
- Returns:
- quotient of dividend and divisor.
- Since:
- 43.00
 
 -  divpublic static Expression div(double dividend, Expression divisor) Create an expression fordividend + divisor. This is equivalent tonew ConstantExpression(dividend).div(divisor)and is only provided for completeness.- Parameters:
- 
          dividend- dividend.
- 
          divisor- divisor.
- Returns:
- quotient of dividend and divisor.
- Since:
- 43.00
 
 -  divpublic static Expression div(Expression dividend, double divisor) Create an expression fordividend + divisor. This is equivalent todividend.div(divisor)and is only provided for completeness.- Parameters:
- 
          dividend- dividend.
- 
          divisor- divisor.
- Returns:
- quotient of dividend and divisor.
- Since:
- 43.00
 
 -  mulpublic static Expression mul(Expression factor1, Expression factor2) Create an expression forfactor1 * factor2. This is equivalent tofactor1.mul(factor2)and is only provided for completeness.- Parameters:
- 
          factor1- factor1.
- 
          factor2- factor2.
- Returns:
- product of factor1 and factor2.
- Since:
- 43.00
 
 -  mulpublic static Expression mul(double factor1, Expression factor2) Create an expression forfactor1 + factor2. This is equivalent tonew ConstantExpression(factor1).mul(factor2)and is only provided for completeness.- Parameters:
- 
          factor1- factor1.
- 
          factor2- factor2.
- Returns:
- product of factor1 and factor2.
- Since:
- 43.00
 
 -  mulpublic static Expression mul(Expression factor1, double factor2) Create an expression forfactor1 + factor2. This is equivalent tofactor1.mul(factor2)and is only provided for completeness.- Parameters:
- 
          factor1- factor1.
- 
          factor2- factor2.
- Returns:
- product of factor1 and factor2.
- Since:
- 43.00
 
 -  powpublic static BinaryExpression pow(Expression basis, Expression exp) Create an expression forbase ^ exp. Note that adding the result ofpowto 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 ofVariable.square(),LinTerm.square(), orLinExpression.square(). They all create linear or quadratic expressions.- Parameters:
- 
          basis- Base.
- 
          exp- Exponent.
- Returns:
- 
          basisraised to the power ofexp.
- Since:
- 43.00
 
 -  powpublic static BinaryExpression pow(double basis, Expression exp) Create an expression forbase ^ exp. Note that adding the result ofpowto 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 ofVariable.square(),LinTerm.square(), orLinExpression.square(). They all create linear or quadratic expressions.- Parameters:
- 
          basis- Base.
- 
          exp- Exponent.
- Returns:
- 
          basisraised to the power ofexp.
- Since:
- 43.00
 
 -  powpublic static BinaryExpression pow(Expression basis, double exp) Create an expression forbase ^ exp. Note that adding the result ofpowto 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 ofVariable.square(),LinTerm.square(), orLinExpression.square(). They all create linear or quadratic expressions.- Parameters:
- 
          basis- Base.
- 
          exp- Exponent.
- Returns:
- 
          basisraised to the power ofexp.
- Since:
- 43.00
 
 -  log10public static InternalFunctionExpression log10(Expression value) Create an expression forlog10(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          log10(value).
- Since:
- 43.00
 
 -  lnpublic static InternalFunctionExpression ln(Expression value) Create an expression forln(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          ln(value).
- Since:
- 43.00
 
 -  exppublic static InternalFunctionExpression exp(Expression value) Create an expression forexp(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          exp(value).
- Since:
- 43.00
 
 -  abspublic static InternalFunctionExpression abs(Expression value) Create an expression forabs(value).Used in these examples: - AddMipSol
- FixBV
- GlobalObjectiveParametrics
- GlobalRHSParametrics
- GoalProg
- Knapsack
- LoadLP
- MipSolEnum
- MipSolPool
- MostViolated
- Repair
- SaveSol
- Tableau
- Trimloss
 - Parameters:
- 
          value- Function argument.
- Returns:
- 
          abs(value).
- Since:
- 43.00
 
 -  sqrtpublic static InternalFunctionExpression sqrt(Expression value) Create an expression forsqrt(value).Used in these examples: - TSP
 - Parameters:
- 
          value- Function argument.
- Returns:
- 
          sqrt(value).
- Since:
- 43.00
 
 -  sinpublic static InternalFunctionExpression sin(Expression value) Create an expression forsin(value).Used in these examples: - PolygonMap
- PolygonMapDelta
- PolygonMultiMap
- PolygonMultiMapDelta
- PolygonVecMap
- PolygonVecMapDelta
 - Parameters:
- 
          value- Function argument.
- Returns:
- 
          sin(value).
- Since:
- 43.00
 
 -  cospublic static InternalFunctionExpression cos(Expression value) Create an expression forcos(value).Used in these examples: - PolygonMap
- PolygonMapDelta
- PolygonMultiMap
- PolygonMultiMapDelta
- PolygonVecMap
- PolygonVecMapDelta
 - Parameters:
- 
          value- Function argument.
- Returns:
- 
          cos(value).
- Since:
- 43.00
 
 -  tanpublic static InternalFunctionExpression tan(Expression value) Create an expression fortan(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          tan(value).
- Since:
- 43.00
 
 -  arcsinpublic static InternalFunctionExpression arcsin(Expression value) Create an expression forarcsin(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          arcsin(value).
- Since:
- 43.00
 
 -  arccospublic static InternalFunctionExpression arccos(Expression value) Create an expression forarccos(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          arccos(value).
- Since:
- 43.00
 
 -  arctanpublic static InternalFunctionExpression arctan(Expression value) Create an expression forarctan(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          arctan(value).
- Since:
- 43.00
 
 -  signpublic static InternalFunctionExpression sign(Expression value) Create an expression forsign(value).- Parameters:
- 
          value- Function argument.
- Returns:
- 
          sign(value).
- Since:
- 43.00
 
 -  minpublic static InternalFunctionExpression min(Expression... value) Create an expression formin(value, ...). Consider also usingVariable.minOf(...).Used in these examples: - MostViolated
 - Parameters:
- 
          value- Arguments-
- Returns:
- 
          min(value...).
- Since:
- 43.00
 
 -  maxpublic static InternalFunctionExpression max(Expression... value) Create an expression formax(value, ...). Consider also usingVariable.maxOf.- Parameters:
- 
          value- Arguments.
- Returns:
- 
          max(value...).
- Since:
- 43.00
 
 -  prodpublic static Expression prod(Expression... value) Create an expression forprod(value, ...).- Since:
- 43.00
 
 -  scalarProductpublic static LinExpression scalarProduct(java.util.stream.Stream<Variable> variables, java.util.stream.Stream<java.lang.Double> coefs) 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.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 -  scalarProductpublic static LinExpression scalarProduct(Variable[] variables, double[] coefs) Compute the scalar product between a vector of variables and a vector of coefficients. Both vectors are specified as arrays.- Parameters:
- 
          variables- Variables in the scalar product.
- 
          coefs- Coefficients in the scalar product.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 -  scalarProductpublic static LinExpression scalarProduct(java.lang.Iterable<Variable> variables, java.lang.Iterable<java.lang.Double> coefs) Compute the scalar product between a vector of variables and a vector of coefficients. Both vectors are specified as iterables of elements.- Parameters:
- 
          variables- Variables in the scalar product.
- 
          coefs- Coefficients in the scalar product.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 -  scalarProductpublic static <K> LinExpression scalarProduct(java.util.Map<K,Variable> variables, java.util.Map<K,java.lang.Double> coefs) Compute the scalar product between a map of variables and a map of coefficients. The function assumes thatvariablesandcoefshave the same keys (missing keys incoefsare treated as zero) and creates a new linear expression by iterating over the keys invariablesand adding up the variable/coefficient pair for each key.- Parameters:
- 
          variables- Map of variables.
- 
          coefs- Map of coefficients for the variables invariables.
- Returns:
- The new linear expression.
- Since:
- 43.00
 
 -  scalarProductpublic static QuadExpression scalarProduct(java.util.stream.Stream<Variable> variables1, java.util.stream.Stream<Variable> variables2, java.util.stream.Stream<java.lang.Double> coefs) 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.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 -  scalarProductpublic static QuadExpression scalarProduct(Variable[] variables1, Variable[] variables2, double[] coefs) Compute the elementwise product between two vectors of variables and a vector of coefficients. All vectors are specified as arrays.- Parameters:
- 
          variables1- First variables in the product.
- 
          variables2- Second variables in the product.
- 
          coefs- Coefficients in the product.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 -  scalarProductpublic static QuadExpression scalarProduct(java.lang.Iterable<Variable> variables1, java.lang.Iterable<Variable> variables2, java.lang.Iterable<java.lang.Double> coefs) Compute the elementwise product between two vectors of variables and a vector of coefficients. All vectors are specified as collection of elements.- Parameters:
- 
          variables1- First variables in the product.
- 
          variables2- Second variables in the product.
- 
          coefs- Coefficients in the product.
- Returns:
- The sum of the specified terms.
- Since:
- 43.00
 
 
-  
 
-  
         
© 2001-2024 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.
 
