Skip to content

This is two cpp program that one of them for solving Linear Programing(LP) problem with simplex method print step by step simplex tables. it also supports both Big M method and Two-Phase method for artifical variable. another one get primal from user and show dual form of LP problems.

Notifications You must be signed in to change notification settings

younesious/Simplex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sipmlex

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.

Table of Contents

  • Introduction
  • Features
  • Usage
    • Primal LP Solver (simplex.cpp)
    • Dual LP Generator and Solver (dual.cpp)
  • Installation
  • Contributing
  • License

Introduction

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.

Features

Primal LP Solver (simplex.cpp)

  • 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.

Dual LP Generator (dual.cpp)

  • 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.

Usage

Primal LP Solver (simplex.cpp)

  1. Compile the simplex.cpp file using a C++ compiler:
g++ simplex.cpp -o simplex
  1. Run the compiled executable:
./simplex
  1. Follow the on-screen prompts to input the details of the primal LP problem.

Dual LP Generator and Solver (dual.cpp)

  1. Compile the dual.cpp file using a C++ compiler:
g++ dual.cpp -o dual
  1. Run the compiled executable:
./dual
  1. Follow the on-screen prompts to input the details of the primal LP problem.

Installation

No installation is required. Simply compile the C++ files using a C++ compiler.

Contributing

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.

License

This project is licensed under the MIT License.

About

This is two cpp program that one of them for solving Linear Programing(LP) problem with simplex method print step by step simplex tables. it also supports both Big M method and Two-Phase method for artifical variable. another one get primal from user and show dual form of LP problems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages