title: minimum-difference constrained sparse least squares problem (called from python)
body: <p>I'm struggling a bit finding a fast algorithm that's suitable.</p>
  <p>I just want to minimize:</p>
  <p>norm2(x-s)</p>
  <p>st
  G.x &lt;= h</p>
  <p>x &gt;= 0</p>
  <p>sum(x) = R</p>
  <p>G is sparse and contains only 1s (and zeros obviously).</p>
  <p>In the case of iterative algorithms, it would be nice to get the interim solutions to show to the user.</p>
  <p>The context is that s is a vector of current results, and the user is saying &quot;well the sum of these few entries (entries indicated by a few 1.0's in a row in G) should be less than this value (a row in h).  So we have to remove quantities from the entries the user specified (indicated by 1.0 entries in G) in a least-squares optimal way, but since we have a global constraint on the total (R) the values removed need to be allocated in a least-squares optimal way amongst the other entries. The entries can't go negative.</p>
  <p>All the algorithms I'm looking at are <em>much</em> more general, and as a result are much more complex. Also, they seem quite slow. I don't see this as a complex problem, although mixes of equality and inequality constraints always seem to make things more complex.</p>
  <p>This has to be called from Python, so I'm looking at Python libraries like qpsolvers and scipy.optimize.  But I suppose Java or C++ libraries could be used and called from Python, which might be good since multithreading is better in Java and C++.</p>
  <p>Any thoughts on what library/package/approach to use to best solve this problem?</p>
  <p>The size of the problem is about 150,000 rows in s, and a few dozen rows in G.</p>
  <p>Thanks!</p>