In the quadratic programming problem variables 2 and 6 are fixed at the value zero by the equality constraints. The inequalities propose that the sums of the variables are at least 5.1 and no more than 4.9. These last two are inconsistent conditions, causing the InconsistentSystemException to be thrown.
import com.imsl.math.*; public class QuadraticProgrammingEx3 { public static void main(String[] args) { double[][] h = { {2.000, 0.000, 0.000, 0.000, 0.000, 0.000}, {0.000, 2.000, 0.000, 0.000, 0.000, 0.000}, {0.000, 0.000, 2.000, 0.000, 0.000, 0.000}, {0.000, 0.000, 0.000, 2.000, 0.000, 0.000}, {0.000, 0.000, 0.000, 0.000, 2.000, 0.000}, {0.000, 0.000, 0.000, 0.000, 0.000, 2.000} }; double[] g = {5.000, 5.000, 5.000, 5.000, 5.000, 5.000}; double[][] aEquality = { {0.000, 1.000, 0.000, 0.000, 0.000, 0.000}, {0.000, 0.000, 0.000, 0.000, 0.000, 1.000} }; double[] bEquality = {0.000, 0.000}; double[][] aInequality = { {1.000, 1.000, 1.000, 1.000, 1.000, 1.000}, {-1.000, -1.000, -1.000, -1.000, -1.000, -1.000} }; double delta = 0.1; // change to 0.0 to pass double[] bInequality = {5 + delta, -5 + delta}; try { QuadraticProgramming qp = new QuadraticProgramming(h, g, aEquality, bEquality, aInequality, bInequality); double x[] = qp.getSolution(); new com.imsl.math.PrintMatrix("Solution").print(x); } catch (Exception e) { System.out.println("No solution for the LP problem was found. " + "All constraints are not\nsatisfied. L1 minimization " + "was applied to all constraints (including\nbounds and" + "simple variables) but the equalities, to approximate\n" + "violated non-equalities as well as possible. If a " + "feasible\nsolution is possible then try using " + "refinement."); } } }
No solution for the LP problem was found. All constraints are not satisfied. L1 minimization was applied to all constraints (including bounds andsimple variables) but the equalities, to approximate violated non-equalities as well as possible. If a feasible solution is possible then try using refinement.Link to Java source.