โ๏ธ 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 of the solver (e.g., |
|
Specific version to use (default: |
|
Path to the |
|
Retrieve all solutions (satisfaction) or improving ones (optimization) |
|
Stop after a given number of solutions |
|
Print intermediate assignments during search |
|
Number of threads to use for solving |
|
Fix the seed for reproducibility |
|
Time limit in seconds |
|
Show solver logs (stdout/stderr), line-prefixed |
|
Print results as JSON instead of standard log output |
|
Redirect solver output to file or stdout/stderr |
|
Prefix for solver output lines (if shown) |
|
Temporary directory for files generated during solving |
|
Check the last assignment found by the solver. |
|
Show a list of installed solvers |
|
Extra options passed after |
๐ฅ 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-outputto get structured results.Log Redirection: You can redirect
stdoutandstderrusing--stdoutand--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
--solversflag is useful to check if a solver is ready before launching.