Skip to main content
added 476 characters in body
Source Link
Erik Eidt
  • 34.8k
  • 6
  • 61
  • 95

Max computation

for index as Key in Candidate
    if Candidate[index] then
        compute score for Candidate
        if larger than before, then keep it
    endif
next

if your Candidate#'s are small (e.g. less than 32), then you can do this with a simple for (int index = 0; index < count; index++) { }, however, for a larger set you'd need a bit vector for the index variable (and the ability to "increment" a bit vector).


Also, these algorithms & data structures can be used with bit vectors instead of individual elements or sets or other. if we work on bit vectors we can work on chunks of 64-bits at at time reducing the iterations by a large factor.

Also, these algorithms & data structures can be used with bit vectors instead of individual elements or sets or other. if we work on bit vectors we can work on chunks of 64-bits at at time reducing the iterations by a large factor.

Max computation

for index as Key in Candidate
    if Candidate[index] then
        compute score for Candidate
        if larger than before, then keep it
    endif
next

if your Candidate#'s are small (e.g. less than 32), then you can do this with a simple for (int index = 0; index < count; index++) { }, however, for a larger set you'd need a bit vector for the index variable (and the ability to "increment" a bit vector).


Also, these algorithms & data structures can be used with bit vectors instead of individual elements or sets or other. if we work on bit vectors we can work on chunks of 64-bits at at time reducing the iterations by a large factor.

added 62 characters in body
Source Link
Erik Eidt
  • 34.8k
  • 6
  • 61
  • 95
for each Member#MatchSet as KeyValue in MembersToMatches
    if MatchSet has more than one member then
        Assemble a Candidate mask from the set of Match#'s
            by accumlating (1<<Match#) for each Match# in the MatchSet
        Reject all Candidates at that mask
for each Member# as Key in MembersToMatches
    Assemble a Candidate mask from the set of Match#'s
    Reject all Candidates at that mask
for each MatchSet as Value in MembersToMatches
    if MatchSet has more than one member then
        Assemble a Candidate mask from the set of Match#'s
            by accumlating (1<<Match#) for each Match# in the MatchSet
        Reject all Candidates at that mask
deleted 289 characters in body
Source Link
Erik Eidt
  • 34.8k
  • 6
  • 61
  • 95

Let's populate this new data structure (#2):

for each Match# as Key in MatchesToMembers
    for each Member# as Key in the Match#
        let currMatchSet = MembersToMatches[Member#] -- the as current accumulation
        if currMatchSet is not empty 
           -- Match# interferes with all in currMatchSet
            if the Match# is not in currMatchSet then MatchesToMembers[Match#]
                Update MembersToMatches[Member#] to include Match#
            endif
        endif
    next
next

for each Member# as Key in MembersToMatches Assemble a Candidate mask from the set of Match#'s Reject all Candidates at that mask

for each Member# as Key in MembersToMatches
    Assemble a Candidate mask from the set of Match#'s
    Reject all Candidates at that mask

Let's populate this new data structure

for each Match# as Key in MatchesToMembers
    for each Member# as Key in the Match#
        let currMatchSet = MembersToMatches[Member#] -- the as current accumulation
        if currMatchSet is not empty 
           -- Match# interferes with all in currMatchSet
            if the Match# is not in currMatchSet then 
                Update MembersToMatches[Member#] to include Match#
            endif
        endif
    next
next

for each Member# as Key in MembersToMatches Assemble a Candidate mask from the set of Match#'s Reject all Candidates at that mask

Let's populate this new data structure (#2):

for each Match# as Key in MatchesToMembers
    for each Member# in MatchesToMembers[Match#]
        Update MembersToMatches[Member#] to include Match#        
    next
next
for each Member# as Key in MembersToMatches
    Assemble a Candidate mask from the set of Match#'s
    Reject all Candidates at that mask
deleted 174 characters in body
Source Link
Erik Eidt
  • 34.8k
  • 6
  • 61
  • 95
Loading
Source Link
Erik Eidt
  • 34.8k
  • 6
  • 61
  • 95
Loading