Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command reference

Every command accepts --json for structured output, -o FILE to save JSON, and -q to silence informational messages. pred <command> --help lists all flags; this page shows one example per command.

Catalog

pred list
pred show MIS
pred list --rules

list reports every problem with its aliases, variants, and reduction counts. show describes the resolved variant, its parameter fields, input schema, and incoming and outgoing reductions. Read that schema before constructing an instance.

Example: pred show MIS
MaximumIndependentSet/SimpleGraph/One
  Find maximum weight independent set in a graph
  Best Known Complexity: O(1.1996^num_vertices)

Inputs (2):
  graph (Vec<(usize,usize)>)
  num_vertices (usize) [optional]

Parameters (2):
  num_edges
  num_vertices

Outgoing reductions (6):
  → MaximumSetPacking/One  (num_sets <= num_vertices, universe_size <= num_edges)
  → MaximumIndependentSet/SimpleGraph/i64  (num_edges = num_edges, num_vertices = num_vertices)
  → MaximumIndependentSet/KingsSubgraph/One  (num_edges <= 11 * num_vertices^2, num_vertices <= 5 * num_vertices^2)
  → MaximumClique/SimpleGraph/One  (num_edges = -1 * num_edges + num_vertices * (-1 + num_vertices) * 2^-1, num_vertices = num_vertices)
  → MaximumIndependentSet/TriangularSubgraph/i64  (num_edges <= 108 * num_vertices + 108 * num_vertices^2, num_vertices <= 36 * num_vertices + 36 * num_vertices^2)
  → DecisionMaximumIndependentSet/SimpleGraph/One  (num_edges = num_edges, num_vertices = num_vertices)

Incoming reductions (5):
  MaximumSetPacking/One →  (num_edges <= num_sets^2, num_vertices <= num_sets)
  MaximumIndependentSet/UnitDiskGraph/One →  (num_edges = num_edges, num_vertices = num_vertices)
  LongestCommonSubsequence →  (num_edges <= cross_frequency_product^2, num_vertices <= cross_frequency_product)
  MaximumClique/SimpleGraph/One →  (num_edges = -1 * num_edges + num_vertices * (-1 + num_vertices) * 2^-1, num_vertices = num_vertices)
  DecisionMaximumIndependentSet/SimpleGraph/One →  (num_edges = num_edges, num_vertices = num_vertices)

Names and variants

pred show MIS/SimpleGraph/i64
pred path MIS/SimpleGraph/i64 ILP/bool

Aliases such as MIS resolve to full names, and a bare name selects the declared default variant: MIS is MaximumIndependentSet/SimpleGraph/One. Slash-separated parameters select graph, weight, or other variant values. One means unit weights; passing non-unit --weights to create upgrades a default instance to i64. Name the exact variant when a reproducible endpoint matters.

AliasFull Name
2SATKSatisfiability
3-PartitionThreePartition
3DMThreeDimensionalMatching
3PartitionThreePartition
3SATKSatisfiability
BCNFBoyceCoddNormalFormViolation
BCNFViolationBoyceCoddNormalFormViolation
CBMConsecutiveBlockMinimization
CBQConjunctiveBooleanQuery
CMOMaximumContactMapOverlap
CVPClosestVectorProblem
CliqueKClique
D2CIFDirectedTwoCommodityIntegralFlow
DHPDirectedHamiltonianPath
DMISDecisionMaximumIndependentSet
DMVCDecisionMinimumVertexCover
DOLADecisionOptimalLinearArrangement
FASMinimumFeedbackArcSet
FVSMinimumFeedbackVertexSet
HCHamiltonianCircuit
IndependentSetDecisionMaximumIndependentSet
KSATKSatisfiability
LCSLongestCommonSubsequence
MAX2SATMaximum2Satisfiability
MCCMinimumCostCirculation
MCESMaximumCommonEdgeSubgraph
MCMFMinimumCostMaximumFlow
MCPPMixedChinesePostman
MCSTMinimumCapacitatedSpanningTree
MECFMinimumEdgeCostFlow
MGBMinimumGraphBandwidth
MISMaximumIndependentSet
MVCMinimumVertexCover
MaxCMOMaximumContactMapOverlap
MaxMatchingMaximumMatching
MaximumBipartiteSubgraphMaxCut
MinDNFMinimumDisjunctiveNormalForm
N3DMNumerical3DimensionalMatching
NAESATNAESatisfiability
NMTSNumericalMatchingWithTargetSums
OCSTOptimumCommunicationSpanningTree
OLAOptimalLinearArrangement
POKPartiallyOrderedKnapsack
QAPQuadraticAssignment
QBFQuantifiedBooleanFormulas
QDEQuadraticDiophantineEquations
RPPRuralPostman
SATSatisfiability
SCSShortestCommonSupersequence
SCSSShortestCommonSuperstring
TSPTravelingSalesman
VCDecisionMinimumVertexCover
VertexCoverDecisionMinimumVertexCover
WangTilingSquareTiling
X3CExactCoverBy3Sets
pCenterMinMaxMulticenter
pmedianMinimumSumMulticenter

