โš™๏ธ Solving an Instance๏ƒ

xcsp solver is the primary subcommand used to run a solver on an XCSP3 instance.


๐Ÿงพ CLI Reference๏ƒ

xcsp solver [-h] [--name NAME] [--solver-version SOLVER_VERSION]
            [--instance INSTANCE] [-a] [-n NUM_SOLUTIONS] [-i]
            [-p PARALLEL] [-r RANDOM_SEED] [--timeout TIMEOUT]
            [--keep-solver-output] [--json-output] [--stdout STDOUT]
            [--stderr STDERR] [--prefix PREFIX] [--tmp-dir TMP_DIR]
            [--solvers]
            [solver_options ...]

Argument

Description

--name

Name of the solver (e.g., ace)

--solver-version

Specific version to use (default: latest)

--instance

Path to the .xml file representing the XCSP3 instance

-a, --all-solutions

Retrieve all solutions (satisfaction) or improving ones (optimization)

-n, --num-solutions

Stop after a given number of solutions

-i, --intermediate

Print intermediate assignments during search

-p, --parallel

Number of threads to use for solving

-r, --random-seed

Fix the seed for reproducibility

--timeout

Time limit in seconds

--keep-solver-output

Show solver logs (stdout/stderr), line-prefixed

--json-output

Print results as JSON instead of standard log output

--stdout, --stderr

Redirect solver output to file or stdout/stderr

--prefix

Prefix for solver output lines (if shown)

--tmp-dir

Temporary directory for files generated during solving

--check

Check the last assignment found by the solver.

--solvers

Show a list of installed solvers

solver_options ...

Extra options passed after -- directly to the solver CLI


๐Ÿ“ฅ Listing Available Solvers๏ƒ

To see all installed solvers:

xcsp solver --solvers
                                                                                     Solver List                                                                                      
โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Name โ”ƒ        ID        โ”ƒ Version โ”ƒ Command Line                                                                                                                          โ”ƒ Alias  โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ ACE  โ”‚ fr.cril.xcsp.ace โ”‚   2.4   โ”‚ /usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.4-2.4/ACE-2.4.jar {{instance}} -npc=true -ev        โ”‚ latest โ”‚
โ”‚ ACE  โ”‚ fr.cril.xcsp.ace โ”‚   2.3   โ”‚ /usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.3-2.3/ACE-2.3.jar {{instance}} -npc=true -ev        โ”‚        โ”‚
โ”‚ ACE  โ”‚ fr.cril.xcsp.ace โ”‚ 2.4dev  โ”‚ /usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.4dev-c61dd75/ACE-2.4.jar {{instance}} -npc=true -ev โ”‚ dev    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

To list them as JSON (useful for scripting or IDE integration):

xcsp solver --solvers --json-output
[
    {
        "id": "ACE@2.4",
        "version": "2.4",
        "cmd": "/usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.4-2.4/ACE-2.4.jar {{instance}} -npc=true -ev"
    },
    {
        "id": "ACE@2.3",
        "version": "2.3",
        "cmd": "/usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.3-2.3/ACE-2.3.jar {{instance}} -npc=true -ev"
    },
    {
        "id": "ACE@2.4dev",
        "version": "2.4dev",
        "cmd": "/usr/bin/java -jar /home/user/.local/share/xcsp-launcher/bin/fr.cril.xcsp.ace/2.4dev-c61dd75/ACE-2.4.jar {{instance}} -npc=true -ev"
    }
]

๐Ÿงช Solving an Instance๏ƒ

Basic usage๏ƒ

xcsp solver --name ace --instance StillLife-wastage-05-05_c24.xml

With a specific version๏ƒ

xcsp solver --name ace --solver-version 2.3 --instance StillLife-wastage-05-05_c24.xml

Limit the number of solutions๏ƒ

xcsp solver --name ace --instance StillLife-wastage-05-05_c24.xml -n 4

Pass additional options to the solver๏ƒ

You can add solver-specific arguments at the end, using --:

xcsp solver --name ace --instance foo.xml -- -varh=RunRobin

๐Ÿ“ค Output Modes๏ƒ

  • Standard Output: By default, results are printed to the console.

  • JSON Output: Use --json-output to get structured results.

  • Log Redirection: You can redirect stdout and stderr using --stdout and --stderr.

Example:

xcsp solver --name ace --instance foo.xml --stdout results.out --stderr errors.log

This will redirect the output of the solver (and only the solver) respectively to result.out for stdout and errors.log for stderr.


๐Ÿ“Œ Notes๏ƒ

  • Solvers must be installed beforehand via xcsp install.

  • The --solvers flag is useful to check if a solver is ready before launching.