Skip to content

Improve error handling in linear_programming/simplex.py #14591

Description

@jgohel9902

Feature description

The run_simplex() method in linear_programming/simplex.py silently returns an empty dict {} when the maximum iteration limit (maxiter=100) is reached, making it impossible for callers to distinguish between a cycling problem and an actual empty solution.

Suggested improvement:
Replace the silent return {} with a descriptive ValueError:

raise ValueError(
f"Simplex did not converge within {Tableau.maxiter} iterations. "
"The problem may be cycling or unbounded."
)

This would make debugging significantly easier for users of this module.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions