Skip to content
cpbenchy 0.1.0.dev0 is in alpha: until version 1.0, commands, options, the Python API and the result format may still change. Pin the version you use.

PBOutput

Answers in the format of the Pseudo-Boolean competition.

Updated View as Markdown
ObserverBuilt incomes with cpbenchy
cpbenchy run instances/ -s ortools -t 60 -p cpbenchy.observers:PBOutput
Version
cpbenchy 0.1.0.dev0
Last updated
6 Oct 2026 · 1 commit
Authors
ThomSerg
Formats
opb
Tags
pseudo-booleancompetitionoutput

What it does

Writes what a solver in the Pseudo-Boolean competition prints, for each run on an OPB instance. The solution is a line with every variable as a literal:

o -7
o -9
s OPTIMUM FOUND
v x1 x2 -x3 x4

Each competition specifies what a solver prints:

  • o lines with each better objective value, while it solves
  • an s line with its answer: OPTIMUM FOUND, SATISFIABLE, UNSATISFIABLE or UNKNOWN
  • v lines with the solution

The output goes to each run’s logs/<run_id>.pb.out, written inside the measured run, as a competition solver would print it, so it costs the run the time it would cost in the competition. A run that is killed keeps its o lines. Under cpbenchy solve, the output goes to stdout, where competitions read it.

Variables that occur in no constraint still get a value, from the number of variables in the instance’s header (* #variable= ...).

Use it

The PB rules enable it, with the competition’s limits.

What it records

logs/<run_id>.pb.out the competition output

Implementation

The PBOutput in src/cpbenchy/observers.py, lines 95–102 of 222, as of this version of the docs.

src/cpbenchy/observers.pypython
class PBOutput(CompetitionOutput):
    """Pseudo-Boolean competition output: every variable as `x1` or `-x1`."""

    name = "pb"
    formats = ("opb",)

    def solution(self, ctx):
        return [" ".join(fmt.literals(*numbered(ctx), prefix="x"))]
Navigation

Type to search…

↑↓ navigate↵ selectEsc close