我试图解决这个线性规划问题:
max cx : Ax <= b, x >= 0
这是这个不错的LPP 求解器的片段:
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);
    }
其中第三个参数是'c',第四个是'A',第六个是'b'。第五给出方向'<='。
我也试过这些:
http://algs4.cs.princeton.edu/65reductions/Simplex.java.html
和
我不能在这里写它,因为我的声誉太低(http: slash slash lpsolve dot sourceforge dot net slash 5.5 slash)
第一个抛出“给定的 LPP 是无限的”错误。最后两个给出了这个结果:
原始的:{0.0, 0.1, 0.1, 0.0, 0.0, 0.3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3}
和价值:0.8。
我将这些用于其他各种示例并得到了相同的结果。
什么是正确的解决方案?我错过了什么?