Abscon 109 is the solver that has been submitted to the (second round of the) 2006 Competition of CSP solvers. This solver recognizes the XML format, XCSP 2.0, used to represent CSP instances. You can see the results of the second round here.
To run Abscon (tested under Linux, but not under Windows), you have to:
- install J2SE 5.0 (Java 2 Platform Standard Edition 5.0) or later, if not already installed (See http://java.sun.com/)
- download and uncompress abscon109.tgz
- execute in a terminal:
- for a single instance: java -jar abscon109.jar <configurationFileName> 1 XSax <instanceFileName>
- for several instances: java -jar abscon109.jar <configurationFileName> <nbInstances> XSax <directoryFileName>
Here, <configurationFileName> can be:
- mac.xml (used for CSP)
- esac.xml (used for CSP)
- pfc.xml (used for Max-CSP)
- epfc.xml (used for Max-CSP)
That is to say, any configuration file that you will find in abscon109.tgz. <instanceFileName> denotes the name of an instance in format XML whereas <directoryFileName> denotes the name of a directory containing instances in format XML (in this case, <nbInstances> denotes the number of instances you want to solve, -1 for all).
Of course, you can use options for the JVM. For example, here are the options used for the competition: -Xms756M -Xmx756M -XX:PermSize=10m -XX:MaxPermSize=10m
WARNING: For some large instances, the program may be out of memory and stops suddenly. Note that you can tune the memory settings for the Java Virtual Machine with arguments Xms and Xmx. However, be careful of not choosing a too large value of Xmx (maximmum heap size) since it may destabilize the operating system. In any case, we shall not be considered as responsible for any potential damages to your computer system that will result from the execution of this program.
The format XCSP 2.1 allows us to represent global constraints and constraints defined in extension or in intension. You will find its desciption, as well as many series of instances, here.
The tools that are currently available from this page are:
- InstanceParser: a tool that allows to load and parse CSP and WCSP instances represented in format XCSP 2.1.
- SolutionChecker: a tool that allows to compute the number of constraints violated by (resp. the cost of) a full instantiation of the variables of a CSP instance (resp. a WCSP instance).
- InstanceChecker: a tool that allows to check the validity of CSP instances (in format XCSP 2.1) and to convert in extension constraints defined in intension.
- InstanceShuffler: a tool that allows to shuffle variables and constraints of CSP and WCSP instances.
To obtain these tools, you can download:
- Tools2008.jar: a jar from which you can run any of these tools.
- Tools2008.zip: a zip including the sources of all these tools.
Parsing instances
If you want to load and parse CSP and WCSP instances represented in format ``XCSP 2.1'', you can use one of the two following parsers:
- a parser written in C/C++
- a parser written in Java based on DOM (Document Object Model)
For more information about the first parser, see this link . Questions and suggestions are welcome: send an e-mail to Olivier.
The second parser is written in Java using DOM and is mainly based on the class InstanceParser.java that you will find in Tools2008.zip. To integrate your own parser in your constraint library, you can simply adapt the given code (note that you do not need to keep all classes of Tools2008.zip since for example, you can remove the method computeCostOf of the class PConstraint). Of course, questions and suggestions are welcome: send an e-mail to Christophe.
Evaluating Predicate Expressions
One difficulty with the new format is to deal with constraints represented in intension. More precisely, one must be able to evaluate any predicate expression built from the grammar introduced in format 2.1. There are at least two generic alternatives:
- interpreting the expressions
- compiling the expressions
Here, we just quickly discuss about the former approach. If you build a postfix expression from the functional one, then it can be scanned from left to right, operands simply placed into a last-in, first-out (LIFO) stack and operators applied to the operands at the top of the stack. This is the principle used for SolutionChecker and InstanceChecker tools. The code is available in Tools2008.zip.
Of course, you can decide to adopt a more specific approach, exploiting the semantics of the operators/constraints to build propagators.
This tool allows to compute the number of constraints violated by a complete instantiation of the variables of a CSP instance, or the cost of a complete instantiation of the variables of a WCSP instance. Of course, if the number of violated constraints is equal to 0, it simply means that it is a solution.
To run SolutionChecker:
- install J2SE 5.0 (Java 2 Platform Standard Edition 5.0) or later, if not already installed (see http://java.sun.com/)
- download Tools2008.jar
- run SolutionChecker with the command line: java -cp Tools2008.jar abscon.instance.tools.SolutionChecker
Then, you obtain the different usages of SolutionChecker. Just choose one of them. The source code is available in Tools2008.zip.
For example, let us consider a file queens_4.xml containing:
<?xml version="1.0" encoding="UTF-8"?> <instance> <presentation name="?" format="XCSP 2.1"/> <domains nbDomains="1"> <domain name="D0" nbValues="4">1..4</domain> </domains> <variables nbVariables="4"> <variable name="V0" domain="D0"/> <variable name="V1" domain="D0"/> <variable name="V2" domain="D0"/> <variable name="V3" domain="D0"/> </variables> <predicates nbPredicates="1"> <predicate name="P0"> <parameters>int X0 int X1 int X2 int X3 int X4</parameters> <expression> <functional>and(ne(X0,X1),ne(abs(sub(X2,X3)),X4))</functional> </expression> </predicate> </predicates> <constraints nbConstraints="6"> <constraint name="C0" arity="2" scope="V0 V1" reference="P0"> <parameters>V0 V1 V0 V1 1</parameters> </constraint> <constraint name="C1" arity="2" scope="V0 V2" reference="P0"> <parameters>V0 V2 V0 V2 2</parameters> </constraint> <constraint name="C2" arity="2" scope="V0 V3" reference="P0"> <parameters>V0 V3 V0 V3 3</parameters> </constraint> <constraint name="C3" arity="2" scope="V1 V2" reference="P0"> <parameters>V1 V2 V1 V2 1</parameters> </constraint> <constraint name="C4" arity="2" scope="V1 V3" reference="P0"> <parameters>V1 V3 V1 V3 2</parameters> </constraint> <constraint name="C5" arity="2" scope="V2 V3" reference="P0"> <parameters>V2 V3 V2 V3 1</parameters> </constraint> </constraints> </instance>
Then, if you run:
java -cp Tools2008.jar abscon.instance.tools.SolutionChecker queens_4.xml 2 4 1 3
you obtain:
nbUnsatisfiedConstraints 0
On the other hand, if you run:
java -cp Tools2008.jar abscon.instance.tools.SolutionChecker queens_4.xml 2 4 1 2
you obtain:
nbUnsatisfiedConstraints 3 list [C2, C5, C4]
The program called InstanceChecker is a tool that allows validating and converting representations of CSP and WCSP instances. To run instanceChecker:
- install J2SE 5.0 (Java 2 Platform Standard Edition 5.0) or later, if not already installed (see http://java.sun.com/)
- download Tools2008.jar
- run InstanceChecker with the command line: java -cp Tools2008.jar abscon.instance.tools.InstanceChecker
Then, you obtain the different usages of InstanceChecker. Just choose one of them.
For example, to use a graphical user interface, run: java -cp Tools2008.jar abscon.instance.tools.InstanceChecker gui Then, you obtain the following interface:
WARNING: For some large instances, the program may be out of memory and stops suddenly. Note that you can tune the memory settings for the Java Virtual Machine with arguments Xms and Xmx. However, be careful of not choosing a too large value of Xmx (maximmum heap size) since it may destabilize the operating system. In any case, we shall not be considered as responsible for any potential damages to your computer system that will result from the execution of this program.
You also have a simple command line usage: java -cp Tools2008.jar abscon.instance.tools.InstanceChecker <instanceFileName> <mode> {<overwrite>}
The options are the following:
- with mode = 1, you can check the validity of the instance whose name is given
- with mode = 2, you can check the validity of the given instance (including additional rules of the 2008 competition of CSP solvers)
- with mode = 3, you can check (not including additional competition rules) and convert the given instance into canonical form
- with mode = 4, you can check (not including additional 2008 competition rules) and convert the given instance into canonical extensional form
- with mode = 3 and mode = 4, you can indicate (set 'y' to overwrite) that you want to overwrite the given instance
Questions and suggestions about tools SolutionChecker and InstanceChecker are welcome: send an e-mail to Christophe.
Validating CSP instances
To check that some instances are valid wrt the format XCSP 2.1 you have to select one of the two first radio buttons and to select the directory where the files are located (use the Src button). Then, you can start checking by pushing the Start button. As a result, all files with suffix "xml" in the selected directory or one of its subdirectories will be checked. Hence, we advice that you put all files corresponding to the instances whose validity must be checked in a specific directory structure.
For more information about the validity of instances, see this document. The first choice (radio button) of the interface corresponds to checking general validity rules whereas the second choice (radio button) of the interface corresponds to checking general and specific 2008 competition validity rules.
Converting CSP instances
Using the third radio button, you can check the validity of some instances (only using general validity rules) and convert, if necessary, the instances into canonical form. A representation of a CSP instance is said to be canonical when domains, variables, relations, predicates, formal parameters and constraints are given standardized names. Finally, using the fourth button, you can check the validity of some instances (only using general validity rules) and convert, if necessary, the instances into canonical form and predicates into relations.
Note that InstanceChecker does not control (with mode 2) that constraints are sorted by lexicographic order of their normalized scope.
This tool allows to shuffle variables and constraints of a given instance. The interest is that you can check the robustness of your solver. If your solver has roughly the same behaviour on the same instance that has been shuffled a reasonable number of times, it means that it is quite robust.
To run InstanceShuffler:
- install J2SE 5.0 (Java 2 Platform Standard Edition 5.0) or later, if not already installed (see http://java.sun.com/)
- download Tools2008.jar
- run InstanceShuffler with the command line: java -cp Tools2008.jar abscon.instance.tools.InstanceShuffler.jar <instanceFileName> <seed>
Here, <instanceFileName> denotes the name of a file representing a CSP or WCSP instance in format XCSP 2.1, and <seed> is an integer used to initialize the pseudo-random number generator. For example, to shuffle scen11.xml using seed 1:
- java -cp Tools2008.jar abscon.instance.tools.InstanceShuffler.jar scen11.xml 1
Then, you obtain a file whose name is:
- scen11_shf1.xml
RBGenerator is a program that allows generating random CSP instances following Model RB. For more information about Model RB, see:
- Exact phase transitions in random constraint satisfaction problems, JAIR 2001
- A simple model to generate hard satisfiable instances, IJCAI 2005
- Random constraint satisfaction: easy generation of hard (satisfiable) instances, AIJ 2007]
RBGenerator generates random CSP instances in the XML format called XCSP 2.0. For more information about this format, see: XML Representation of Constraint Networks: Format XCSP 2.1
To run RBGenerator, you have to:
- install J2SE 5.0 (Java 2 Platform Standard Edition 5.0) or later, if not already installed (See http://java.sun.com/)
- download RBGenerator.jar
- run RBGenerator with the command line: java -jar RBGenerator.jar
Then, you obtain the different usages that can be used with RBGenerator:
- Usage 0: java -jar RBGenerator.jar <arity> <alpha> <r>
- Usage 1: java -jar RBGenerator.jar <arity> <nbVariables> <alpha> <r>
- Usage 2: java -jar RBGenerator.jar <arity> <nbVariables> <domainSize> <nbConstraints> <tightness>
- Usage 3: java -jar RBGenerator.jar <arity> <nbVariables> <alpha> <r> <delta> <forced> <merged> <seed> <nbInstances>
Whith Usage 0, you obtain the following information:
- the (theoretical) critical value of the tightness (called threshold)
- an indication about Theorem 2. If this theorem holds, then asymptotically (when the number of variable tends to infinity), we have the guarantee to have a phase transition.
Whith Usage 1, you obtain the following information:
- the critical value of the tightness (called threshold)
- an indication about Theorem 2. If this theorem holds, then asymptotically (when the number of variable tends to infinity), we have the guarantee to have a phase transition.
- the size of the domains. As it must be an integer, it involves a value of <alpha> that can be slighlty different from the one that was given
- the number of constraints. As it must be an integer, it involves a value of <r> that can be slighlty different from the one that was given
- the critical value of the tightness (called threshold) when considering real values of <alpha> and <r>
Whith Usage 2, you obtain the following information:
- the value of <alpha>
- the value of <r>
- the critical value of the tightness (called threshold)
- an indication about Theorem 2. If this theorem holds, then asymptotically (when the number of variable tends to infinity), we have the guarantee to have a phase transition.
With Usage 3, one can generate random instances.
The arguments are the following:- <arity> : denotes the arity of the constraints
- <nbVariables> : denotes the number of variables
- <alpha> : determines the size of the domains
- <r> : determines the number of constraints
- <delta> : indicates the distance or gap (divided by 1000) wrt the threshold.
-
For example,
- if delta is equal to 0, then instances are generated at the threshold pcrit,
- if delta is equal to -100, then instances are generated below the threshold (pcrit -0.1),
- if delta is equal to 100, then instances are generated above the threshold (pcrit +0.1),
- <forced> : indicates (y) if the instances must be forced to be satisfiable
- <merged> : indicates (y) if constraints of similar scope must be merged
- <seed> : denotes the seed used by the pseudo-random generator when randomly generating the first instance. If several instances have to be generated, then the ith instance is generated using the given value + i
- <nbInstances> : indicates the number of instances that must be generated
WARNING: For some large instances, the program may be out of memory and stops suddenly. Note that you can tune the memory settings for the Java Virtual Machine with arguments Xms and Xmx. However, be careful of not choosing a too large value of Xmx (maximmum heap size) since it may destabilize the operating system. In any case, we shall not be considered as responsible for any potential damages to your computer system that will result from the execution of this program.
Software