TOULBAR2(1)

๐Ÿ“ฆ
version 1.2.1 ยท 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute

๐Ÿ’– TOULBAR2(1) โ€” the toulbar2 glow-up โœจ

okay bestie, gather round, because we're about to talk about toulbar2 from the General Commands Manual and she is that girl. no cap, this tool exactly solves discrete optimization problems on graphical models. exactly. not approximately. not "close enough bestie". exactly. ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

toulbar2 โ€” exactly solves discrete optimization problems on graphical models ๐Ÿฆ‹


โญ SYNOPSIS โญ

toulbar2 [options] file

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

so like. toulbar2 solves discrete optimization problems defined by a graphical model. and when I say graphical model I mean the whole squad:

  • Cost Function Networks โ€” which is solving the Weighted Constraint Satisfaction Problem ๐Ÿ’›
  • Markov Random Fields โ€” which is solving Maximum A Posteriori or MAP/MRF ๐ŸŒฟ
  • Bayesian Networks โ€” which is solving Maximum Probability Explanation or MPE/BN ๐Ÿ”ฎ
  • Quadratic Pseudo Boolean Optimization Problems โ€” a.k.a. QPBO or MAXCUT โœ‚๏ธ
  • Partial Weighted Maximum Satisfiabilityโ€ฆ and honestly the list keeps going, she contains multitudes ๐Ÿ’€

โœจ OPTIONS โœจ

๐ŸŽ€ GENERAL CONTROL ๐ŸŽ€

  • -a=[integer] โ€” finds at most a given number of solutions whose cost is strictly lower than the initial upper bound, then stops. and if you don't give her an integer at all? she finds all the solutions (or counts the number of zero-cost satisfiable solutions when you pair her up with BTD). iconic behavior honestly ๐Ÿซถ
  • -agap=[decimal] โ€” stops the search the moment the absolute optimality gap drops under the value you gave. tl;dr you get solutions with a guaranteed absolute approximation โ€” approximation with receipts ๐Ÿ’–
  • -D โ€” approximate zero-cost solution count with BTD. like, she's estimating the count, be normal about it ๐Ÿ™ˆ
  • -logz โ€” computes the log of probability of evidence (that's the log partition function, or log(Z), or the PR task if you're fancy). โš ๏ธ restricted to stochastic graphical models (.uai format only), so don't try it on anything else bestie, she will simply not ๐Ÿšซ
  • -seed=[integer] โ€” seeds the pseudo-random generator inside toulbar2 with a fixed non-negative integer. give her a negative argument instead and she'll seed the generator from the current time. default value is 1 ๐ŸŽฒ
  • --stdin=[format] โ€” says "read the problem from standard input instead of a file." default format is cfn. like for example: cat example.uai | toulbar2 --stdin=uai โ€” chef's kiss, pipes are her love language ๐Ÿ
  • -timer=[integer] โ€” a cpu-time limit in seconds. toulbar2 stops once that much CPU time has been consumed. and listen โ€” this is a CPU user time limit, not a wall clock time limit. they are not the same thing and she will not pretend they are โฐ

๐Ÿงผ PREPROCESSING ๐Ÿงผ

  • -nopre โ€” deactivates all the preprocessing options. it's equivalent to -e: -p: -t: -f: -dec: -n: -mst: -dee: -trws:. a full skincare cleanse, everything off ๐Ÿงด
  • -p=[integer] โ€” preprocessing only: activates variable elimination of variables with degree less than or equal to the value you give. default is -1, which means no elimination performed at all โœ‚๏ธ
  • -t=[integer] โ€” preprocessing only: simulates restricted path consistency by adding ternary cost functions on triangles of binary cost functions, within a given maximum space limit in MB ๐Ÿ“
  • -f=[integer] โ€” preprocessing only: variable elimination of functional variables (f=1) or bijective variables (f=2). default value is 1 ๐Ÿ”
  • -dec โ€” preprocessing only: pairwise decomposition of cost functions with arity larger than 3 into smaller arity cost functions. default: activated ๐Ÿฐ (slice it up)
  • -n=[integer] โ€” preprocessing only: projects n-ary cost functions onto all binary cost functions if n is lower than the value given. default value is 10 ๐Ÿงฎ
  • -mst โ€” finds a maximum spanning tree ordering for DAC ๐ŸŒณ
  • -M=[integer] โ€” applies the Min Sum Diffusion algorithm. default is off, with a number of iterations of 0 ๐Ÿ’ซ

