package com.imsl.test.example.math; import com.imsl.math.*; /** *

* Solves a linear programming problem.

* * The linear programming problem in the standard form *

* $${\rm {min}} \,\, f(x) = -x_1 + -3x_2$$

*

* subject to:

* *

* \(x_1 + x_2 + x_3 = 1.5\)
* \(x_1 + x_2 - x_4 = 0.5\)
* \(x_1 + x_5 = 1.0\)
* \(x_2 + x_6 = 1.0\)
* \(x_i \ge 0, \,\,\,\, {\rm {for}} \,\,\, i = 1, \ldots , 6\)

*

* is solved.

* * * @see Code * @see Output * */ public class DenseLPEx1 { 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}; DenseLP zf = new DenseLP(a, b, c); zf.solve(); new PrintMatrix("Solution").print(zf.getPrimalSolution()); } }