Skip to content

Respect delta tolerance in Prune and forward it from pruned Determinize. - #430

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/1025691073
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
copybara/1025691073

Conversation

@copybara-service

Copy link
Copy Markdown

Respect delta tolerance in Prune and forward it from pruned Determinize.

Prune previously compared path weights against the pruning limit with exact NaturalLess, ignoring PruneOptions::delta. Pruned Determinize also omitted opts.delta when calling ShortestDistance and Prune. With floating-point weights, residual quantization in Determinize or Times rounding can push an optimal path slightly above the exact limit and prune it.

Compare final and arc path weights within opts.delta via ApproxEqual in both Prune overloads, and forward opts.delta in pruned Determinize. Also guard weight_threshold below Weight::One() and unset start states up front in destructive Prune, matching constructive Prune.

`Prune` previously compared path weights against the pruning limit with exact `NaturalLess`, ignoring `PruneOptions::delta`. Pruned `Determinize` also omitted `opts.delta` when calling `ShortestDistance` and `Prune`. With floating-point weights, residual quantization in `Determinize` or `Times` rounding can push an optimal path slightly above the exact limit and prune it.

Compare final and arc path weights within `opts.delta` via `ApproxEqual` in both `Prune` overloads, and forward `opts.delta` in pruned `Determinize`. Also guard `weight_threshold` below `Weight::One()` and unset start states up front in destructive `Prune`, matching constructive `Prune`.

PiperOrigin-RevId: 1025691073
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant