Skip to content

Make pred inspect report reductions for the exact input variant #1114

Description

@isPANN

Background

Reduction availability is defined by a complete problem variant, not only by its model name. For example, MinimumDominatingSet<SimpleGraph, One> has a direct reduction to MinimumHittingSet, while MinimumDominatingSet<SimpleGraph, i32> does not.

pred inspect currently aggregates outgoing reductions at the model-name level. It can therefore advertise a reduction that cannot be executed for the inspected instance. The mismatch was reproduced in the PR #1105 agentic review report on the PR #1083 branch.

Objective

Make pred inspect compute reduces_to from the inspected instance's fully normalized variant. Every advertised target must be executable by pred reduce under the same default witness-capable path semantics.

Interface (Input → Output)

In: a serialized problem instance containing a canonical problem name and complete variant map.

Out: text and JSON pred inspect results whose reduces_to entries apply to that exact source variant. Edges registered only for sibling variants must not appear.

Technical recommendations

problemreductions-cli/src/commands/inspect.rs currently obtains outgoing reductions with a name-level graph query. Resolve the loaded instance to its exact reduction-graph node and derive targets from that node, using the same variant and witness-capability rules as pred reduce. Keep the implementation direct; do not add a parallel capability registry or compatibility layer.

Verification

Build the CLI and inspect the default weighted MinimumDominatingSet example. It is the SimpleGraph/i32 variant and must not advertise the unit-weight-only target:

cargo build -p problemreductions-cli --bin pred --locked
PRED_BIN=target/debug/pred

"$PRED_BIN" create --example MinimumDominatingSet -o /tmp/mds-i32.json
"$PRED_BIN" inspect /tmp/mds-i32.json --json \
  | jq -e '.variant.weight == "i32" and ((.reduces_to | index("MinimumHittingSet")) == null)'

if "$PRED_BIN" reduce /tmp/mds-i32.json --to MinimumHittingSet -o /tmp/mds-i32-bundle.json; then
  echo 'unexpected reduction success' >&2
  exit 1
fi

Both checks must exit 0: inspection omits the unavailable target, and direct reduction rejects it.

Negative control: the exact unit-weight rule example must retain the reduction in inspect, and the advertised operation must succeed:

"$PRED_BIN" create --example MinimumDominatingSet/SimpleGraph/One \
  --to MinimumHittingSet -o /tmp/mds-one.json
"$PRED_BIN" inspect /tmp/mds-one.json --json \
  | jq -e '.variant.weight == "One" and ((.reduces_to | index("MinimumHittingSet")) != null)'
"$PRED_BIN" reduce /tmp/mds-one.json --to MinimumHittingSet -o /tmp/mds-one-bundle.json

Add focused CLI regression coverage for both variants and run make check.

Out of scope

  • Adding a weighted MinimumDominatingSet<i32> → MinimumHittingSet reduction.
  • Changing model aliases or canonical-example selection.
  • Redesigning solver capability reporting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions