The quadratic programming problem is to minimize
subject to
import com.imsl.math.*; public class QuadraticProgrammingEx2 { public static void main(String args[]) { double h[][] = { {2, 0, 0}, {0, 2, 0}, {0, 0, 2} }; double aeq[][] = {{1, 2, -1}, {1, -1, 1}}; double beq[] = {4, -2}; double g[] = {0, 0, 0}; try { QuadraticProgramming qp = new QuadraticProgramming(h, g, aeq, beq, null, null); // Print the solution and its dual new PrintMatrix("x").print(qp.getSolution()); new PrintMatrix("dual").print(qp.getDual()); } catch (Exception e) { System.out.println(e.getMessage()); } } }
x 0 0 0.286 1 1.429 2 -0.857 dual 0 0 1.143 1 -0.571Link to Java source.