> Each kid is told that the next day they must all wear a hat, a shirt, a pair of pants, a belt and a pair of shoes.

So each kid has a coordinate in a 5 dimensional space

 hat X shirt X pants X belt X shoes

You want to know the maximum Hamming Distance between of two kids.

> I was hoping there would be a way to say I currently have found two students with at least 3 things different so I shouldn't consider students who have at least 2 thing ...

One naive approach is to sort is to partition all students according to each dimension such that

 union ( @hat{ qw/red white blue/ } ) == @all_students and so on.

those partitions are the layers in a 5-dimensional cube.

for one student A=(a_1,a_2,a_3,a_4,a_5) the maximum distance students are those in the intersection of  @Not(a_n) for the smallest n.

> current high water mark.

well n has to be greater than your current maximum.

I'm not very keen to code this, just wanna give you pointers for keywords to find appropriate algorithms.

Another thing which comes to mind are implication bases.

Something like "all kids with red hat and yellow shirt wear green pants" is an implication.

The minimal set of implications which can be used to derive all other possible implications is called an "implication base".

If all other students are in a 3 distance to A. this means that any 3 features A doesn't have already imply a feature A has.

There are many algorithms effectively calculating such implications for a given point set, I wouldn't be surprised if they already lead to the maximum hamming distance as a side effect.

AFAIK "Implication bases" are used for DB optimization.

I'd start looking there.¹

HTH! =)

Cheers Rolf

( addicted to the Perl Programming Language)

¹)I wouldn't be surprised if modifying next closure-algorithm of Bernhard Ganter can already be used for this.


In reply to Re^3: Help thinking about an alternate algorithm by LanX
in thread Help thinking about an alternate algorithm by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.