Package org.xcsp.parser.callbacks
Class FeatureDisplayer
- java.lang.Object
-
- org.xcsp.parser.callbacks.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.xcsp.parser.callbacks.XCallbacks
XCallbacks.Implem, XCallbacks.XCallbacksParameters
-
-
Constructor Summary
Constructors Constructor Description FeatureDisplayer(boolean competitionMode, String name)
Builds an objectInstanceInformation
that directly parses the XCSP3 file(s) from the specified name that denotes a file or a directory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildVarInteger(XVariables.XVarInteger x, int[] values)
Callback method for building in the solver an integer variable whose domain is given by the specified array.void
buildVarInteger(XVariables.XVarInteger x, int minValue, int maxValue)
Callback method for building in the solver an integer variable whose domain contains all integer values between the two specified bounds.void
buildVarSymbolic(XVariables.XVarSymbolic x, String[] values)
Methods to be implemented on symbolic variables/constraintsXCallbacks.Implem
implem()
Returns the object that implements necessary data structures during the loading process.void
loadCtr(XConstraints.XCtr c)
Loads the specified constraint.void
loadInstance(String fileName, String... discardedClasses)
Loads and parses the XCSP3 instance whose filename is given.void
loadObj(XObjectives.XObj o)
Loads the specified objective.void
loadVar(XVariables.XVar v)
Loads the specified variable.static void
main(String[] args)
Object
unimplementedCase(Object... objects)
Methods to be implemented on integer variables/constraints-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.xcsp.parser.callbacks.XCallbacks
buildCtrFalse, buildCtrTrue, loadAnnotations, loadArray, loadBlock, loadConstraints, loadConstraints, loadCtrs, loadDocument, loadGroup, loadInstance, loadLogic, loadObjectives, loadSlide, loadVariables, repost
-
Methods inherited from interface org.xcsp.parser.callbacks.XCallbacks2
beginAnnotations, beginArray, beginBlock, beginConstraints, beginGroup, beginInstance, beginLogic, beginObjectives, beginSlide, beginVariables, buildAnnotationDecision, buildCtrAllDifferent, buildCtrAllDifferent, buildCtrAllDifferent, buildCtrAllDifferentExcept, buildCtrAllDifferentList, buildCtrAllDifferentMatrix, buildCtrAllEqual, buildCtrAmong, buildCtrAmong, buildCtrAtLeast, buildCtrAtMost, buildCtrBinPacking, buildCtrBinPacking, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrChannel, buildCtrChannel, buildCtrChannel, buildCtrCircuit, buildCtrCircuit, buildCtrCircuit, buildCtrClause, buildCtrCount, buildCtrCount, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrExactly, buildCtrExactly, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrInstantiation, buildCtrIntension, buildCtrIntension, buildCtrLex, buildCtrLexMatrix, buildCtrLogic, buildCtrLogic, buildCtrLogic, buildCtrLogic, buildCtrMaximum, buildCtrMaximum, buildCtrMaximum, buildCtrMDD, buildCtrMinimum, buildCtrMinimum, buildCtrMinimum, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNotAllEqual, buildCtrNValues, buildCtrNValuesExcept, buildCtrOrdered, buildCtrOrdered, buildCtrOrdered, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrPrimitive, buildCtrRegular, buildCtrStretch, buildCtrStretch, buildCtrSum, buildCtrSum, buildCtrSum, buildCtrSum, buildCtrSum, buildCtrSum, buildObjToMaximize, buildObjToMaximize, buildObjToMaximize, buildObjToMaximize, buildObjToMaximize, buildObjToMaximize, buildObjToMinimize, buildObjToMinimize, buildObjToMinimize, buildObjToMinimize, buildObjToMinimize, buildObjToMinimize, endAnnotations, endArray, endBlock, endConstraints, endGroup, endInstance, endLogic, endObjectives, endSlide, endVariables
-
-
-
-
Constructor Detail
-
FeatureDisplayer
public FeatureDisplayer(boolean competitionMode, String name) throws Exception
Builds an objectInstanceInformation
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 competitionsname
- 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 interfaceXCallbacks
- 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 interfaceXCallbacks
- Parameters:
fileName
- the name of an XCSP3 filediscardedClasses
- 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 interfaceXCallbacks
- Specified by:
unimplementedCase
in interfaceXCallbacks2
- 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 interfaceXCallbacks
- Specified by:
buildVarInteger
in interfaceXCallbacks2
- Parameters:
x
- an integer variable built by the parserminValue
- the minimum value of the domain of xmaxValue
- 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 interfaceXCallbacks
- Specified by:
buildVarInteger
in interfaceXCallbacks2
- Parameters:
x
- an integer variable built by the parservalues
- the values in the domain of x
-
buildVarSymbolic
public void buildVarSymbolic(XVariables.XVarSymbolic x, String[] values)
Description copied from interface:XCallbacks2
Methods to be implemented on symbolic variables/constraints- Specified by:
buildVarSymbolic
in interfaceXCallbacks
- Specified by:
buildVarSymbolic
in interfaceXCallbacks2
-
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 interfaceXCallbacks
- 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 interfaceXCallbacks
- 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 interfaceXCallbacks
- Parameters:
o
- the objective to be loaded
-
-