-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Add linear programming implementation using the simplex method #11928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add linear programming implementation using the simplex method #11928
Conversation
for more information, see https://pre-commit.ci
Hi, it's been a few days since I submitted this pull request. I just wanted to check in to see if there is anything else needed from my end for the review process. Thank you |
@MohdFuzailHaider There is already a simplex algorithm, https://github.com/TheAlgorithms/Python/blob/master/linear_programming/simplex.py Is this method substantially different to that of the pre-existing implementation? |
Thank you for the feedback! Upon reviewing the existing implementation in simplex.py, I believe my code offers several improvements that enhance readability, maintainability, and performance: Modularity and Structure: My implementation uses an object-oriented approach with the Tableau class, separating concerns into distinct methods (pivot, find_pivot_column, find_pivot_row, etc.). This makes the code easier to follow, debug, and maintain. Efficiency: I’ve used NumPy for efficient matrix operations, which provides a performance advantage for larger problems. The pivoting operation, for instance, is handled in a vectorized manner, improving execution speed compared to basic Python loops. Extensibility: The modular design of my code allows for easier future extensions. For example, introducing different pivoting rules or handling degeneracy would require minimal changes. Error Handling: My code explicitly raises an error when the linear program is unbounded, improving robustness and making debugging simpler. Solution Extraction: The extract_solution method clearly identifies basic variables, ensuring that the solution is correctly extracted from the tableau. I believe these enhancements could be beneficial, particularly for larger or more complex linear programming problems. |
Describe your change:
Checklist: