Interface IViewFactory

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

    public interface IViewFactory
    extends ISelf<Model>
    Interface to make views (BoolVar, IntVar, RealVar and SetVar) A kind of factory relying on interface default implementation to allow (multiple) inheritance
    Author:
    Jean-Guillaume FAGES
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default BoolVar boolNotView​(BoolVar bool)
      Creates a view over bool holding the logical negation of bool (ie, ¬BOOL).
      default IntVar intAbsView​(IntVar var)
      Creates a view over var such that: |var|.
      default IntVar intAffineView​(int a, IntVar x, int b)
      Creates an affine view over x such that: a.x + b.
      default IntVar intMinusView​(IntVar var)
      Creates a view over var equal to -var.
      default IntVar intOffsetView​(IntVar var, int cste)
      Creates a view based on var, equal to var+cste.
      default IntVar intScaleView​(IntVar var, int cste)
      Creates a view over var equal to var*cste.
      default RealVar realIntView​(IntVar var, double precision)
      Creates a real view of var, i.e. a RealVar of domain equal to the domain of var.
      default RealVar[] realIntViewArray​(IntVar[] ints, double precision)
      Creates an array of real views for a set of integer variables This should be used to include an integer variable in an expression/constraint requiring RealVar
      default RealVar[][] realIntViewMatrix​(IntVar[][] ints, double precision)
      Creates a matrix of real views for a matrix of integer variables This should be used to include an integer variable in an expression/constraint requiring RealVar
      • Methods inherited from interface org.chocosolver.solver.ISelf

        ref
    • Method Detail

      • boolNotView

        default BoolVar boolNotView​(BoolVar bool)
        Creates a view over bool holding the logical negation of bool (ie, ¬BOOL).
        Parameters:
        bool - a boolean variable.
        Returns:
        a BoolVar equal to not(bool) (or 1-bool)
      • intOffsetView

        default IntVar intOffsetView​(IntVar var,
                                     int cste)
        Creates a view based on var, equal to var+cste.
        Parameters:
        var - an integer variable
        cste - a constant (can be either negative or positive)
        Returns:
        an IntVar equal to var+cste
      • intMinusView

        default IntVar intMinusView​(IntVar var)
        Creates a view over var equal to -var. That is if var = [a,b], then this = [-b,-a].
        Parameters:
        var - an integer variable
        Returns:
        an IntVar equal to -var
      • intScaleView

        default IntVar intScaleView​(IntVar var,
                                    int cste)
        Creates a view over var equal to var*cste. Requires cste > -2


        - if cste < -1, throws an exception;
        - if cste = -1, returns a minus view;
        - if cste = 0, returns a fixed variable;
        - if cste = 1, returns var;
        - otherwise, returns a scale view;

        Parameters:
        var - an integer variable
        cste - a constant.
        Returns:
        an IntVar equal to var*cste
      • intAbsView

        default IntVar intAbsView​(IntVar var)
        Creates a view over var such that: |var|.


        - if var is already instantiated, returns a fixed variable;
        - if the lower bound of var is greater or equal to 0, returns var;
        - if the upper bound of var is less or equal to 0, return a minus view;
        - otherwise, returns an absolute view;

        Parameters:
        var - an integer variable.
        Returns:
        an IntVar equal to the absolute value of var
      • intAffineView

        default IntVar intAffineView​(int a,
                                     IntVar x,
                                     int b)
        Creates an affine view over x such that: a.x + b.

        Parameters:
        a - a coefficient
        x - an integer variable.
        b - a constant
        Returns:
        an IntVar equal to the absolute value of var
      • realIntView

        default RealVar realIntView​(IntVar var,
                                    double precision)
        Creates a real view of var, i.e. a RealVar of domain equal to the domain of var. This should be used to include an integer variable in an expression/constraint requiring RealVar
        Parameters:
        var - the integer variable to be viewed as a RealVar
        precision - double precision (e.g., 0.00001d)
        Returns:
        a RealVar of domain equal to the domain of var
      • realIntViewArray

        default RealVar[] realIntViewArray​(IntVar[] ints,
                                           double precision)
        Creates an array of real views for a set of integer variables This should be used to include an integer variable in an expression/constraint requiring RealVar
        Parameters:
        ints - the array of integer variables to be viewed as real variables
        precision - double precision (e.g., 0.00001d)
        Returns:
        a real view of ints
      • realIntViewMatrix

        default RealVar[][] realIntViewMatrix​(IntVar[][] ints,
                                              double precision)
        Creates a matrix of real views for a matrix of integer variables This should be used to include an integer variable in an expression/constraint requiring RealVar
        Parameters:
        ints - the matrix of integer variables to be viewed as real variables
        precision - double precision (e.g., 0.00001d)
        Returns:
        a real view of ints