Constraints not met

View: New views
2 Messages — Rating Filter:   Alert me  

Constraints not met

by Rungta, Prerna :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Dear Octave Team,

I am a new user of Octave and am using this to optimise a series of
small qp problems. I have encountered some problems while using the qp
program. I used octave to run the attached optimisation problem and
received an output with info = 3, however, on analysing the data I
noticed that the solution was not convergent and the constraints not
met.

I am attaching the problem file and the output file. Is this a bug? Any
help is most appreciated.

Prerna Rungta

Assistant Consultant

Steer Davies Gleave
28-32 Upper Ground, London SE1 9PD

d. +44 (0)20 7910 5262
t. +44 (0)20 7919 8500
f. +44 (0)20 7827 9850
e. prerna.rungta@...
w. www.steerdaviesgleave.com



GNU Octave, version 3.0.0
Copyright (C) 2007 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "i686-pc-msdosmsvc".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/help-wanted.html

Report bugs to <bug@...> (but first, please read
http://www.octave.org/bugs.html to learn how to write a helpful report).

For information about changes from previous versions, type `news'.

 - Use `pkg list' to see a list of installed packages.
 - SciTE editor installed. Use `edit' to start the editor.
 - MSYS shell available (C:\Program Files\Octave\msys).
 - Graphics backend: jhandles.

ans =

   2008.0000      5.0000      2.0000     10.0000     54.0000     16.4376

ans =

   2008.0000      5.0000      2.0000     10.0000     54.0000     16.5474

x =

  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  8.3519e-003
  -7.0564e-003
  0.0000e+000
  9.8128e-003
  9.2615e-003
  -1.5015e+000
  -2.7337e-002
  0.0000e+000
  -1.2128e-002
  -1.2238e-002
  7.8379e-002
  -4.8628e-019
  -1.3377e+000
  -2.1832e+000
  1.4705e+000
  1.3382e-001
  -9.0461e+002
  4.5434e-012
  0.0000e+000
  6.3147e+003
  1.2053e-012
  2.4608e+003
  -1.5591e-013
  -1.0093e+003
  3.8637e+003
  2.2604e+003
  4.9278e-012
  3.0209e+002
  -1.9546e+003
  1.6097e+003
  -6.6934e+003
  -2.4185e-012
  1.8534e+004
  2.2194e+003
  -9.7795e+002
  -3.6031e+003
  -1.0788e+004
  2.8063e+003
  -3.1766e+003
  1.8027e+003
  -1.9895e+003
  -1.6187e+003
  0.0000e+000
  0.0000e+000
  -4.0107e-018
  -1.8923e-011
  3.7106e+004
  1.5420e+004
  -2.3103e-018
  2.0636e-018
  1.3314e-027
  -1.0097e-028
  0.0000e+000
  0.0000e+000
  4.0176e-027
  0.0000e+000
  -7.4258e-019
  -4.6154e-017
  4.8170e-017
  2.1035e-027
  3.3041e-019
  -7.8734e-028
  0.0000e+000
  -2.3732e-018
  -4.0576e+003
  0.0000e+000
  -1.8952e+003
  1.8261e+000
  0.0000e+000
  -1.0879e+001
  -5.9598e-001
  2.2607e+003
  -3.7456e-004
  1.6836e+001
  -4.1238e-013
  -2.5195e+002
  -1.6071e+003
  -1.6699e+003
  -1.6333e+003
  3.0644e+000
  6.7028e+002
  -1.6190e+002
  9.4127e+003
  -1.6448e+003
  1.2306e+004
  -9.8581e+001
  6.9424e+002
  5.0967e+002
  -2.7865e+003
  2.4440e+003
  7.8791e+002
  1.9857e+004
  6.3525e+003
  -7.7558e+003
  7.3211e+002
  -2.6012e+003
  -4.0772e+003
  -2.8835e+003
  -1.4988e+004
  9.9352e+002
  2.1889e+003
  2.4539e+002
  0.0000e+000
  1.7034e+004
  -1.5558e+004
  2.1126e+001
  6.5941e+000
  8.7416e+001
  1.0936e+004
  1.8555e+004
  -3.6189e+002
  2.4233e-001
  3.2132e+003
  9.8289e+003
  1.3901e+004
  5.9703e-011
  -5.2920e+003
  -8.3474e+000
  2.2347e+001
  5.3809e+003
  5.6439e+002
  0.0000e+000
  -3.6026e+002
  -6.5540e+002
  0.0000e+000
  0.0000e+000
  2.5203e+004
  1.9921e+003
  -4.4439e+002
  -7.6753e+002
  -1.1587e+003
  -4.0266e+002
  0.0000e+000
  4.9477e+003
  -3.2902e+002
  0.0000e+000
  -1.0560e+002
  2.5933e+003
  4.6976e+002
  -8.0840e+002
  2.7420e-003

obj = 2.6587e+009
info =
{
  solveiter =  229
  info = 0
}

lambda =

  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.0233e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  6.5000e-002
  9.3000e-002
  0.0000e+000
  8.7857e-002
  1.2340e-001
  1.2500e-001
  1.1100e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  0.0000e+000
  1.6567e-001
  1.7700e-001
  8.6333e-002
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.4500e-001
  5.2000e-002
  1.6771e-001
  1.7220e-001
  1.7700e-001
  1.3500e-001
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1916e+000
  2.1761e+000
  2.1832e+000
  2.1930e+000
  2.1925e+000
  6.8171e-001
  2.1559e+000
  2.1832e+000
  2.1711e+000
  2.1710e+000
  2.2616e+000
  2.1832e+000
  8.4553e-001
  0.0000e+000
  3.6537e+000
  2.3170e+000
  9.8831e+003
  1.0788e+004
  1.0788e+004
  1.7102e+004
  1.0788e+004
  1.3248e+004
  1.0788e+004
  9.7784e+003
  1.4651e+004
  1.3048e+004
  1.0788e+004
  1.1090e+004
  8.8331e+003
  1.2397e+004
  4.0943e+003
  1.0788e+004
  2.9322e+004
  1.3007e+004
  9.8097e+003
  7.1846e+003
  0.0000e+000
  1.3594e+004
  7.6111e+003
  1.2590e+004
  8.7982e+003
  2.4389e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.1164e+004
  1.9477e+004
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0575e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  0.0000e+000
  4.0576e+003
  8.9132e+002
  2.7883e+003
  2.7865e+003
  2.7756e+003
  2.7859e+003
  5.0472e+003
  2.7865e+003
  2.8033e+003
  2.7865e+003
  2.5346e+003
  1.1794e+003
  1.1166e+003
  1.1532e+003
  2.7896e+003
  3.4568e+003
  2.6246e+003
  1.2199e+004
  1.1417e+003
  1.5092e+004
  2.6879e+003
  3.4807e+003
  3.2962e+003
  0.0000e+000
  5.2305e+003
  3.5744e+003
  3.5415e+004
  2.1910e+004
  7.8017e+003
  1.6290e+004
  1.2956e+004
  1.1480e+004
  1.2674e+004
  5.6954e+002
  1.6551e+004
  1.7747e+004
  1.5803e+004
  1.5558e+004
  3.2591e+004
  0.0000e+000
  1.5579e+004
  1.5564e+004
  1.5645e+004
  2.6494e+004
  3.4113e+004
  1.5196e+004
  1.5558e+004
  1.8771e+004
  2.5387e+004
  2.9459e+004
  1.5558e+004
  0.0000e+000
  5.2836e+003
  5.3143e+003
  1.0673e+004
  5.8563e+003
  5.2920e+003
  4.9317e+003
  4.6366e+003
  5.2920e+003
  5.2920e+003
  3.0494e+004
  7.2841e+003
  4.8476e+003
  4.5244e+003
  4.1333e+003
  4.8893e+003
  5.2920e+003
  1.0240e+004
  4.9629e+003
  5.2920e+003
  5.1864e+003
  7.8853e+003
  5.7617e+003
  4.4835e+003
  5.2920e+003
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  1.2500e-001
  1.7700e-001
  2.1832e+000
  1.0788e+004
  4.0576e+003
  2.7865e+003
  1.5558e+004
  5.2920e+003

ans =

   2008.0000      5.0000      2.0000     10.0000     54.0000     28.8950

info =
{
  solveiter =  229
  info = 0
}

ans =

  0.0000e+000
  0.0000e+000
  -3.3710e+000
  1.1077e+004
  4.6850e+004
  1.7346e+004
  5.5728e+004
  3.0841e+004

lambda =

  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  1.0233e-001
  1.2500e-001
  1.2500e-001
  1.2500e-001
  6.5000e-002
  9.3000e-002
  0.0000e+000
  8.7857e-002
  1.2340e-001
  1.2500e-001
  1.1100e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  0.0000e+000
  1.6567e-001
  1.7700e-001
  8.6333e-002
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.7700e-001
  1.4500e-001
  5.2000e-002
  1.6771e-001
  1.7220e-001
  1.7700e-001
  1.3500e-001
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1832e+000
  2.1916e+000
  2.1761e+000
  2.1832e+000
  2.1930e+000
  2.1925e+000
  6.8171e-001
  2.1559e+000
  2.1832e+000
  2.1711e+000
  2.1710e+000
  2.2616e+000
  2.1832e+000
  8.4553e-001
  0.0000e+000
  3.6537e+000
  2.3170e+000
  9.8831e+003
  1.0788e+004
  1.0788e+004
  1.7102e+004
  1.0788e+004
  1.3248e+004
  1.0788e+004
  9.7784e+003
  1.4651e+004
  1.3048e+004
  1.0788e+004
  1.1090e+004
  8.8331e+003
  1.2397e+004
  4.0943e+003
  1.0788e+004
  2.9322e+004
  1.3007e+004
  9.8097e+003
  7.1846e+003
  0.0000e+000
  1.3594e+004
  7.6111e+003
  1.2590e+004
  8.7982e+003
  2.4389e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.1164e+004
  1.9477e+004
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0575e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  4.0576e+003
  0.0000e+000
  4.0576e+003
  8.9132e+002
  2.7883e+003
  2.7865e+003
  2.7756e+003
  2.7859e+003
  5.0472e+003
  2.7865e+003
  2.8033e+003
  2.7865e+003
  2.5346e+003
  1.1794e+003
  1.1166e+003
  1.1532e+003
  2.7896e+003
  3.4568e+003
  2.6246e+003
  1.2199e+004
  1.1417e+003
  1.5092e+004
  2.6879e+003
  3.4807e+003
  3.2962e+003
  0.0000e+000
  5.2305e+003
  3.5744e+003
  3.5415e+004
  2.1910e+004
  7.8017e+003
  1.6290e+004
  1.2956e+004
  1.1480e+004
  1.2674e+004
  5.6954e+002
  1.6551e+004
  1.7747e+004
  1.5803e+004
  1.5558e+004
  3.2591e+004
  0.0000e+000
  1.5579e+004
  1.5564e+004
  1.5645e+004
  2.6494e+004
  3.4113e+004
  1.5196e+004
  1.5558e+004
  1.8771e+004
  2.5387e+004
  2.9459e+004
  1.5558e+004
  0.0000e+000
  5.2836e+003
  5.3143e+003
  1.0673e+004
  5.8563e+003
  5.2920e+003
  4.9317e+003
  4.6366e+003
  5.2920e+003
  5.2920e+003
  3.0494e+004
  7.2841e+003
  4.8476e+003
  4.5244e+003
  4.1333e+003
  4.8893e+003
  5.2920e+003
  1.0240e+004
  4.9629e+003
  5.2920e+003
  5.1864e+003
  7.8853e+003
  5.7617e+003
  4.4835e+003
  5.2920e+003
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  1.2500e-001
  1.7700e-001
  2.1832e+000
  1.0788e+004
  4.0576e+003
  2.7865e+003
  1.5558e+004
  5.2920e+003

A_ub =

   0.00000
   0.00000
   0.00000
   2.28000
   0.65000
   0.02000
   0.03000
   0.00000

A_lb =

   0.00000
   0.00000
   0.00000
   2.28000
   0.65000
   0.02000
   0.03000
   0.00000

x =

  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  0.0000e+000
  8.3519e-003
  -7.0564e-003
  0.0000e+000
  9.8128e-003
  9.2615e-003
  -1.5015e+000
  -2.7337e-002
  0.0000e+000
  -1.2128e-002
  -1.2238e-002
  7.8379e-002
  -4.8628e-019
  -1.3377e+000
  -2.1832e+000
  1.4705e+000
  1.3382e-001
  -9.0461e+002
  4.5434e-012
  0.0000e+000
  6.3147e+003
  1.2053e-012
  2.4608e+003
  -1.5591e-013
  -1.0093e+003
  3.8637e+003
  2.2604e+003
  4.9278e-012
  3.0209e+002
  -1.9546e+003
  1.6097e+003
  -6.6934e+003
  -2.4185e-012
  1.8534e+004
  2.2194e+003
  -9.7795e+002
  -3.6031e+003
  -1.0788e+004
  2.8063e+003
  -3.1766e+003
  1.8027e+003
  -1.9895e+003
  -1.6187e+003
  0.0000e+000
  0.0000e+000
  -4.0107e-018
  -1.8923e-011
  3.7106e+004
  1.5420e+004
  -2.3103e-018
  2.0636e-018
  1.3314e-027
  -1.0097e-028
  0.0000e+000
  0.0000e+000
  4.0176e-027
  0.0000e+000
  -7.4258e-019
  -4.6154e-017
  4.8170e-017
  2.1035e-027
  3.3041e-019
  -7.8734e-028
  0.0000e+000
  -2.3732e-018
  -4.0576e+003
  0.0000e+000
  -1.8952e+003
  1.8261e+000
  0.0000e+000
  -1.0879e+001
  -5.9598e-001
  2.2607e+003
  -3.7456e-004
  1.6836e+001
  -4.1238e-013
  -2.5195e+002
  -1.6071e+003
  -1.6699e+003
  -1.6333e+003
  3.0644e+000
  6.7028e+002
  -1.6190e+002
  9.4127e+003
  -1.6448e+003
  1.2306e+004
  -9.8581e+001
  6.9424e+002
  5.0967e+002
  -2.7865e+003
  2.4440e+003
  7.8791e+002
  1.9857e+004
  6.3525e+003
  -7.7558e+003
  7.3211e+002
  -2.6012e+003
  -4.0772e+003
  -2.8835e+003
  -1.4988e+004
  9.9352e+002
  2.1889e+003
  2.4539e+002
  0.0000e+000
  1.7034e+004
  -1.5558e+004
  2.1126e+001
  6.5941e+000
  8.7416e+001
  1.0936e+004
  1.8555e+004
  -3.6189e+002
  2.4233e-001
  3.2132e+003
  9.8289e+003
  1.3901e+004
  5.9703e-011
  -5.2920e+003
  -8.3474e+000
  2.2347e+001
  5.3809e+003
  5.6439e+002
  0.0000e+000
  -3.6026e+002
  -6.5540e+002
  0.0000e+000
  0.0000e+000
  2.5203e+004
  1.9921e+003
  -4.4439e+002
  -7.6753e+002
  -1.1587e+003
  -4.0266e+002
  0.0000e+000
  4.9477e+003
  -3.2902e+002
  0.0000e+000
  -1.0560e+002
  2.5933e+003
  4.6976e+002
  -8.0840e+002
  2.7420e-003



_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Constraints not met

by Gabriele Pannocchia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> I am attaching the problem file and the output file. Is this a bug? Any
> help is most appreciated.

Although, I am obtaining slightly different results from those reported
by Prerna, I can reproduce a constraint violation and info=3 on
octave-3.0.0

The reason is a known current limitation of this QP solver which does
not handle properly the case when the active set matrix is not full
rank.

An example of such cases is if one has the following inequality
constraints:
a <= x_1 <= a
Since they are both active they both can be included inside the
active-set matrix, which is however non full rank in such case.
These simple cases could be avoided by treating these two inequality
constraint as a single equality constraint x_1=a.
A crude modification to qp.m, appended below, could address these cases,
but not those emphasized by Prerna's example (and others with
constraints that can be active without being independent).
A proper handling would require glpk calls inside __qp__.cc and this
patch is in my things-to-do list...

I apologize for not addressing it now.

Gabriele




[qp.diff]

--- /usr/share/octave/3.0.0/m/optimization/qp.m 2008-03-26 11:56:57.000000000 +0100
+++ qp.m 2008-05-13 22:23:08.000000000 +0200
@@ -131,7 +131,7 @@
       if (! isempty (lb))
  if (length(lb) != n)
   error ("qp: lower bound has incorrect length");
- else
+ elseif (isempty (ub))
   Ain = [Ain; eye(n)];
   bin = [bin; lb];
  endif
@@ -140,11 +140,31 @@
       if (! isempty (ub))
  if (length (ub) != n)
   error ("qp: upper bound has incorrect length");
- else
+ elseif (isempty (lb))
   Ain = [Ain; -eye(n)];
   bin = [bin; -ub];
  endif
       endif
+      
+      if (! isempty (lb) && ! isempty (ub))
+ rtol = sqrt (eps);
+ for i=1:n
+  if (abs (lb (i) - ub (i)) < rtol*(1+max( abs (lb(i)+ub(i)))))
+            ## These are actually an equality constraint
+    tmprow = zeros(1,n);
+    tmprow(i) = 1;
+            A = [A;tmprow];
+            b = [b; 0.5*(lb(i)+ub(i))];
+    n_eq = n_eq + 1;
+  else
+    tmprow = zeros(1,n);
+    tmprow(i) = 1;
+    Ain = [Ain; tmprow; -tmprow];
+    bin = [bin; lb(i); -ub(i)];
+    n_in = n_in + 2;
+  endif
+ endfor
+      endif
     endif
 
     ## Inequality constraints
@@ -156,7 +176,7 @@
  if (! isempty (A_lb))
   if (length (A_lb) != dimA_in)
     error ("qp: inequality constraint matrix and lower bound vector inconsistent");
-  else
+  elseif (isempty (A_ub))
     Ain = [Ain; A_in];
     bin = [bin; A_lb];
   endif
@@ -164,11 +184,29 @@
  if (! isempty (A_ub))
   if (length (A_ub) != dimA_in)
     error ("qp: inequality constraint matrix and upper bound vector inconsistent");
-  else
+  elseif (isempty (A_lb))
     Ain = [Ain; -A_in];
     bin = [bin; -A_ub];
   endif
  endif
+
+ if (! isempty (A_lb) && ! isempty (A_ub))
+  rtol = sqrt (eps);
+  for i=1:dimA_in
+    if (abs (A_lb (i) - A_ub (i)) < rtol*(1+max( abs (A_lb(i)+A_ub(i)))))
+              ## These are actually an equality constraint
+      tmprow = A_in(i,:);
+              A = [A;tmprow];
+              b = [b; 0.5*(A_lb(i)+A_ub(i))];
+      n_eq = n_eq + 1;
+    else
+      tmprow = A_in(i,:);
+      Ain = [Ain; tmprow; -tmprow];
+      bin = [bin; A_lb(i); -A_ub(i)];
+      n_in = n_in + 2;
+    endif
+  endfor
+ endif
       endif
     endif
 
@@ -190,8 +228,8 @@
     ## Check if the initial guess is feasible.
     rtol = sqrt (eps);
 
-    eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+norm (b)));
-    in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+norm (bin))));
+    eq_infeasible = (n_eq > 0 && norm (A*x0-b) > rtol*(1+abs (b)));
+    in_infeasible = (n_in > 0 && any (Ain*x0-bin < -rtol*(1+abs (bin))));
 
     info = 0;
     if (eq_infeasible || in_infeasible)
@@ -211,7 +249,7 @@
       ## constraints also.
       if (n_in > 0)
  res = Ain * xbar - bin;
- if (any (res < -rtol * (1 + norm (bin))))
+ if (any (res < -rtol * (1 + abs (bin))))
   ## xbar is not feasible with respect to the inequality
   ## constraints.  Compute a step in the null space of the
   ## equality constraints, by solving a QP.  If the slack is


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www.cae.wisc.edu/mailman/listinfo/bug-octave