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?