concordia-library/CONCORDIA_OPTIMAL_MATCH.txt
rjawor 9b97ff2fa9 optimal match notes
Former-commit-id: de82da8922bae9fe913fd85e80397c95a69198ca
2015-04-19 12:46:34 +02:00

28 lines
852 B
Plaintext

S = set of concordia results
maxCoverage = empty // max coverage
/*
getPossibleCoverages
param A - set of concordia results, current coverage
return isTerminal - returns true if nothing from S can be added to A
*/
boolean getPossibleCoverages(A) {
allTerminal = true
for s in S: // to consider - sort intervals in S and always search from the last interval in A
// however - how to sort the intervals? maybe by their ends?
if not A intersects {s} // given the above, this check would only require to check if s overlaps with the last interval in A
allTerminal = allTerminal and getPossibleCoverages(A+{s})
if allTerminal then
score = scoreCoverage(A)
if score > scoreCoverage(maxCoverage)
maxCoverage = A
return true
else
return false
}