# [R] help with apply, please

Patrick Burns pburns at pburns.seanet.com
Sat Nov 19 18:17:15 CET 2005

```I suspect that the answer is that finding all solutions
will be hard.  L1 regression is a special case of LP.
I learned how to move around the corners of the
solution space, and could easily find all of the solutions
in the special case of a two-way table.  However,
sometimes there were a lot of solutions.

I would guess that your problem has a lot of solutions
as well.     One cheat would be to do the LP problem
multiple times with the rows of your matrix randomly
permuted.  Assuming you keep track of the real rows,
you could then get a sense of how many solutions there
might be.

Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

>On Saturday 19 November 2005 17:24, Gabor Grothendieck wrote:
>
>
>>[...snip...]
>>Although the above is not wrong I should have removed the rbind
>>which is no longer needed and simplifying it further, as it seems
>>that lp will do the rep for you itself for certain arguments, gives:
>>
>>lp("min", rep(1,3), t(mtrx), ">=", 1)\$solution  # 1 0 1
>>
>>
>
>Thank you Gabor, this solution is superbe (you never stop amazing me :)
>Now... it only finds _one_ of the multiple minimum solutions. In the toy
>example, there are two minimum solutions, hence I reckon the output should
>have been a list with:
>[[1]]
>[1] 1 0 1
>
>[[2]]
>[1] 0 1 1
>
>Also, thanks to Duncan and yes, I do very much care finding the smallest
>possible solutions (if I correctly understand your question).
>
>It seems that lp function is very promising, but can I use it to find _all_
>minimum solutions?
>