0

I have a library that can solve minimize{||Ax-b||} (Linear least squares).

  • A is a matrix, while x and b is a vector.
  • It is possible that A is not invertible.
  • A is not a square matrix.

Now, I want to solve it with additional constraints : all xi>0.

Question

How to adapt/encapsulate the solver to support constraints all xi>0?

I prefer to think that the existing library is a blackbox function - solve(A,b,x).
I want to encapsulate it to be solvePositive(A,b,x).

For an answer, I expect rough idea, i.e. it doesn't need to contain any code at all.

Edit: .... or should I write a new algorithm instead?
If so, what are the names of applicable algorithms?
I seek for a beginner-friendly guide.

My search

Community
  • 1
  • 1
javaLover
  • 6,347
  • 2
  • 22
  • 67
  • There are plenty of algorithms - and libraries - around to address such problems. Look up "linear programming". – Peter Dec 28 '16 at 01:57
  • @Peter May you be more specific, please? What are the name of algorithms? Linear programming maximizes/minimizes `Matrix*Vector` rather than minimize `error`. Can my problem be converted to linear programming? – javaLover Dec 29 '16 at 02:16
  • Linear programming maximises (or minimises) a cost function. One of those cost functions can be length of `*Matrix*Vector`. – Peter Dec 29 '16 at 02:48
  • @Peter I just searched "linear programming length (or size) vector" find nothing. I read https://en.wikipedia.org/wiki/Linear_programming ; found only cost similar to `(c^t)*x` (not size). I don't get any sense that cost can be `||euclidean-size||` e.g. `||A*x-b||`. Please enlighten me. – javaLover Dec 29 '16 at 03:14

0 Answers0