# [R] help with apply, please

Sat Nov 19 18:32:48 CET 2005

```On Saturday 19 November 2005 19:17, Patrick Burns wrote:
> [....snip...] 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.

Thanks for the answer. The trick does work (i.e. it finds all minimum
solutions) provided that I permute the rows a sufficient number of times. And
I have to compare each solution to the existing (unique) ones, which takes a
lot of time...
In your experience, what would be the definiton of "multiple times" for large
matrices?

My (dumb) solution is guaranteed to find all possible minimums, because it
checks every possible combination. For large matrices, though, this would be
really slow. I wonder if that could be vectorized in some way; before the LP
function, I was thinking there might be a more efficient way to loop over all
possible columns (using perhaps the apply family).

Thanks again,

--