Dr. B.G.W. Craenen <>

JavaCsp is a random binary constraint satisfaction problem instance generator. It includes solvers, generation of dynamic constraint satisfaction problem instances, and complete testsets. The name JavaCsp comes from the simple concatenation of 'Java' for the language it was written in and 'Csp' for the problems it generates.

I developed JavaCsp because I needed a CSP generator in Java to work together with my evolutionary algorithm solver platform for CSPs JavaEa2. It had to be both easy to understand and easy to expand with different methods for solving CSPs with classical solvers. Furthermore, I used the Java language because I wanted JavaCSP to run on different computer platforms (i.e. Unix and Windows). I've included functionality in the commandline interface that allows JavaCsp to generate entire test suites without much work.

I want to thank Tuan-Viet Nguyen for pointing out some small bugs in the commandline interface, these are all fixed in version 1.0.2. Unfortunately, due to a diskcrash last year, just as with JavaEa2, I am unable to provide the source-code to JavaCsp at this time. The jar-file, however, can be downloaded here and should work straight out of the box. For those still working with version 1.0.1, it can be downloaded here. Both jar-files also include a version of gnu.getopt developed by GNU and unsupported by me. As with all my software, JavaCsp comes as is and with absolutely no warranty.

JavaCsp is controlled through commandline options summarised through the build-in help message (option -h):

Java Csp Generator, Copyright (C) B.G.W. Craenen.
This program comes as-is and with ABSOLUTELY NO WARRANTY.

    -ar    Accuracy, only used for generating model F (default 0.001)
    -cr    Chance of generating a constraint (model a-d) or p of the
           geometric distribution (model g) (default: 0.5)
    -dn    Size of domain of variables (default: 20)
    -ms    Method used for generating the random problem {a-g} (default: f)
    -fs    String used as filename for the output
           The following strings will be replaced in the filename:
           %x    number of generated file.
           %S    whether generated file is solvable or unsolvable.
                 only when -S and -T options are in use.
           %r    'r' for random domainsize, 'c' for constant domainsize.
           %m    method used for generating file.
           %n    number of variables.
           %d    domainsize.
           %t    given tightness.
           %c    given connectivity.
           %s    random seed used.
           Default name used: %x.%S.m%m_v%n_d%d_%r_t%t_c%c_s%s.csp(.gz)
    -h     Print help and version.
    -pn    Number of problems to generate (default: 1)
    -q     Keep quiet
    -r     Choose random size of domain for each variable
    -sn    Seed for the random generator (default: 1)
    -tr    Chance of generating a conflict; tightness (default: 0.5)
    -Sn    Produce only solvable instances, can take forever!
           (integer n = 1) Argument is the number of times a csp
           should be generated
    -T     Test every instance to see if it has a solution.
    -vn    Number of variables (default: 20)
    -os    Use simple array (a) or hashmap (h) to store csp internally.
           (default: a).
    -Os    Save in matrix format (m) or list format (l), default matrix.
           (default: m).
    -z     Gzip csp file (.gz automagically attached).
    -Cs    Create or add csp file to zip collection.
           Adding csps to large collections is inefficient!
    -Rn    Run which classical algorithm to check whether the
           CSP is solvable or not (default: FC & CBJ):
           a   SimpleBackTracking
           b   SimpleBackMarking
           c   SimpleBackJumping
           d   SimpleForwardChecking
           e   BackMarkingAndBackJumping
           f   BackMarkingAndConflictDirectedBackJumping
           g   BackMarkingAndGraphBasedBasedBackJumping
           h   ConstraintDirectedBackJumping
           i   GraphBasedBackJumping
           j   ForwardCheckingAndBackJumping
           k   ForwardCheckingAndConflictDirectedBackJumping
           l   ForwardCheckingAndGraphBasedBackJumping
           m   ForwardCheckingWithDynamicVariableOrdering
           n   ForwardCheckingWithFullArcConsistency
           o   MaintainingArcConsistencyWithDynamicVariableOrdering
    -An    Perform a check on the CSP list:
           1   Use -R algorithm to check for solvability
           2   Use -R algorithm to calculate conflict checks needed
    -ls    String indicating list path for checking CSPs.
copyright © B.G.W. Craenen