user1668047
user1668047

Reputation: 11

Linear Programming: Reading LP from text and solving it using the simplex method

I want to design a console application (in visual studio 2010 C#) that can read an LP from a textfile and then solve it using the simplex method.

Example of textfile:

"max 4 5"

"9 8 <= 45"

"5 1 <= 29"

"1 7 <= 15"

The numbers represent the coefficients of the decision variables (eg. 6 7 8 will represent 6x1 + 7x2 + 8x3)

It should then write to/create an output file containing the optimal solution and the values of the decision variables.

I was thinking of using a two-dimensional array.

Any thoughts on how to "import" the LP from the textfile to the program and to convert the equations in standard form, ready to be inserted to the 2D array which will act as my tableu.

Upvotes: 1

Views: 2422

Answers (1)

Ali
Ali

Reputation: 58501

You are sort of re-inventing the wheel.

The MPS format is a de facto standard.

I personally prefer the CPLEX LP format.

See also the ILOG CPLEX File Formats or the File Formats Reference Manual for other formats.

I know that it seems easy and simple to implement the simplex tableu method. Unless you do it for fun and to learn, I seriously suggest you don't do that.

It takes years and significant experience to implement a production quality simplex method. I would use a simplex solver instead, for example GLPK, SoPlex, Clp or lpsolve.

Upvotes: 1

Related Questions