The quadratic programming problem is to minimize
subject to
import com.imsl.math.*; public class QuadraticProgrammingEx1 { public static void main(String args[]) throws QuadraticProgramming.InconsistentSystemException { double h[][] = { {2, 0, 0, 0, 0}, {0, 2,-2, 0, 0}, {0,-2, 2, 0, 0}, {0, 0, 0, 2,-2}, {0, 0, 0,-2, 2}, }; double aeq[][] = { { 1, 1, 1, 1, 1}, { 0, 0, 1,-2,-2} }; double beq[] = {5, -3}; double g[] = {-2, 0, 0, 0, 0}; 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()); } }
x 0 0 1 1 1 2 1 3 1 4 1 dual 0 0 0 1 -0 2 0 3 0 4 0Link to Java source.