Skip to content

Improve error handling in linear_programming/simplex.py #14591

@jgohel9902

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.

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