diff scripts/optimization/glpk.m @ 22224:20e0c0b8820c

Allow sequential quadratic programs with infeasible QPs (bug #36015). * qp.m: Use conformant sizes of temporary C and lower bound in call to glpk. * glpk.m: State size of A if its size doesn't match C and lb. * sqp.m: If the QP was infeasible, restore lambda to the correct size.
author Lachlan Andrew <lachlanbis@gmail.com>
date Sat, 27 Feb 2016 16:16:36 +1100
parents ecce63c99c3f
children 42456fc9bf6c
line wrap: on
line diff
--- a/scripts/optimization/glpk.m	Thu Feb 11 21:06:45 2016 +1100
+++ b/scripts/optimization/glpk.m	Sat Feb 27 16:16:36 2016 +1100
@@ -498,9 +498,13 @@
   if (isempty (A))
     error ("glpk: A cannot be an empty matrix");
   endif
+  if (! isreal (A))
+    error ("glpk: A must be real valued, not %s", typeinfo (A));
+  endif
   [nc, nxa] = size (A);
-  if (! isreal (A) || nxa != nx)
-    error ("glpk: A must be a real valued %d by %d matrix", nc, nx);
+  if (nxa != nx)
+    error ("glpk: A must be %d by %d, not %d by %d",
+           nc, nx, rows(A), columns(A));
   endif
 
   ## 3) RHS