Skip to content

Give pred path --all real Big-O output: delete the O(<raw expr>) fallback and JSON text rendering #1079

Description

@isPANN

Background

Issue #1069: pred path --all used to OOM/hang because Big-O rendering fully expanded composed overhead expressions. A stopgap now caps expansion, but the CLI's failure path (problemreductions-cli/src/commands/graph.rs:349) falls back to printing the raw unreduced expression disguised as O(...), and path_all builds the text rendering unconditionally even in --json mode (both named in #1069). With big_o_normal_form now backed by the growth domain (#1078), every polynomial/linear-exponential path has a real answer, so the fallback and the wasted rendering can go — and #1069 can close with regression tests that pin the fix.

Full design (shared overview for this batch): docs/design/symbolic-growth-domain.md, sections M2/M4 and Quality requirements.

Objective

Delete the O(<raw expr>) fallback and the unconditional text rendering in JSON mode; add the regression, budget, and determinism tests that make #1069's failure mode structurally impossible to reintroduce. Closes #1069.

Interface (Input → Output)

  • pred path <S> <T> --all [--max-paths N] (text): every listed path shows either a genuinely normalized O(...) per size field or an explicit annotation (e.g. not normalized: <reason>) — never a multi-hundred-character raw expression.
  • pred path ... --all --json: emits JSON without constructing the text rendering.
  • New tests: (1) a regression test that reconstructs pred path --all OOMs/hangs: big_o_normal_form exponentially expands composed overhead expressions #1069's exploding path (KSatisfiability → Satisfiability → KSatisfiability → DecisionMinimumVertexCover → HamiltonianCircuit → QuadraticAssignment → ILP → QUBO) via compose_path_overhead and asserts big_o_normal_form returns a genuine normal form; (2) a whole-graph budget test rendering Big-O for all paths returned by find_paths_up_to on representative hot pairs; (3) a golden-file determinism test for pred path KSat QUBO --all text output.

Technical recommendations (non-binding)

  • Build the exploding path in the regression test by name (compose the edges via the graph API) rather than hard-coding the 2113-char expression, so the test tracks inventory changes.
  • Keep each test < 5 s (repo policy).
  • The golden test normalizes nothing: byte-exact comparison is the point (growth-term ordering is deterministic by construction from Add growth domain (src/growth.rs): growth terms, antichain, symbolic dominance #1075).

Verification

  1. time pred path KSat QUBO --all (a release or debug build — state which in the test) completes in < 1 s and its output contains no line longer than 200 characters — which proves no raw-expression fallback remains.
  2. cargo test issue_1069 runs the three new tests green.
  3. Behavioral JSON check: pred path KSat QUBO --all --json | python3 -m json.tool > /dev/null exits 0, and the JSON contains a Big-O entry for every path element.

Negative control: the golden determinism test, when fed an output with two terms deliberately swapped (fixture included in the test), fails — proving the byte-exact comparison has teeth. Additionally, grep -n 'format!("O({})"' problemreductions-cli/src/commands/graph.rs returns nothing and the behavioral checks above still pass — proving the fallback was removed, not relocated.

Dependencies

Depends on #1078. Milestone: Symbolic Growth Domain & Pareto Search. Closes #1069.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions