subject to:
is solved.
import com.imsl.math.*; public class LinearProgrammingEx1 { public static void main(String args[]) throws Exception { double[][] a = { {1.0, 1.0, 1.0, 0.0, 0.0, 0.0}, {1.0, 1.0, 0.0, -1.0, 0.0, 0.0}, {1.0, 0.0, 0.0, 0.0, 1.0, 0.0}, {0.0, 1.0, 0.0, 0.0, 0.0, 1.0} }; double[] b = {1.5, 0.5, 1.0, 1.0}; double[] c = {-1.0, -3.0, 0.0, 0.0, 0.0, 0.0}; LinearProgramming zf = new LinearProgramming(a, b, c); zf.solve(); new PrintMatrix("Solution").print(zf.getPrimalSolution()); } }
Solution 0 0 0.5 1 1 2 0 3 1 4 0.5 5 0Link to Java source.