boolean decisions

Robin Becker robin at reportlab.com
Tue Feb 5 09:29:32 EST 2008


Paul Hankin wrote:
> On Feb 5, 10:52 am, Robin Becker <ro... at reportlab.com> wrote:
>> I have a couple of business decisions to make that essentially use 6 binary
>> input variables. After the business users have gone back and forth for two weeks
>> trying to build special case rules I asked them to make up a table containing
>> all of the input possibilities and specify what should happen in each case.
>> There are only 64 rows and some of the decisions are obviously explainable in
>> simple ways ie
>>
>> if a and not b do action 1
>>
>> is there a way to derive simplified rules for each binary outcome? I'm sure this
>> is a standard sort of problem and probably some python code is out there. It
>> seems to me I need to solve an overdetermined binary equation system and then
>> choose the solution with the shortest number of terms or something, but perhaps
>> I am daft.
> 
> Why bother? Build a hash table mapping the 64 cases to a function or
> method-name. That way you can keep the business rules intact in your
> code, it'll be just as fast (or faster), and your code will be much
> easier to fix when one of the lines of that table changes (not that
> business logic EVER changes ;). I'd be tempted to include the business
> rule table as a text file or string, and parse it at program startup
> to build the hashtable. That way anyone can look at or modify the
> table, even if they know nothing about python or coding.
......

I think the problem is actually less simple than that. Although they can 
enumerate many or all of the rows of the table I suspect that the business 
people don't always know why they choose particular outcomes; often they're not 
looking at most of the input choices at all they just concentrate on one or 
other. If they could formulate the rules properly they would, but somehow they 
can't.

If I can obtain some simplified rules for the two or three outputs and present 
them to the business guys they may actually be able to confirm their own 
original choices/and or reject/confirm the rule.
-- 
Robin Becker




More information about the Python-list mailing list