0

I have tried to solve this linear programming problem:

max cx : Ax <= b, x >= 0

Here is a snippet for this nice LPP solver :

public static LPP myExample() throws Exception {
        return new LPP(
                "Max",
                new String[] {},
                new double[] {1,1,1,1,1,1,1,1,1,1,1,1},
                new double[][] {
                        {1,0,1,1,1,1,1,2,2,2,2,2},
                        {2,1,0,0,1,1,1,1,2,2,2,2},
                        {2,2,1,0,0,0,1,1,1,2,2,2},
                        {2,2,2,1,0,0,0,1,1,1,2,2},
                        {2,2,2,2,1,0,0,0,0,1,1,2},
                        {2,2,2,2,2,0,0,0,0,0,1,1},
                        {2,2,2,2,2,2,0,0,0,0,0,0},
                        {2,2,2,2,2,2,2,0,0,0,0,0},
                        {2,2,2,2,2,2,2,2,0,0,0,0},
                        {2,2,2,2,2,2,2,2,2,0,0,0},
                        {2,2,2,2,2,2,2,2,2,2,0,0},
                        {2,2,2,2,2,2,2,2,2,2,2,0},
                },
                new String[] {"²", "²", "²", "²", "²", "²", "²", "²", "²", "²", "²", "²"},
                new double[] {1,1,1,1,1,1,1,1,1,1,1,1},
                0);
    }

where third parameter is 'c', fourth is 'A' and sixth is 'b'. Fifth gives the direction '<='.

I have tried also these:

http://algs4.cs.princeton.edu/65reductions/Simplex.java.html

and

http://lpsolve.sourceforge.net/5.5/

The first one threw 'The given LPP is unbounded' error. The last two gave this result:

primal: {0.0, 0.1, 0.1, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3}

and value: 0.8.

I used these for various other examples and got the same results.

What is the right solution? What did I miss?

Sonia
  • 325
  • 1
  • 12
  • The LPP solver project is said to be in "early alpha development". Maybe thats why. – Christian Sep 26 '13 at 06:55
  • Yes, that's a good guess. Also the 'Princeton' solver fails on similar set of constraints throwing also 'unbounded'. I tried also Common Math 3.2 simplexSolver, which seem to work and gives the same values than lp_solver. – Sonia Sep 27 '13 at 05:57

0 Answers0