Interface IVariableFactory

  • All Superinterfaces:
    ISelf<Model>
    All Known Subinterfaces:
    IModel
    All Known Implementing Classes:
    Model

    public interface IVariableFactory
    extends ISelf<Model>
    Interface to make variables (BoolVar, IntVar, RealVar and SetVar) A kind of factory relying on interface default implementation to allow (multiple) inheritance
    Since:
    4.0.0
    Author:
    Jean-Guillaume FAGES, Charles Prud'homme
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String CSTE_NAME
      Default prefix for constants
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default BoolVar boolVar()
      Create a boolean variable, i.e. a particular integer variable of domain {0, 1}
      default BoolVar boolVar​(boolean value)
      Create a constant boolean variable equal to 1 if value is true and 0 otherwise
      default BoolVar boolVar​(String name)
      Create a boolean variable
      default BoolVar boolVar​(String name, boolean value)
      Create a constant boolean variable equal to 1 if value is true and 0 otherwise
      default BoolVar[] boolVarArray​(int size)
      Create an array of size boolean variables
      default BoolVar[] boolVarArray​(String name, int size)
      Create an array of size boolean variables
      default BoolVar[][] boolVarMatrix​(int dim1, int dim2)
      Create a dim1*dim2-sized matrix of boolean variables
      default BoolVar[][] boolVarMatrix​(String name, int dim1, int dim2)
      Create a dim1*dim2-sized matrix of boolean variables
      default void checkIntDomainRange​(String NAME, int MIN, int MAX)
      Checks domain range.
      default void checkRealDomainRange​(String NAME, double MIN, double MAX)
      Checks domain range.
      default String generateName()
      Return a generated short string, prefixed with Settings.defaultPrefix() and followed with a single-use number.
      default String generateName​(String prefix)
      Return a generated short string prefixed with prefix and followed with a single-use number.
      default IntVar intVar​(int value)
      Create a constant integer variable equal to value
      default IntVar intVar​(int[] values)
      Create an integer variable of initial domain values.
      default IntVar intVar​(int lb, int ub)
      Create an integer variable of initial domain [lb, ub] Uses an enumerated domain if ub-lb is small, and a bounded domain otherwise
      default IntVar intVar​(int lb, int ub, boolean boundedDomain)
      Create an integer variable of initial domain [lb, ub]
      default IntVar intVar​(String name, int value)
      Create a constant integer variable equal to value
      default IntVar intVar​(String name, int[] values)
      Create an integer variable of initial domain values Uses an enumerated domain that supports holes
      default IntVar intVar​(String name, int lb, int ub)
      Create an integer variable of initial domain [lb, ub] Uses an enumerated domain if ub-lb is small, and a bounded domain otherwise
      default IntVar intVar​(String name, int lb, int ub, boolean boundedDomain)
      Create an integer variable of initial domain [lb, ub]
      default IntVar[] intVarArray​(int size, int[] values)
      Creates an array of size integer variables, taking their domain in values
      default IntVar[] intVarArray​(int size, int lb, int ub)
      Creates an array of size integer variables, taking their domain in [lb, ub]
      default IntVar[] intVarArray​(int size, int lb, int ub, boolean boundedDomain)
      Creates an array of size integer variables, taking their domain in [lb, ub]
      default IntVar[] intVarArray​(String name, int size, int[] values)
      Creates an array of size integer variables, taking their domain in values
      default IntVar[] intVarArray​(String name, int size, int lb, int ub)
      Creates an array of size integer variables, taking their domain in [lb, ub]
      default IntVar[] intVarArray​(String name, int size, int lb, int ub, boolean boundedDomain)
      Creates an array of size integer variables, taking their domain in [lb, ub]
      default IntVar[][] intVarMatrix​(int dim1, int dim2, int[] values)
      Creates a matrix of dim1*dim2 integer variables taking their domain in values
      default IntVar[][] intVarMatrix​(int dim1, int dim2, int lb, int ub)
      Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
      default IntVar[][] intVarMatrix​(int dim1, int dim2, int lb, int ub, boolean boundedDomain)
      Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
      default IntVar[][] intVarMatrix​(String name, int dim1, int dim2, int[] values)
      Creates a matrix of dim1*dim2 integer variables taking their domain in values
      default IntVar[][] intVarMatrix​(String name, int dim1, int dim2, int lb, int ub)
      Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
      default IntVar[][] intVarMatrix​(String name, int dim1, int dim2, int lb, int ub, boolean boundedDomain)
      Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
      default RealVar realVar​(double value)
      Create a constant real variable equal to value
      default RealVar realVar​(double value, double precision)
      Creates a constant real variable equal to value
      default RealVar realVar​(double lb, double ub, double precision)
      Creates a real variable, taking its domain in [lb, ub]
      default RealVar realVar​(String name, double value)
      Create a constant real variable equal to value
      default RealVar realVar​(String name, double lb, double ub, double precision)
      Creates a real variable, taking its domain in [lb, ub]
      default RealVar[] realVarArray​(int size, double lb, double ub, double precision)
      Creates an array of size real variables, each of domain [lb, ub]
      default RealVar[] realVarArray​(String name, int size, double lb, double ub, double precision)
      Creates an array of size real variables, each of domain [lb, ub]
      default RealVar[][] realVarMatrix​(int dim1, int dim2, double lb, double ub, double precision)
      Creates a matrix of dim1*dim2 real variables, each of domain [lb, ub]
      default RealVar[][] realVarMatrix​(String name, int dim1, int dim2, double lb, double ub, double precision)
      Creates a matrix of dim1*dim2 real variables, each of domain [lb, ub]
      default SetVar setVar​(int... value)
      Creates a constant set variable, equal to value
      default SetVar setVar​(int[] lb, int[] ub)
      Creates a set variable taking its domain in [lb, ub], For instance [{0,3},{-2,0,2,3}] means the variable must include both 0 and 3 and can additionnaly include -2, and 2
      default SetVar setVar​(String name, int... value)
      Creates a constant set variable, equal to value
      default SetVar setVar​(String name, int[] lb, int[] ub)
      Creates a set variable taking its domain in [lb, ub], For instance [{0,3},{-2,0,2,3}] means the variable must include both 0 and 3 and can additionnaly include -2, and 2
      default SetVar[] setVarArray​(int size, int[] lb, int[] ub)
      Creates an array of size set variables, taking their domain in [lb, ub]
      default SetVar[] setVarArray​(String name, int size, int[] lb, int[] ub)
      Creates an array of size set variables, taking their domain in [lb, ub]
      default SetVar[][] setVarMatrix​(int dim1, int dim2, int[] lb, int[] ub)
      Creates a matrix of dim1*dim2 set variables, taking their domain in [lb, ub]
      default SetVar[][] setVarMatrix​(String name, int dim1, int dim2, int[] lb, int[] ub)
      Creates a matrix of dim1*dim2 set variables, taking their domain in [lb, ub]
      default Task taskVar​(IntVar s, int p)
      Creates a task variable, based on a starting time s and a processing time p such that: s + p = e, where e is the ending time.
      default Task taskVar​(IntVar s, IntVar p)
      Creates a task variable, based on a starting time s and a processing time p such that: s + p = e, where e is the ending time.
      default Task taskVar​(IntVar s, IntVar p, IntVar e)
      Creates a task variable, made of a starting time s, a processing time p and an ending time e such that: s + p = e.
      default Task[] taskVarArray​(IntVar[] s, IntVar[] p, IntVar[] e)
      Creates an array of s.length task variables, where task i is made of a starting time s_i, a processing time p_i and an ending time e_i such that: s_i + p_i = e_i.
      default Task[][] taskVarMatrix​(IntVar[][] s, IntVar[][] p, IntVar[][] e)
      Creates a matrix of s.length * s_0.length task variables, where task i,j is made of a starting time s_(i,j), a processing time p_(i,j) and an ending time e_(i,j) such that: s_(i,j) + p_(i,j) = e_(i,j).
      default BoolVar[] toBoolVar​(IntVar... ivars)
      Converts ivars into an array of boolean variables
      • Methods inherited from interface org.chocosolver.solver.ISelf

        ref
    • Method Detail

      • boolVar

        default BoolVar boolVar​(boolean value)
        Create a constant boolean variable equal to 1 if value is true and 0 otherwise
        Parameters:
        value - constant value of the boolean variable (true or false)
        Returns:
        a constant of type BoolVar
      • boolVar

        default BoolVar boolVar​(String name,
                                boolean value)
        Create a constant boolean variable equal to 1 if value is true and 0 otherwise
        Parameters:
        name - name of the variable
        value - constant value of the boolean variable (true or false)
        Returns:
        a constant of type BoolVar
      • boolVar

        default BoolVar boolVar()
        Create a boolean variable, i.e. a particular integer variable of domain {0, 1}
        Returns:
        a BoolVar of domain {0, 1}
      • boolVar

        default BoolVar boolVar​(String name)
        Create a boolean variable
        Parameters:
        name - name of the variable
        Returns:
        a BoolVar of domain {0, 1}
      • boolVarArray

        default BoolVar[] boolVarArray​(int size)
        Create an array of size boolean variables
        Parameters:
        size - number of variable to create
        Returns:
        an array of size BoolVar of domain {0, 1}
      • boolVarArray

        default BoolVar[] boolVarArray​(String name,
                                       int size)
        Create an array of size boolean variables
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variable to create
        Returns:
        an array of size BoolVar of domain {0, 1}
      • boolVarMatrix

        default BoolVar[][] boolVarMatrix​(int dim1,
                                          int dim2)
        Create a dim1*dim2-sized matrix of boolean variables
        Parameters:
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        Returns:
        a matrix of dim1*dim2 BoolVar of domain {0, 1}
      • boolVarMatrix

        default BoolVar[][] boolVarMatrix​(String name,
                                          int dim1,
                                          int dim2)
        Create a dim1*dim2-sized matrix of boolean variables
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        Returns:
        a matrix of dim1*dim2 BoolVar of domain {0, 1}
      • intVar

        default IntVar intVar​(int value)
        Create a constant integer variable equal to value
        Parameters:
        value - constant value of the variable
        Returns:
        a constant IntVar of domain {value}
      • intVar

        default IntVar intVar​(int[] values)
        Create an integer variable of initial domain values. Uses an enumerated domain that supports holes
        Parameters:
        values - initial domain of the variable
        Returns:
        an IntVar of domain values
      • intVar

        default IntVar intVar​(int lb,
                              int ub)
        Create an integer variable of initial domain [lb, ub] Uses an enumerated domain if ub-lb is small, and a bounded domain otherwise
        Parameters:
        lb - initial domain lower bound
        ub - initial domain upper bound
        Returns:
        an IntVar of domain [lb, ub]
      • intVar

        default IntVar intVar​(int lb,
                              int ub,
                              boolean boundedDomain)
        Create an integer variable of initial domain [lb, ub]
        Parameters:
        lb - initial domain lower bound
        ub - initial domain upper bound
        boundedDomain - specifies whether to use a bounded domain or an enumerated domain
        Returns:
        an IntVar of domain [lb, ub]
      • intVar

        default IntVar intVar​(String name,
                              int value)
        Create a constant integer variable equal to value
        Parameters:
        name - name of the variable
        value - value of the variable
        Returns:
        a constant IntVar of domain {value}
      • intVar

        default IntVar intVar​(String name,
                              int lb,
                              int ub,
                              boolean boundedDomain)
        Create an integer variable of initial domain [lb, ub]
        Parameters:
        name - name of the variable
        lb - initial domain lower bound
        ub - initial domain upper bound
        boundedDomain - specifies whether to use a bounded domain or an enumerated domain
        Returns:
        an IntVar of domain [lb, ub]
      • intVar

        default IntVar intVar​(String name,
                              int lb,
                              int ub)
        Create an integer variable of initial domain [lb, ub] Uses an enumerated domain if ub-lb is small, and a bounded domain otherwise
        Parameters:
        name - name of the variable
        lb - initial domain lower bound
        ub - initial domain upper bound
        Returns:
        an IntVar of domain [lb, ub]
      • intVar

        default IntVar intVar​(String name,
                              int[] values)
        Create an integer variable of initial domain values Uses an enumerated domain that supports holes
        Parameters:
        name - name of the variable
        values - initial domain
        Returns:
        an IntVar of domain values
      • intVarArray

        default IntVar[] intVarArray​(int size,
                                     int[] values)
        Creates an array of size integer variables, taking their domain in values
        Parameters:
        size - number of variables
        values - initial domain of each variable
        Returns:
        an array of size IntVar of domain values
      • intVarArray

        default IntVar[] intVarArray​(int size,
                                     int lb,
                                     int ub)
        Creates an array of size integer variables, taking their domain in [lb, ub]
        Parameters:
        size - number of variables
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        Returns:
        an array of size IntVar of domain [lb, ub]
      • intVarArray

        default IntVar[] intVarArray​(int size,
                                     int lb,
                                     int ub,
                                     boolean boundedDomain)
        Creates an array of size integer variables, taking their domain in [lb, ub]
        Parameters:
        size - number of variables
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        boundedDomain - specifies whether to use bounded domains or enumerated domains for each variable
        Returns:
        an array of size IntVar of domain [lb, ub]
      • intVarArray

        default IntVar[] intVarArray​(String name,
                                     int size,
                                     int lb,
                                     int ub,
                                     boolean boundedDomain)
        Creates an array of size integer variables, taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variables
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        boundedDomain - specifies whether to use bounded domains or enumerated domains for each variable
        Returns:
        an array of size IntVar of domain [lb, ub]
      • intVarArray

        default IntVar[] intVarArray​(String name,
                                     int size,
                                     int lb,
                                     int ub)
        Creates an array of size integer variables, taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variables
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        Returns:
        an array of size IntVar of domain [lb, ub]
      • intVarArray

        default IntVar[] intVarArray​(String name,
                                     int size,
                                     int[] values)
        Creates an array of size integer variables, taking their domain in values
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variables
        values - initial domain of each variable
        Returns:
        an array of size IntVar of domain values
      • intVarMatrix

        default IntVar[][] intVarMatrix​(int dim1,
                                        int dim2,
                                        int[] values)
        Creates a matrix of dim1*dim2 integer variables taking their domain in values
        Parameters:
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        values - initial domain of each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain values
      • intVarMatrix

        default IntVar[][] intVarMatrix​(int dim1,
                                        int dim2,
                                        int lb,
                                        int ub)
        Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
        Parameters:
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain [lb, ub]
      • intVarMatrix

        default IntVar[][] intVarMatrix​(int dim1,
                                        int dim2,
                                        int lb,
                                        int ub,
                                        boolean boundedDomain)
        Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
        Parameters:
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        boundedDomain - specifies whether to use bounded domains or enumerated domains for each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain [lb, ub]
      • intVarMatrix

        default IntVar[][] intVarMatrix​(String name,
                                        int dim1,
                                        int dim2,
                                        int lb,
                                        int ub,
                                        boolean boundedDomain)
        Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        boundedDomain - specifies whether to use bounded domains or enumerated domains for each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain [lb, ub]
      • intVarMatrix

        default IntVar[][] intVarMatrix​(String name,
                                        int dim1,
                                        int dim2,
                                        int lb,
                                        int ub)
        Creates a matrix of dim1*dim2 integer variables taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of each variable
        ub - initial domain upper bound of each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain [lb, ub]
      • intVarMatrix

        default IntVar[][] intVarMatrix​(String name,
                                        int dim1,
                                        int dim2,
                                        int[] values)
        Creates a matrix of dim1*dim2 integer variables taking their domain in values
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        values - initial domain of each variable
        Returns:
        a matrix of dim1*dim2 IntVar of domain values
      • taskVar

        default Task taskVar​(IntVar s,
                             int p)
        Creates a task variable, based on a starting time s and a processing time p such that: s + p = e, where e is the ending time. A call to Task.ensureBoundConsistency() is required before launching the resolution, this will not be done automatically.
        Parameters:
        s - integer variable, starting time
        p - fixed processing time
        Returns:
        a task variable.
      • taskVar

        default Task taskVar​(IntVar s,
                             IntVar p)
        Creates a task variable, based on a starting time s and a processing time p such that: s + p = e, where e is the ending time. A call to Task.ensureBoundConsistency() is required before launching the resolution, this will not be done automatically.
        Parameters:
        s - integer variable, starting time
        p - fixed processing time
        Returns:
        a task variable.
      • taskVar

        default Task taskVar​(IntVar s,
                             IntVar p,
                             IntVar e)
        Creates a task variable, made of a starting time s, a processing time p and an ending time e such that: s + p = e. A call to Task.ensureBoundConsistency() is required before launching the resolution, this will not be done automatically.
        Parameters:
        s - integer variable, starting time
        p - integer variable, processing time
        e - integer variable, ending time
        Returns:
        a task variable.
      • taskVarArray

        default Task[] taskVarArray​(IntVar[] s,
                                    IntVar[] p,
                                    IntVar[] e)
        Creates an array of s.length task variables, where task i is made of a starting time s_i, a processing time p_i and an ending time e_i such that: s_i + p_i = e_i. A call to Task.ensureBoundConsistency() is required before launching the resolution, this will not be done automatically.
        Parameters:
        s - integer variables, starting times
        p - integer variables, processing times
        e - integer variables, ending times
        Returns:
        an array of task variables.
      • taskVarMatrix

        default Task[][] taskVarMatrix​(IntVar[][] s,
                                       IntVar[][] p,
                                       IntVar[][] e)
        Creates a matrix of s.length * s_0.length task variables, where task i,j is made of a starting time s_(i,j), a processing time p_(i,j) and an ending time e_(i,j) such that: s_(i,j) + p_(i,j) = e_(i,j). A call to Task.ensureBoundConsistency() is required before launching the resolution, this will not be done automatically.
        Parameters:
        s - integer variables, starting times
        p - integer variables, processing times
        e - integer variables, ending times
        Returns:
        a matrix task variable.
      • realVar

        default RealVar realVar​(double value)
        Create a constant real variable equal to value
        Parameters:
        value - constant value of the variable
        Returns:
        a constant RealVar of domain [value,value]
      • realVar

        default RealVar realVar​(String name,
                                double value)
        Create a constant real variable equal to value
        Parameters:
        name - name of the variable
        value - value of the variable
        Returns:
        a constant RealVar of domain [value,value]
      • realVar

        default RealVar realVar​(double value,
                                double precision)
        Creates a constant real variable equal to value
        Parameters:
        value - constant value of the variable
        precision - double precision (e.g., 0.00001d)
        Returns:
        a constant RealVar of domain {value}
      • realVar

        default RealVar realVar​(double lb,
                                double ub,
                                double precision)
        Creates a real variable, taking its domain in [lb, ub]
        Parameters:
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        a RealVar of domain [lb, ub]
      • realVar

        default RealVar realVar​(String name,
                                double lb,
                                double ub,
                                double precision)
        Creates a real variable, taking its domain in [lb, ub]
        Parameters:
        name - variable name
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        a RealVar of domain [lb, ub]
      • realVarArray

        default RealVar[] realVarArray​(int size,
                                       double lb,
                                       double ub,
                                       double precision)
        Creates an array of size real variables, each of domain [lb, ub]
        Parameters:
        size - number of variables
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        an array of size RealVar of domain [lb, ub]
      • realVarArray

        default RealVar[] realVarArray​(String name,
                                       int size,
                                       double lb,
                                       double ub,
                                       double precision)
        Creates an array of size real variables, each of domain [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variables
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        an array of size RealVar of domain [lb, ub]
      • realVarMatrix

        default RealVar[][] realVarMatrix​(int dim1,
                                          int dim2,
                                          double lb,
                                          double ub,
                                          double precision)
        Creates a matrix of dim1*dim2 real variables, each of domain [lb, ub]
        Parameters:
        dim1 - number of matrix rows
        dim2 - number of matrix columns
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        a matrix of dim1*dim2 RealVar of domain [lb, ub]
      • realVarMatrix

        default RealVar[][] realVarMatrix​(String name,
                                          int dim1,
                                          int dim2,
                                          double lb,
                                          double ub,
                                          double precision)
        Creates a matrix of dim1*dim2 real variables, each of domain [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of matrix rows
        dim2 - number of matrix columns
        lb - initial domain lower bound
        ub - initial domain upper bound
        precision - double precision (e.g., 0.00001d)
        Returns:
        a matrix of dim1*dim2 RealVar of domain [lb, ub]
      • setVar

        default SetVar setVar​(int[] lb,
                              int[] ub)
        Creates a set variable taking its domain in [lb, ub], For instance [{0,3},{-2,0,2,3}] means the variable must include both 0 and 3 and can additionnaly include -2, and 2
        Parameters:
        lb - initial domain lower bound (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound (contains potential elements)
        Returns:
        a SetVar of domain [lb, ub]
      • setVar

        default SetVar setVar​(int... value)
        Creates a constant set variable, equal to value
        Parameters:
        value - value of the set variable, e.g. {0,4,9}
        Returns:
        a constant SetVar of domain {value}
      • setVar

        default SetVar setVar​(String name,
                              int[] lb,
                              int[] ub)
        Creates a set variable taking its domain in [lb, ub], For instance [{0,3},{-2,0,2,3}] means the variable must include both 0 and 3 and can additionnaly include -2, and 2
        Parameters:
        name - name of the variable
        lb - initial domain lower bound (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound (contains potential elements)
        Returns:
        a SetVar of domain [lb, ub]
      • setVar

        default SetVar setVar​(String name,
                              int... value)
        Creates a constant set variable, equal to value
        Parameters:
        name - name of the variable
        value - value of the set variable, e.g. {0,4,9}
        Returns:
        a constant SetVar of domain {value}
      • setVarArray

        default SetVar[] setVarArray​(int size,
                                     int[] lb,
                                     int[] ub)
        Creates an array of size set variables, taking their domain in [lb, ub]
        Parameters:
        size - number of variables
        lb - initial domain lower bound of every variable (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound of every variable (contains potential elements)
        Returns:
        an array of size SetVar of domain [lb, ub]
      • setVarArray

        default SetVar[] setVarArray​(String name,
                                     int size,
                                     int[] lb,
                                     int[] ub)
        Creates an array of size set variables, taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The ith variable will be named name[i]
        size - number of variables
        lb - initial domain lower bound of every variable (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound of every variable (contains potential elements)
        Returns:
        an array of size SetVar of domain [lb, ub]
      • setVarMatrix

        default SetVar[][] setVarMatrix​(int dim1,
                                        int dim2,
                                        int[] lb,
                                        int[] ub)
        Creates a matrix of dim1*dim2 set variables, taking their domain in [lb, ub]
        Parameters:
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of every variable (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound of every variable (contains potential elements)
        Returns:
        a matrix of dim1*dim2 SetVar of domain [lb, ub]
      • setVarMatrix

        default SetVar[][] setVarMatrix​(String name,
                                        int dim1,
                                        int dim2,
                                        int[] lb,
                                        int[] ub)
        Creates a matrix of dim1*dim2 set variables, taking their domain in [lb, ub]
        Parameters:
        name - prefix name of the variables to create. The variable in row i and col j will be named name[i][j]
        dim1 - number of rows in the matrix
        dim2 - number of columns in the matrix
        lb - initial domain lower bound of every variable (contains mandatory elements that should be present in every solution)
        ub - initial domain upper bound of every variable (contains potential elements)
        Returns:
        a matrix of dim1*dim2 SetVar of domain [lb, ub]
      • checkIntDomainRange

        default void checkIntDomainRange​(String NAME,
                                         int MIN,
                                         int MAX)
        Checks domain range. Throws an exception if wrong range definition
        Parameters:
        NAME - name of the variable
        MIN - lower bound of the domain
        MAX - upper bound of the domain
      • checkRealDomainRange

        default void checkRealDomainRange​(String NAME,
                                          double MIN,
                                          double MAX)
        Checks domain range. Throws an exception if wrong range definition
        Parameters:
        NAME - name of the variable
        MIN - lower bound of the domain
        MAX - upper bound of the domain
      • toBoolVar

        default BoolVar[] toBoolVar​(IntVar... ivars)
        Converts ivars into an array of boolean variables
        Parameters:
        ivars - an IntVar array containing only boolean variables
        Returns:
        an array of BoolVar
        Throws:
        ClassCastException - if one variable is not a BoolVar
      • generateName

        default String generateName()
        Return a generated short string, prefixed with Settings.defaultPrefix() and followed with a single-use number.
        Returns:
        generated String to name internally created variables
      • generateName

        default String generateName​(String prefix)
        Return a generated short string prefixed with prefix and followed with a single-use number.
        Parameters:
        prefix - the prefix name
        Returns:
        String