๐ŸŽฏ INITIAL UPPER BOUNDING ๐ŸŽฏ

  • -ub=[decimal] โ€” gives a primal bound (that's upper in minimization mode, lower otherwise) on the cost that a solution must satisfy. if the file also specifies a primal bound, then the tightest of the two wins. a tight primal bound can speed up the search, or you can pair it with -a to find all solutions of sufficient quality ๐Ÿ’…
  • -l=[integer] โ€” activates limited discrepancy search. use a negative value to stop the search after the given absolute number of discrepancies have been explored. discrepancy bound default is 4 ๐Ÿ”
  • -L=[integer] โ€” activates randomized search (quasi-random variable ordering) with restart. maximum number of nodes default is 10000 ๐ŸŽฐ
  • -i=["string"] โ€” uses the initial upper bound found by the INCOP local search solver. the string parameter is optional, and by default it's "0 1 3 idwa 100000 cv v 0 200 1 0 0", with this meaning: stoppinglowerbound randomseed nbiterations method nbmoves neighborhoodchoice neighborhoodchoice minnbneighbors maxnbneighbors neighborhoodchoice autotuning tracemode ๐Ÿง 
  • -pils=["string"] โ€” uses the initial upper bound found by the PILS local search solver. the string parameter is optional, and by default it's "3 0 0.333 100 500 10000 0.1 0.5 0.1 0.1", with this meaning: nbruns perturb_mode perturb_strength flatMaxIter nbEvalHC nbEvalMax strengthMin strengthMax incrFactor decrFactor ๐ŸŽˆ
  • -x=[(,i=a)*] โ€” assigns variable of index i to value a. multiple assignments get separated by a comma and no space, she's strict about that. without any argument, a complete assignment is read from the default file sol โ€” or from a filename given directly as an additional input filename with a .sol extension and without -x โ€” and it's used as an initial upper bound and as a value ordering heuristic ๐Ÿ“

๐ŸŒณ TREE SEARCH ALGORITHMS AND TREE DECOMPOSITION SELECTION ๐ŸŒณ

  • -hbfs=[integer] โ€” uses hybrid best-first search, restarting from the root after a given number of backtracks. default value is 10000 ๐Ÿ”„
  • -open=[integer] โ€” sets the hybrid best-first search limit on the number of stored open nodes. default value is -1, which means no limit ๐Ÿšช
  • -B=[integer] โ€” picks your algorithm: (0) DFBB, (1) BTD, (2) RDS-BTD, (3) RDS-BTD with path decomposition instead of tree decomposition. default value is 0 ๐ŸŽ›๏ธ
  • -O=[filename] โ€” reads a variable elimination order from a file, in order to build a tree decomposition (if BTD-like and/or variable elimination methods are used). the order is also used as a DAC ordering ๐Ÿ“‚
  • -O=[negativeinteger] โ€” builds a tree decomposition (if BTD-like and/or variable elimination methods are used) and a compatible DAC ordering, using one of these:
    • (-1) maximum cardinality search ordering
    • (-2) minimum degree ordering
    • (-3) minimum fill-in ordering,
    • (-4) maximum spanning tree ordering (see -mst),
    • (-5) reverse Cuthill-Mckee ordering,
    • (-6) approximate minimum degree ordering.

if you don't specify one, then the order in which variables appear in the problem file is used ๐Ÿ—‚๏ธ

  • -j=[integer] โ€” splits large clusters into a chain of smaller embedded clusters, with a number of proper variables less than this number. use options "-B=3 -j=1 -svo -k=1" for pure RDS, and use value 0 for no splitting. default value is 0 ๐Ÿ”ช
  • -r=[integer] โ€” sets a limit on the maximum cluster separator size (otherwise she merges the cluster with its father). use a negative value for no limit. default value is -1 ๐Ÿงฒ
  • -X=[integer] โ€” sets a limit on the minimum number of proper variables in a cluster (otherwise she merges the cluster with its father). use 0 for no limit. default value is 0 ๐Ÿ“
  • -E=[float] โ€” merges leaf clusters with their fathers if the local treewidth is small (used together with option -e and a positive threshold value), or if the ratio of separator variables to cluster variables is above a given threshold (used together with option -vns). default value is 0 ๐Ÿƒ
  • -R=[integer] โ€” chooses a specific cluster number as the root cluster ๐Ÿ‘‘
  • -I=[integer] โ€” solves only a specific rooted cluster subtree. RDS-BTD only, don't get any ideas elsewhere ๐Ÿ™…

  • -vns โ€” unified decomposition guided variable neighborhood search. a problem decomposition can be given as *.dec, *.cov, or *.order input files, or by using tree decomposition options such as -O ๐Ÿ—บ๏ธ
  • -vnsini=[integer] โ€” where the initial solution for VNS-like methods comes from: (-1) at random, (-2) min domain values, (-3) max domain values, (-4) first solution found by a complete method, or (k=0 or more) tree search with k discrepancy max. default is -4 ๐ŸŽฒ
  • -ldsmin=[integer] โ€” minimum discrepancy for VNS-like methods. 1 by default ๐Ÿ“‰
  • -ldsmax=[integer] โ€” maximum discrepancy for VNS-like methods. default is the number of problem variables multiplied by maximum domain size, minus 1 ๐Ÿ“ˆ
  • -ldsinc=[integer] โ€” discrepancy increment strategy for VNS-like methods, using (1) Add1, (2) Mult2, or (3) Luby operator. 2 by default โš™๏ธ
  • -kmin=[integer] โ€” minimum neighborhood size for VNS-like methods. 4 by default ๐Ÿ˜๏ธ
  • -kmax=[integer] โ€” maximum neighborhood size for VNS-like methods. default is the number of problem variables ๐ŸŒ†
  • -kinc=[integer] โ€” neighborhood size increment strategy for VNS-like methods, using (1) Add1, (2) Mult2, (3) Luby operator, or (4) Add1/Jump. 4 by default ๐Ÿชœ
  • -best=[integer] โ€” stop VNS-like methods if a better solution is found. default value is 0 ๐Ÿ†

๐Ÿ”ฅ NODE PROCESSING & BOUNDING OPTIONS ๐Ÿ”ฅ

  • -e=[integer] โ€” performs "on the fly" variable elimination of variables with small degree (less than or equal to a specified value). default is 3, which creates a maximum of ternary cost functions ๐Ÿ’ฅ
  • -k=[integer] โ€” sets the soft local consistency level enforced at preprocessing and at each node during search:
    • 0: Node Consistency with Strong Node Inverse Consistency for global cost functions,
    • 1: Generalized Arc Consistency
    • 2: Directed Generalized Arc Consistency
    • 3: Full Directed Generalized Arc Consistency
    • 4: (weak) Existential Directed Generalized Arc Consistency

default value is 4 ๐Ÿงš

  • -A=[integer] โ€” enforces Virtual Arc Consistency at each search node with a search depth less than the value given. default value is 0, which enforces VAC only at the root node ๐ŸŒฑ
  • -T=[decimal] โ€” threshold cost value for VAC. default value is 1 ๐ŸŽš๏ธ
  • -P=[decimal] โ€” threshold cost value for VAC during the preprocessing phase. default value is 1 ๐ŸŽš๏ธ
  • -C=[float] โ€” multiplies all costs internally by this number when loading the problem. default value is 1 โœ–๏ธ
  • -S โ€” preprocessing only: performs singleton consistency (only in conjunction with option -A) โ˜๏ธ
  • -trws=[float] โ€” preprocessing only: enforces TRW-S until a given precision is reached. default value is 0.00001 ๐ŸŽฏ
  • --trws-n-iters=[integer] โ€” preprocessing only: enforces at most N iterations of TRW-S. default value is 1000 ๐Ÿ”

ok bestie we're not done yet, there's more where that came from, don't go anywhere ๐ŸŒˆ

  • --trws-n-iters-no-change=[integer] โ€” preprocessing only, bestie โœจ stops TRW-S when N iterations did not move the lower bound up to the given precision. Default value is 5, and -1=never (so -1 means never stop, go off king ๐Ÿ’…).
  • --trws-n-iters-compute-ub=[integer] โ€” again preprocessing only: computes UB every N steps in TRW-S. Default value is 100. ๐ŸŽ€
  • -dee=[integer] โ€” enforces restricted dead-end elimination, or value pruning by dominance rule from EAC value (dee>=1 and dee<=3) and soft neighborhood substitutability, in preprocessing (dee=2 or dee=4) or during search (dee=3). Default value is 1. it's giving pruning, periodt โœ‚๏ธ
  • -o โ€” ensures an optimal worst-case time complexity of Directed and Existential Arc Consistency (can be slower in practice, no cap, just being honest ๐Ÿซถ).

๐ŸŒˆ BRANCHING, VARIABLE & VALUE ORDERING ๐ŸŒˆ

the glow-up section, truly ๐Ÿ’–

  • -svo โ€” use a static variable ordering heuristic. The variable order used will be the same order as the DAC order. โœจ
  • -b โ€” use binary branching (as a default) instead of k-ary branching. Uses binary branching for interval domains and small domains and dichotomic branching for large enumerated domains (see option -d). ๐Ÿฆ‹
  • -c โ€” use binary branching with last conflict backjumping variable ordering heuristic. ๐Ÿ’…
  • -q=[integer] โ€” use weighted degree variable ordering heuristic if the number of cost functions is less than the given value (default value is 10000). ๐Ÿ‘‘
  • -var=[integer] โ€” searches by branching only on the first [given value] decision variables, assuming the remaining variables are intermediate variables that will be completely assigned by the decision variables (use a zero if all variables are decision variables). Default value is 0. ๐ŸŽ€
  • -m=[integer] โ€” use a variable ordering heuristic that preferably selects variables such that the sum of the mean (m=1) or median (m=2) cost of all incident cost functions is maximum (in conjunction with weighted degree heuristic -q). Default value is 0: unused. ๐ŸŒธ
  • -d=[integer] โ€” searches using dichotomic branching. The default d=1 splits domains in the middle of domain range while d=2 splits domains in the middle of the sorted domain based on unary costs. โœ‚๏ธ
  • -sortd โ€” sort domains in preprocessing based on increasing unary costs (works only for binary CFN). ๐Ÿ“
  • -solr โ€” use solution-based phase saving as a value ordering heuristic (default option). ๐Ÿ’œ
  • -V โ€” VAC-based value ordering heuristic (default option, only in conjunction with option "-A"). โญ

โœจ CONSOLE OUTPUT โœจ

  • -help โ€” show default help message that toulbar2 prints when it gets no argument. ๐Ÿ™ˆ
  • -v=[integer] โ€” set the verbosity level (default 0). ๐Ÿ”ฅ
  • -Z=[integer] โ€” debug mode (save problem at each node if verbosity option -v=num>= 1 and -Z=num>=3). ๐Ÿ’€
  • -s=[integer] โ€” shows each solution found during search. The solution is printed on one line. The default -s=1 gives the value (integer) of each variable successively in increasing order of definition in the model file. For -s=2, the value name is used instead, for -s=3, variable name=valuename is printed instead. ๐Ÿ‘‘

๐ŸŽ€ FILE OUTPUT ๐ŸŽ€

  • -w=[filename] โ€” writes last solution found in the specified filename (or "sol" if no parameter is given). The current directory is used as a relative path. ๐Ÿ’พ
  • -z=[filename] โ€” saves problem in wcsp format in filename (or "problem.wcsp" if no parameter is given). Writes also the graphviz .dot file and the degree distribution of the input problem. ๐ŸŒˆ
  • -z=[integer] โ€” 1: saves original instance (by default), 2: saves after preprocessing (this option can be used in combination with -z=filename). โœจ

๐Ÿงš PROBABILITY REPRESENTATION AND NUMERICAL CONTROL ๐Ÿงš

  • -precision=[integer] โ€” probability/real log10 precision conversion factor (a power of ten) for representing probabilities as fixed decimal point numbers. Default value is 7. ๐Ÿ’–
  • -epsilon=[float] โ€” approximation factor for computing the partition function (default value is 1000 representing epsilon=1/1000). ๐ŸŒธ
  • -qpmult=[double] โ€” coefficient multiplier for quadratic terms when reading qpbo format (default value is 2). ๐Ÿ’…

๐Ÿฆ‹ RANDOM PROBLEM GENERATION ๐Ÿฆ‹

  • -random=[benchprofile] โ€” benchmark profile must be specified as follows, where n and d are respectively the number of variable and the maximum domain size of the random problem. ๐ŸŽฒ
bin-{n}-{d}-{t1}-{p2}-{seed}
  • t1 is the tightness in percentage of random binary cost functions
  • p2 is the number of binary cost functions to include
  • the seed parameter is optional
binsub-{n}-{d}-{t1}-{p2}-{p3}-{seed}

binary random submodular cost functions

  • t1 is the tightness in percentage of random cost functions
  • p2 is the number of binary cost functions to include
  • p3 is the percentage of submodular cost functions among p2 cost functions (plus 10 permutations of two randomly-chosen values for each domain).
tern-{n}-{d}-{t1}-{p2}-{p3}-{seed}
  • p3 is the number of ternary cost functions
nary-{n}-{d}-{t1}-{p2}-{p3}...-{pn}-{seed}
  • pn is the number of n-ary cost functions
salldiff-{n}-{d}-{t1}-{p2}-{p3}...-{pn}-{seed}
  • pn is the number of salldiff global cost functions (p2 and p3 still being used for the number of random binary and ternary cost functions). salldiff can be replaced by gcc or regular keywords with three possible forms (e.g., sgcc, sgccdp, wgcc).

๐Ÿ’œ FILE FORMATS ๐Ÿ’œ

toulbar2 can read .cfn, .wcsp, .uai, .LG, .cnf, .wcnf, .qpbo, .pre, .bep files. The files can be compressed with gzip or xz (e.g., .cfn.gz or .cfn.xz, except for pre and bep formats). See the full user documentation for a description of these file formats. ๐Ÿ“‚

quick vibe check: pre and bep do not do the compression thing, bestie, don't try it ๐Ÿ™ˆ

๐ŸŒŸ SEE ALSO ๐ŸŒŸ

A more complete user documentation should be available on your system, in /usr/share/doc/toulbar2/userdoc.pdf or can be otherwise downloaded from http://miat.inrae.fr/toulbar2. ๐Ÿ“–


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

See https://github.com/toulbar2/toulbar2. ๐Ÿซถ


and that's a wrap on TOULBAR2(1) bestie ๐Ÿ’– go forth and solve, you absolute main character โœจ๐Ÿ‘‘๐Ÿ’…

๐Ÿ“ฆ where this page comes from