[Tutor] Lexicographic ordering (or something simpler)
Matt Williams
matthew.williams at cancer.org.uk
Tue Mar 13 23:54:05 CET 2007
Dear All,
I'm trying to write something to calculate rule priorities, based on
their provenance (ultimately I'm after a lexicographic ordering)
I have a set of terms (the provenances) I'm try to sort. I've done it by
associating each possible set of terms with a dictionary, and then using
the elements of the set as keys of the dictionary, so that it can look
up the values. This is (almost certainly) sub-optimal, but ok for now....
Where I get stuck is that each rule is compared pairwise to each other;
the precedence of the set of rules is then based on that. Since there
can be ties between the rules, the result of each pairwise comparison
for two rules a & ) is either 1,0 or -1, where 1 == a beats b, -1 == b
beats a and 0 == tie.
At the moment I get back a list of results from testing one set of rules
against the other. I now need to make a decision based on all the
results. I've tried coding it as if...elif statements, but that all gets
horrible.
Given a list of the form [1,0,0,1,-1] I need to make decision (in this,
it is undecided, so we drop down to the next criteria).
Any ideas/ pointers as to how I implement this?
Thanks,
Matt
--
http://acl.icnet.uk/~mw
http://adhominem.blogsome.com/
+44 (0)7834 899570
More information about the Tutor
mailing list