- java.lang.Object
-
- org.chocosolver.util.tools.VariableUtils
-
public class VariableUtils extends Object
Project: choco-solver.
- Since:
- 28/04/2016.
- Author:
- Charles Prud'homme
-
-
Constructor Summary
Constructors Constructor Description VariableUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int[]
boundsForAddition(IntVar... vars)
static double[]
boundsForAddition(RealVar... vars)
static double[]
boundsForAtan2(RealVar x, RealVar y)
static int[]
boundsForDivision(IntVar x, IntVar y)
static double[]
boundsForDivision(RealVar x, RealVar y)
static int[]
boundsForMaximum(IntVar... vars)
static double[]
boundsForMaximum(RealVar... vars)
static int[]
boundsForMinimum(IntVar... vars)
static double[]
boundsForMinimum(RealVar... vars)
static int[]
boundsForModulo(IntVar x, IntVar y)
static int[]
boundsForMultiplication(IntVar x, IntVar y)
static double[]
boundsForMultiplication(RealVar x, RealVar y)
static int[]
boundsForPow(IntVar x, IntVar y)
static double[]
boundsForPow(RealVar x, RealVar y)
static int[]
boundsForScalar(IntVar[] vars, int[] coeffs)
static int[]
boundsForSubstraction(IntVar x, IntVar y)
static double[]
boundsForSubstraction(RealVar x, RealVar y)
static long
domainCardinality(IntVar... vars)
static boolean
intersect(IntVar x, IntVar y)
static boolean
isConstant(Variable var)
static boolean
isReal(Variable var)
static boolean
isView(Variable var)
static double
searchSpaceSize(IntVar[] vars)
Compute the search space sizestatic IntVar[]
toIntVar(Model model, int... values)
Transform an array of int to an array of fixed IntVar
-
-
-
Method Detail
-
boundsForAddition
public static int[] boundsForAddition(IntVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the sum of vars
-
boundsForScalar
public static int[] boundsForScalar(IntVar[] vars, int[] coeffs)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the sum of vars
-
boundsForAddition
public static double[] boundsForAddition(RealVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the sum of vars
-
boundsForSubstraction
public static int[] boundsForSubstraction(IntVar x, IntVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x - y"
-
boundsForSubstraction
public static double[] boundsForSubstraction(RealVar x, RealVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x - y"
-
boundsForMultiplication
public static int[] boundsForMultiplication(IntVar x, IntVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x * y"
-
boundsForMultiplication
public static double[] boundsForMultiplication(RealVar x, RealVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x * y"
-
boundsForDivision
public static int[] boundsForDivision(IntVar x, IntVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x / y"
-
boundsForDivision
public static double[] boundsForDivision(RealVar x, RealVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x / y"
-
boundsForModulo
public static int[] boundsForModulo(IntVar x, IntVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x % y"
-
boundsForPow
public static int[] boundsForPow(IntVar x, IntVar y)
- Parameters:
x
- a variabley
- a variable (we consider that lb(y) >= 0- Returns:
- computes the bounds for "x ^ y"
-
boundsForPow
public static double[] boundsForPow(RealVar x, RealVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "x ^ y"
-
boundsForAtan2
public static double[] boundsForAtan2(RealVar x, RealVar y)
- Parameters:
x
- a variabley
- a variable- Returns:
- computes the bounds for "atan2(x , y)"
-
boundsForMinimum
public static int[] boundsForMinimum(IntVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the minimum among vars
-
boundsForMinimum
public static double[] boundsForMinimum(RealVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the minimum among vars
-
boundsForMaximum
public static int[] boundsForMaximum(IntVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the maximum among vars
-
boundsForMaximum
public static double[] boundsForMaximum(RealVar... vars)
- Parameters:
vars
- array of variables- Returns:
- computes the bounds for the maximum among vars
-
domainCardinality
public static long domainCardinality(IntVar... vars)
- Parameters:
vars
- an array of variables- Returns:
- the variables' domain cardinality or
Integer.MAX_VALUE
if too large.
-
searchSpaceSize
public static double searchSpaceSize(IntVar[] vars)
Compute the search space size- Returns:
- search space size
-
intersect
public static boolean intersect(IntVar x, IntVar y)
- Parameters:
x
- an int variabley
- another int variable- Returns:
- true if the two domains intersect
-
toIntVar
public static IntVar[] toIntVar(Model model, int... values)
Transform an array of int to an array of fixed IntVar- Parameters:
values
- array of intsmodel
- model to create IntVar- Returns:
-
isConstant
public static boolean isConstant(Variable var)
- Parameters:
var
- a variable- Returns:
- true if the variable is a constant, based on its type, false otherwise
-
isView
public static boolean isView(Variable var)
- Parameters:
var
- a variable- Returns:
- true if the variable is a view, based on its type, false otherwise
-
isReal
public static boolean isReal(Variable var)
- Parameters:
var
- a variable- Returns:
- true if the variable is a real variable, based on its kind, false otherwise
-
-