boolean decisions

R

Robin Becker

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.
 
D

Diez B. Roggisch

Robin said:
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.

Triggered this in some deep-rootet parts of my brain stem:

http://en.wikipedia.org/wiki/Quine-McCluskey_algorithm

Diez
 
P

Paul Hankin

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.
 
Z

Zentrader

and then choose the solution with the
shortest number of terms or something

Experience says that one should not assume that there is a one to one
relationship, ("the" solution). Some event can trigger more than one
combination of the 6 binary input variables. And experience says that
the business users are not aware of all of the possible outcomes or
that there may be some one-to-many relationships, which may be why
they want the computer to do it. This is a problem that occurs
everywhere. There are various decision table techniques, but good
algorithms seem to be in short supply.
 
R

Robin Becker

Paul said:
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.
 
R

Robin Becker

Zentrader said:
Experience says that one should not assume that there is a one to one
relationship, ("the" solution). Some event can trigger more than one
combination of the 6 binary input variables. And experience says that
the business users are not aware of all of the possible outcomes or
that there may be some one-to-many relationships, which may be why
they want the computer to do it. This is a problem that occurs
everywhere. There are various decision table techniques, but good
algorithms seem to be in short supply.
in practice the decisions are mostly singletons and I'm fairly sure which order
they have to be made in.
 
D

Diez B. Roggisch

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.

Maybe creating descision trees from real-world data might also be a way to
infer the business-rules.

Diez
 
P

Paddy

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.

Try:
http://en.wikipedia.org/wiki/Karnaugh_map

Their are useful links at the bottom, too.

- Paddy.
 
N

news-noreply

Statestep (which includes Python code generation) might
be something to look at.
It's designed to help the user create simplified rules
to begin with rather than derive them post hoc (it's
really for much bigger problems where enumerating
individual rules like you've done would be impractical)
....
However, if you start with an "exploded" set of atomic
rules like you now have, you could create simplified
rules yourself, progressively deleting the rules you are
replacing (identified as overlaps by Statestep); this
way, at least the tool is checking the correctness of
the transformation from individual to simplified rules
(if you make a mistake then a conflict will be reported
rather than an overlap).

Michael
 
R

Robin Becker

Statestep (which includes Python code generation) might
be something to look at.
It's designed to help the user create simplified rules
to begin with rather than derive them post hoc (it's
really for much bigger problems where enumerating
individual rules like you've done would be impractical)
...
However, if you start with an "exploded" set of atomic
rules like you now have, you could create simplified
rules yourself, progressively deleting the rules you are
replacing (identified as overlaps by Statestep); this
way, at least the tool is checking the correctness of
the transformation from individual to simplified rules
(if you make a mistake then a conflict will be reported
rather than an overlap).

Michael
All of this has been useful, but I over estimated the people I work with. having
reduced the problem to only 4 input variables. They carefully produced a
spreadsheet with 20 scenarios. There were clearly 4 scenarios missing, but also
4 pairs of duplicates in the input space; worse only one of the duplicate pairs
agreed on the action. sigh
-impossibly yrs-
Robin Becker
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top