Class FeatureDisplayer

  • All Implemented Interfaces:
    XCallbacks, XCallbacks2

    public class FeatureDisplayer
    extends Object
    implements XCallbacks2
    This class allows us to display some general information about XCSP3 instances, such the number of variables, the number of constraints, the distribution of constraints, etc.
    Author:
    Christophe Lecoutre
    • Constructor Detail

      • FeatureDisplayer

        public FeatureDisplayer​(boolean competitionMode,
                                String name)
                         throws Exception
        Builds an object InstanceInformation that directly parses the XCSP3 file(s) from the specified name that denotes a file or a directory.
        Parameters:
        competitionMode - true if information is displayed to be used by tools of XCSP3 competitions
        name - the name of a file or directory
        Throws:
        Exception
    • Method Detail

      • implem

        public XCallbacks.Implem implem()
        Description copied from interface: XCallbacks
        Returns the object that implements necessary data structures during the loading process. In your class implementing XCallbacks, you should simply write something like:
         
         	 Implem implem = new Implem(this);
           
           @Override
           public Implem implem() {
           	return implem;
           }
         
         
        Specified by:
        implem in interface XCallbacks
        Returns:
        the object that implements some data structures used during the loading process
      • loadInstance

        public void loadInstance​(String fileName,
                                 String... discardedClasses)
                          throws Exception
        Description copied from interface: XCallbacks
        Loads and parses the XCSP3 instance whose filename is given. The optional specified classes indicate which elements (variables, constraints) must be discarded when parsing; for example, one may wish to ignore all constraints related to "symmetryBreaking". Normally, this method should not be overridden.
        Specified by:
        loadInstance in interface XCallbacks
        Parameters:
        fileName - the name of an XCSP3 file
        discardedClasses - the name of the classes (tags) of elements (variables, constraints) that must be discarded when parsing
        Throws:
        Exception
      • unimplementedCase

        public Object unimplementedCase​(Object... objects)
        Description copied from interface: XCallbacks2
        Methods to be implemented on integer variables/constraints
        Specified by:
        unimplementedCase in interface XCallbacks
        Specified by:
        unimplementedCase in interface XCallbacks2
        Parameters:
        objects - objects to be displayed (with toString())
        Returns:
        a fake object because the exception will quit first.
      • buildVarInteger

        public void buildVarInteger​(XVariables.XVarInteger x,
                                    int minValue,
                                    int maxValue)
        Description copied from interface: XCallbacks
        Callback method for building in the solver an integer variable whose domain contains all integer values between the two specified bounds.
        Specified by:
        buildVarInteger in interface XCallbacks
        Specified by:
        buildVarInteger in interface XCallbacks2
        Parameters:
        x - an integer variable built by the parser
        minValue - the minimum value of the domain of x
        maxValue - the maximum value of the domain of x
      • buildVarInteger

        public void buildVarInteger​(XVariables.XVarInteger x,
                                    int[] values)
        Description copied from interface: XCallbacks
        Callback method for building in the solver an integer variable whose domain is given by the specified array.
        Specified by:
        buildVarInteger in interface XCallbacks
        Specified by:
        buildVarInteger in interface XCallbacks2
        Parameters:
        x - an integer variable built by the parser
        values - the values in the domain of x
      • loadVar

        public void loadVar​(XVariables.XVar v)
        Description copied from interface: XCallbacks
        Loads the specified variable. One callback function 'buildVarInteger' or 'buildVarSymbolic' is called when this method is executed. Except for some advanced uses, this method should not be overridden.
        Specified by:
        loadVar in interface XCallbacks
        Parameters:
        v - the variable to be loaded
      • loadCtr

        public void loadCtr​(XConstraints.XCtr c)
        Description copied from interface: XCallbacks
        Loads the specified constraint. One callback function (for example, builCtrIntension or buildCtrAllDifferent) is called when this method is executed. Except for some advanced uses, this method should not be overridden.
        Specified by:
        loadCtr in interface XCallbacks
        Parameters:
        c - the constraint to be loaded
      • loadObj

        public void loadObj​(XObjectives.XObj o)
        Description copied from interface: XCallbacks
        Loads the specified objective. One callback function (for example, builObjToMinimize or buildObjToMaximize) is called when this method is executed. Except for some advanced uses, this method should not be overridden.
        Specified by:
        loadObj in interface XCallbacks
        Parameters:
        o - the objective to be loaded