Skip to content

Speed up list_frontdoor_adjustment with a bool-array find oracle - #181

Open
SimonAB wants to merge 1 commit into
mschauer:masterfrom
SimonAB:frontdoor-list-enumerator
Open

Speed up list_frontdoor_adjustment with a bool-array find oracle#181
SimonAB wants to merge 1 commit into
mschauer:masterfrom
SimonAB:frontdoor-list-enumerator

Conversation

@SimonAB

@SimonAB SimonAB commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keeps ConstraintIterator for list_frontdoor_adjustment (same O(n(n+m))-delay enumeration as before; Wienöbst et al. 2024, Corollary 1).
  • Uses a bool-array Algorithm-2 find (cf. mwien/frontdoor-adjustment) as the listing oracle instead of the gensearch-based find_frontdoor_adjustment.
  • Public find_frontdoor_adjustment / find_min_frontdoor_adjustment are unchanged.
  • Version bump to 0.19.5.
  • Discussion and benchmarks: closes the follow-up in Related packages / ecosystem note #180.

Motivation

@mwien correctly noted on #180 that the package already implements the delay enumerator. Local microbenchmarks (parity-checked) found that swapping only the find oracle for listing gives about a wall-clock improvement under heavy enumeration, with only a modest allocation drop.

Test plan

  • Existing test/gensearch.jl frontdoor list fixtures (g1/g2)
  • Full CausalInference test suite locally
  • CI green on this PR

Made with Cursor

Keep ConstraintIterator (O(n(n+m)) delay) but use a Wienöbst/mwien-style
bool-array Algorithm-2 find for listing, which was ~2× faster than the
gensearch find under heavy enumeration in local benchmarks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI lite review requested due to automatic review settings August 12, 2026 20:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes list_frontdoor_adjustment enumeration performance by swapping the listing feasibility oracle from the existing gensearch-based find_frontdoor_adjustment to a bool-array (Algorithm 2) implementation, while keeping the same ConstraintIterator enumeration approach and public find_* APIs unchanged.

Changes:

  • Replace deep copies with shallow copy in ConstraintIterator iteration to reduce overhead.
  • Introduce a bool-array frontdoor “find oracle” and use it for list_frontdoor_adjustment.
  • Bump package version to 0.19.5.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/gensearch.jl Adds a bool-array frontdoor oracle and wires it into list_frontdoor_adjustment; reduces iterator copying overhead.
Project.toml Version bump to 0.19.5.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/gensearch.jl
Comment on lines 501 to 504
function list_frontdoor_adjustment(g, X, Y, I = Set{eltype(g)}(), R = setdiff(Set(vertices(g)), X, Y))
X, Y, I, R = toset.((X, Y, I, R))
return ConstraintIterator(g, X, Y, I, R, find_frontdoor_adjustment)
return ConstraintIterator(g, X, Y, I, R, _find_frontdoor_adjustment_bool)
end
@mschauer

Copy link
Copy Markdown
Owner

Thank you for the PR, I think I have to be careful here. Let's move in smaller steps, otherwise, as LLMs are involved I'll not be able to keep up reviewing. Sorry for not signaling this better yesterday.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants