Skip to content

fix(set_cover): initialize thread_pool_ and remove stale ThreePhase declaration (fixes #5341) - #5375

Open
jdymitarai wants to merge 2 commits into
google:mainfrom
jdymitarai:fix/set-cover-lagrangian-segfault-and-stale-decl
Open

fix(set_cover): initialize thread_pool_ and remove stale ThreePhase declaration (fixes #5341)#5375
jdymitarai wants to merge 2 commits into
google:mainfrom
jdymitarai:fix/set-cover-lagrangian-segfault-and-stale-decl

Conversation

@jdymitarai

Copy link
Copy Markdown

Description

Fixes #5341.

This PR addresses two issues in ortools/set_cover/set_cover_lagrangian:

  1. Remove stale ThreePhase declaration:

    • set_cover_lagrangian.h declared void ThreePhase(Cost upper_bound); with no corresponding definition in ortools/set_cover (the three-phase algorithm was migrated to set_cover_cft.cc as RunThreePhase).
    • Calling or binding &SetCoverLagrangian::ThreePhase leads to link-time or runtime symbol import errors (undefined symbol: _ZN19operations_research18SetCoverLagrangian10ThreePhaseEd). The stale declaration is removed.
  2. Initialize thread_pool_ to prevent SIGSEGV in ComputeLowerBound:

    • Previously, thread_pool_ was initialized to nullptr in constructors unless UseNumThreads() was explicitly called prior to ComputeLowerBound(). Uninitialized thread_pool_ dereferences resulted in a segmentation fault when parallel methods scheduled tasks.
    • Initialized thread_pool_ with this->params().num_threads in constructors, and added a defensive guard in ComputeLowerBound() ensuring thread_pool_ is initialized if null.

Testing

  • Added regression test SetCoverTest.LagrangianComputeLowerBoundDefaultThreadPool in ortools/set_cover/set_cover_test.cc verifying that ComputeLowerBound() executes successfully on a fresh SetCoverLagrangian without requiring UseNumThreads().
  • Updated ortools/set_cover/BUILD.bazel to include :set_cover_lagrangian in set_cover_test dependencies.

@Mizux Mizux added Bug Solver: Set Cover Solver in set_cover/ labels Sep 11, 2026
@Mizux
Mizux requested a review from bdb-git September 11, 2026 08:08
@Mizux Mizux added this to the v10.0 milestone Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Solver: Set Cover Solver in set_cover/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants