Path: news.mathworks.com!not-for-mail
From: "Daniel " <danielDOTrDOTlittle@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Number of unique combinations from sets
Date: Wed, 7 May 2008 06:58:03 +0000 (UTC)
Organization: University of Western Australia
Lines: 51
Message-ID: <fvrjtr$r2h$1@fred.mathworks.com>
References: <fvr755$inh$1@fred.mathworks.com> <fvri01$ghb$1@fred.mathworks.com>
Reply-To: "Daniel " <danielDOTrDOTlittle@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210143483 27729 172.30.248.38 (7 May 2008 06:58:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 7 May 2008 06:58:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 740978
Xref: news.mathworks.com comp.soft-sys.matlab:467100


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid>
wrote in message <fvri01$ghb$1@fred.mathworks.com>...
>   There is something sorely amiss with your coding if it 
> takes six days to cover all the combinations of the kind 
 > you want with only the sets
> 
>  [1:900], [1:900], [1:2]
> There are only 1620000 different combinations altogether
from these sets, 
> even considering all as being different.  That is not very
many to go through 
> for a computer unless you have RAM storage problems!  It
ought to finish up 
> in only a few seconds.
 
Yes, the only way i could think to do it was to call allcomb
and then search through the output for permutations (what
the code in the first post does). Which I think would make
1620000 * 6...at any rate the script above isn't efficient
in any respects (hence, my post :-)


>   I am still striving for a precise general definition of
what it is you are after.  
> If you have set1, set2, set3, ..., setn as n sets of
integers, then the integer 
> sequence a1, a2, a3, ..., an, should appear whenever 1)
each ai belongs to 
> seti, and 2) if any ai and aj pair both belong to each of
seti and setj, then if i 
> < j, we have ai <= aj.  In other words any pair of
integers that both come 
> from each of two sets should always appear in ascending
order.  Does that 
> accurately define what you are after?
>
>   If so, I would think you could just use 'allcomb' first
and subsequently delete 
> all those which failed this second condition.  The
rejection rate should not be 
> excessive until the number of sets gets too large.

Yes, I think you're description is correct. Certainly, the
method you describe for finding a solution works and is
essentially what's happening when you call...

a = unique(sort(allcomb(1:a, 1:b, 1:c), 2), 'rows);

I had forgotten about the sort function and all I could
remember was sortrows, which obviously doesn't do what is
needed. Thanks for you help.