Simlex is a C++ implementation of the Simplex method for solving linear programming (LP) problems. The repository includes two files: simplex.cpp
for solving primal LP problems and dual.cpp
for generating the dual LP problem.
- Introduction
- Features
- Usage
- Primal LP Solver (simplex.cpp)
- Dual LP Generator and Solver (dual.cpp)
- Installation
- Contributing
- License
The Simplex method is an iterative optimization algorithm for solving linear programming problems. The primal LP solver simplex.cpp
takes user input for a linear programming problem and uses the Simplex method to find the optimal solution. The dual LP generator dual.cpp
automatically generate the dual LP problem corresponding to the given primal LP problem.
- Solves linear programming problems (maximization or minimization) using the Simplex method.
- Handles constraints of the form <=, >=, and =.
- Allows the user to input coefficients for the objective function, constraint coefficients, signs, and RHS values.
- Supports both Big M method and Two-Phase method for solving LP problems.
- Automatically generates the dual LP problem for a given primal LP problem.
- This file accepts primal LP problem input from user handles problems with >=, <=, and = constraints, handles free variables marked "R".
- Converts the primal LP problem to conventional form before generating the dual.
- Compile the simplex.cpp file using a C++ compiler:
g++ simplex.cpp -o simplex
- Run the compiled executable:
./simplex
- Follow the on-screen prompts to input the details of the primal LP problem.
- Compile the dual.cpp file using a C++ compiler:
g++ dual.cpp -o dual
- Run the compiled executable:
./dual
- Follow the on-screen prompts to input the details of the primal LP problem.
No installation is required. Simply compile the C++ files using a C++ compiler.
Contributions are welcome! Feel free to open issues or submit pull requests. For example, you can write some parts with a cleaner struct, or some functions have become too long, they can be shortened to help the reusability of the program, and any safe refactor for achieve clean code. And finally, if you develop the bigM part, it will be great for more than two variables.
This project is licensed under the MIT License.