Paths

pred path MIS ILP
pred path MIS QUBO --limit 50
pred path MIS QUBO --json -o paths.json
pred from MIS --hops 2
pred to QUBO

path enumerates witness-capable simple routes between exact endpoints, without ranking. --limit accepts 1 through 999, or all for 999; the default is 20. JSON output contains paths and truncated. from and to explore outgoing and incoming neighbors.

Example: a multi-step path from Factoring to SpinGlass
Found 3 paths from Factoring to SpinGlass:

--- Path 1 ---
Path (3 steps): Factoring → CircuitSAT → DecisionSpinGlass/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64

  Step 1: Factoring → CircuitSAT
    num_assignment_outputs <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_assignments <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_expression_nodes <= 5 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)
    num_variables <= 1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second

  Step 2: CircuitSAT → DecisionSpinGlass/SimpleGraph/i64
    num_interactions <= num_assignment_outputs + 6 * num_expression_nodes
    num_spins <= num_variables + 3 * num_expression_nodes

  Step 3: DecisionSpinGlass/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64
    num_interactions = num_interactions
    num_spins = num_spins

  Overall:
    num_interactions <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 30 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)
    num_spins <= 1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 15 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)

--- Path 2 ---
Path (6 steps): Factoring → CircuitSAT → Satisfiability → DecisionMaximum2Satisfiability → Maximum2Satisfiability → MaxCut/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64

  Step 1: Factoring → CircuitSAT
    num_assignment_outputs <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_assignments <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_expression_nodes <= 5 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)
    num_variables <= 1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second

  Step 2: CircuitSAT → Satisfiability
    num_clauses <= 2 * num_assignment_outputs + 8 * num_expression_nodes
    num_literals <= 4 * num_assignment_outputs + 24 * num_expression_nodes
    num_vars <= num_variables + 2 * num_expression_nodes

  Step 3: Satisfiability → DecisionMaximum2Satisfiability
    num_clauses <= 10 * (num_literals + 3 * num_clauses)
    num_vars <= num_vars + 2 * num_literals + 4 * num_clauses

  Step 4: DecisionMaximum2Satisfiability → Maximum2Satisfiability
    num_clauses = num_clauses
    num_vars = num_vars

  Step 5: Maximum2Satisfiability → MaxCut/SimpleGraph/i64
    num_edges <= (1 + num_vars)^2
    num_vertices <= 1 + num_vars

  Step 6: MaxCut/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64
    num_interactions = num_edges
    num_spins = num_vertices

  Overall:
    num_interactions <= 1 + 2 * (1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 426 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)) + (1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 426 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second))^2
    num_spins <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 426 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)

--- Path 3 ---
Path (6 steps): Factoring → CircuitSAT → Satisfiability → NAESatisfiability → DecisionMaxCut/SimpleGraph/i64 → MaxCut/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64

  Step 1: Factoring → CircuitSAT
    num_assignment_outputs <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_assignments <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second
    num_expression_nodes <= 5 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)
    num_variables <= 1 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second

  Step 2: CircuitSAT → Satisfiability
    num_clauses <= 2 * num_assignment_outputs + 8 * num_expression_nodes
    num_literals <= 4 * num_assignment_outputs + 24 * num_expression_nodes
    num_vars <= num_variables + 2 * num_expression_nodes

  Step 3: Satisfiability → NAESatisfiability
    num_clause_variables <= num_clauses + num_literals
    num_clauses = num_clauses
    num_literal_pairs <= num_clauses + num_literals * (1 + num_literals) * 2^-1
    num_literals <= num_literals + 2 * num_clauses
    num_vars = 1 + num_vars

  Step 4: NAESatisfiability → DecisionMaxCut/SimpleGraph/i64
    num_edges <= num_vars + -7 * num_clauses + 4 * num_literals
    num_vertices <= 2 * (num_literals + num_vars + -2 * num_clauses)

  Step 5: DecisionMaxCut/SimpleGraph/i64 → MaxCut/SimpleGraph/i64
    num_edges = num_edges
    num_vertices = num_vertices

  Step 6: MaxCut/SimpleGraph/i64 → SpinGlass/SimpleGraph/i64
    num_interactions = num_edges
    num_spins = num_vertices

  Overall:
    num_interactions <= 2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 842 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)
    num_spins <= 2 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second + 10 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)) + 416 * (2 + 2 * (num_bits_first + num_bits_second) + 6 * num_bits_first * num_bits_second)

Parameter transforms declare exact equalities, upper bounds, or unavailable relations. A discovered route does not imply the target is cheap to solve; inspect the constructed target on representative instances.

Create

pred create MIS --graph 0-1,1-2,2-3 -o problem.json
pred create MIS/SimpleGraph/i64 --graph 0-1,1-2,2-3 --weights 2,1,3,1 -o weighted.json
pred create --example MVC/SimpleGraph/i64 --to MIS/SimpleGraph/i64 -o source.json
pred create MIS --random --num-vertices 10 --edge-prob 0.3 --seed 42 -o random.json

Flags follow the schema field names in kebab-case: universe_size becomes --universe-size. Vertices use zero-based indices and --graph is a comma-separated edge list. --example loads a canonical model fixture, or with --to the source side of a documented reduction example (--example-side target for the other side). --random generates a graph instance; save the JSON so the instance can be reproduced.

Other input structures:

pred create SAT --num-vars 3 --clauses '1,2;-1,3' -o sat.json          # signed one-based literals; ';' separates clauses
pred create QUBO --matrix '1,1;0,2' -o qubo.json                    # ';' separates rows
pred create X3C --universe-size 6 --subsets '0,1,2;3,4,5;0,3,4' -o x3c.json
pred create Factoring --target 6 --m 2 --n 2 -o factoring.json

Inspect and evaluate

pred inspect problem.json
pred evaluate problem.json --config '[true,false,true,false]'
pred create MIS --graph 0-1,1-2,2-3 | pred evaluate - --config '[true,false,true,false]'

inspect reports the resolved variant and sizes of a problem file or reduction bundle. evaluate scores one configuration: selecting vertices 0 and 2 returns Max(2), while selecting adjacent vertices returns Max(None). Configurations follow each problem’s variable domains and are not always binary. - reads from stdin.

For a problem file, JSON inspection includes parameter_values, the model’s actual named instance parameters. These are separate from the parameters list of parameter names.

Reduce

pred create DecisionMinimumVertexCover --graph 0-1,1-2,0-2 --weights 1,1,1 --bound 2 -o decision-mvc.json
pred path DecisionMinimumVertexCover MinimumVertexCover --json -o paths.json
python3 -c 'import json; print(json.dumps(json.load(open("paths.json"))["paths"][0]))' > path.json
pred reduce decision-mvc.json --via path.json --aggregate -o reduced.json
pred extract reduced.json --value 2
pred extract reduced.json --config '[true,true,false]' -o source-solution.json
pred reduce decision-mvc.json --via path.json --aggregate | pred extract - --value 2

The bundle contains the source instance, the target instance, and the variant-level path; keep it whole to preserve solution recovery. --via replays one route extracted from the paths envelope, whose source variant must match the input.

extract calls the reduction rules’ existing mappings. Supply exactly one input:

  • --config: a target configuration, passed through extract_solution in reverse path order. Returns the source configuration and its evaluation.
  • --value: a completed target aggregate, passed through extract_value in reverse path order. Returns the mapped source value, without a witness.

For example, the rule from DecisionMinimumVertexCover with bound 1 to MinimumVertexCover maps target optimum 2 to source value false. Its witness mapping cannot produce a cover of size at most 1 from a two-vertex cover; that mapping returns an error. These are the rule’s two distinct contracts.

The triangle above has minimum cover size 2, so both extractions certify YES. --value takes raw JSON such as 2, true, or null, without wrappers such as Min(2). Extraction requires no status, runs no solver, and does not prove that a supplied aggregate is complete or optimal. Unsupported mappings and malformed inputs are errors. pred solve reduced.json still handles completed solver results internally.

Aggregate-only paths can be constructed with pred reduce --aggregate and recovered with pred extract --value through AggregateReductionChain::extract_value.

Solve

pred solve problem.json
pred solve problem.json --solver brute-force
pred solve reduced.json --timeout 30 --json
SolverBehavior
ilpExecutes the exact variant’s registered fixed ILP pipeline and recovers its source solution
brute-forceEnumerates all configurations; for tiny instances and cross-checks
customizedExact structure-exploiting backends for selected models; see pred solve --help

Default dispatch tries registered customized, ILP, then brute-force capabilities in that order. pred inspect lists the capabilities available for the exact variant. Solving a bundle solves its target and maps the result back; every successful solve returns a solution. A discovered path does not by itself provide a registered solver. Evaluate the returned solution on the original instance to verify its value.

JSON and pipes

pred create MIS --graph 0-1,1-2,2-3 | pred reduce - --via path.json | pred solve - --json
pred export-graph -o reduction_graph.json

Check the exit status before consuming a result, and enable set -o pipefail in scripts. Keep type and variant with each instance; an alias alone does not identify an exact endpoint. The site publishes reduction_graph.json and problem_schemas.json from the same registry; the local export-graph describes the installed version.

Shell completions

eval "$(pred completions bash)"        # ~/.bashrc
eval "$(pred completions zsh)"         # ~/.zshrc
pred completions fish | source         # ~/.config/fish/config.fish

Without an argument, pred completions detects the current shell.