Git Product home page Git Product logo

two-phase-simplex's Introduction

Two Phase Simplex:

Two Phase Simplex tableau method for the linear programming model

Input Format:

The first line of input will contain a string 'MAX' or 'MIN' followed by the number of constraints N. The next line will contain the coefficients for the objective function. The next N lines will contain the coefficients ai1 , ai2 , ..., for the i th constraint.

Constraint:

Note that this method assumes that all the constraints are of '<=' form. So, if a constraint is of '>=' form, convert it to '<=' form by changing the sign of the constraint. This doesn't affect the optimal point or the optimal value. For example:

'x1 + 2x2 >= 14' is equivalent to '-x1 - 2x2 <= -14'

How to use ??

python simplex_2Ph.py

Test Cases:

Below is a list of examples and the corresponding input to the code:

===================
1. Maximize:	
	20x1 + 10x2
    s.t:	
x1  - x2 <= 1
3x1 + x2 <= 7

Input: 
MAX 2
20 10
1 -1 1
3 1 7

===================
2. Maximize:    
3x1 + 4x2
    s.t:	
2x1 + x2  <= 600
x1  + x2  <= 225
5x1 + 4x2 <= 1000
x1  + 2x2 >= 150

Input:
MAX 4
3 4
2 1 600
1 1 225
5 4 1000
-1 -2 -150

===================
3. Minimize:	
x - x2
s.t:	
x1  + x2 >= 2
	-x1 + x2 >= 1
x2 <= 3

Input:
	MIN 3
1 -2
-1 -1 -2
1 -1 -1
0 1 3

===================
4. Minimize:	
2x1 + 3x2
s.t:	
	4x1 + 2x2 >= 12
x1  + 4x2 >= 6

Input:
	MIN 2
2 3
-4 -2 -12
-1 -4 -6

Contact :

Irshad Ahmad Bhat
MS-CSE IIITH, Hyderabad
[email protected]
[email protected]

two-phase-simplex's People

Contributors

irshadbhat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.