Skip to content

Fix custom solver Model initialization - #431

Open
h-g-s wants to merge 1 commit into
masterfrom
fix-issue-388-custom-solver
Open

h-g-s wants to merge 1 commit into
masterfrom
fix-issue-388-custom-solver

Conversation

@h-g-s

@h-g-s h-g-s commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #388 by ensuring the package name is bound in Model.init when a caller supplies a solver instance. The backend-selection branches use package submodule imports, which make mip local to the function; a supplied solver skips those branches and previously caused UnboundLocalError when the constructor initialized its lists. Adds a regression test matching the reported custom SolverCbc subclass pattern and verifies the provided solver is retained. The change preserves lazy backend imports. Related: #389 contains the same minimal fix proposal; this PR includes the regression test.

Add regression coverage for initializing a Model with a supplied solver instance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@h-g-s

h-g-s commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Hi @stranma — I reproduced #388 and opened this PR with the fix plus a regression test. Could you try it with your original custom-solver setup and confirm whether it resolves the issue? Thanks!

This branch has not been deployed

No deployments
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.

Incorrect imports in Model

1 participant