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 objectInstanceInformationthat 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 voidbuildVarInteger(XVariables.XVarInteger x, int[] values)Callback method for building in the solver an integer variable whose domain is given by the specified array.voidbuildVarInteger(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.voidbuildVarSymbolic(XVariables.XVarSymbolic x, String[] values)Methods to be implemented on symbolic variables/constraintsXCallbacks.Implemimplem()Returns the object that implements necessary data structures during the loading process.voidloadCtr(XConstraints.XCtr c)Loads the specified constraint.voidloadInstance(String fileName, String... discardedClasses)Loads and parses the XCSP3 instance whose filename is given.voidloadObj(XObjectives.XObj o)Loads the specified objective.voidloadVar(XVariables.XVar v)Loads the specified variable.static voidmain(String[] args)ObjectunimplementedCase(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, loadAnn, 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, buildAnnotationValHeuristicStatic, buildCtrAdhoc, buildCtrAllDifferent, buildCtrAllDifferent, buildCtrAllDifferent, buildCtrAllDifferentExcept, buildCtrAllDifferentExcept, buildCtrAllDifferentList, buildCtrAllDifferentList, buildCtrAllDifferentMatrix, buildCtrAllDifferentMatrix, buildCtrAllEqual, buildCtrAllEqual, buildCtrAllEqualExcept, buildCtrAllEqualExcept, buildCtrAmong, buildCtrAmong, buildCtrAtLeast, buildCtrAtMost, buildCtrBinPacking, buildCtrBinPacking, buildCtrBinPacking, buildCtrBinPacking, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrCardinality, buildCtrChannel, buildCtrChannel, buildCtrChannel, buildCtrCircuit, buildCtrCircuit, buildCtrCircuit, buildCtrClause, buildCtrCount, buildCtrCount, buildCtrCount, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrCumulative, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrElement, buildCtrExactly, buildCtrExactly, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrExtension, buildCtrFlow, buildCtrFlow, buildCtrInstantiation, buildCtrIntension, buildCtrIntension, buildCtrKnapsack, buildCtrLex, buildCtrLex, buildCtrLexMatrix, buildCtrLogic, buildCtrLogic, buildCtrLogic, buildCtrLogic, buildCtrMaximum, buildCtrMaximum, buildCtrMaximum, buildCtrMaximumArg, buildCtrMaximumArg, buildCtrMDD, buildCtrMinimum, buildCtrMinimum, buildCtrMinimum, buildCtrMinimumArg, buildCtrMinimumArg, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNoOverlap, buildCtrNotAllEqual, buildCtrNValues, buildCtrNValues, buildCtrNValuesExcept, buildCtrOrdered, buildCtrOrdered, buildCtrOrdered, buildCtrPrecedence, buildCtrPrecedence, 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 ExceptionBuilds an objectInstanceInformationthat directly parses the XCSP3 file(s) from the specified name that denotes a file or a directory.- Parameters:
competitionMode-trueif 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:XCallbacksReturns 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:
implemin 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:XCallbacksLoads 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:
loadInstancein 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:XCallbacks2Methods to be implemented on integer variables/constraints- Specified by:
unimplementedCasein interfaceXCallbacks- Specified by:
unimplementedCasein 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:XCallbacksCallback method for building in the solver an integer variable whose domain contains all integer values between the two specified bounds.- Specified by:
buildVarIntegerin interfaceXCallbacks- Specified by:
buildVarIntegerin 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:XCallbacksCallback method for building in the solver an integer variable whose domain is given by the specified array.- Specified by:
buildVarIntegerin interfaceXCallbacks- Specified by:
buildVarIntegerin 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:XCallbacks2Methods to be implemented on symbolic variables/constraints- Specified by:
buildVarSymbolicin interfaceXCallbacks- Specified by:
buildVarSymbolicin interfaceXCallbacks2
-
loadVar
public void loadVar(XVariables.XVar v)
Description copied from interface:XCallbacksLoads 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:
loadVarin interfaceXCallbacks- Parameters:
v- the variable to be loaded
-
loadCtr
public void loadCtr(XConstraints.XCtr c)
Description copied from interface:XCallbacksLoads 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:
loadCtrin interfaceXCallbacks- Parameters:
c- the constraint to be loaded
-
loadObj
public void loadObj(XObjectives.XObj o)
Description copied from interface:XCallbacksLoads 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:
loadObjin interfaceXCallbacks- Parameters:
o- the objective to be loaded
-
-