[fpc-pascal] best method: multiple three state options in a decision tree
waldo kitty
wkitty42 at windstream.net
Sun Jan 19 01:40:50 CET 2014
what is the best method of coding a decision tree with options that have three
states and all options are additive?
clarification: i have a situation with 5 (at this time) options and all 5 are
three state... each option can be paired with all other options' states but may
NOT be paired with its own other states...
eg:
optionA : min/max, min, max
optionB : min/max, min, max
optionC : min/max, min, max
optionD : min/max, min, max
optionE : min/max, min, max
optionA can be used as :
optionA:min/max
optionA:min only
optionA:max only
optionA:min/max AND optionB:min/max
optionA:min/max AND optionB:min only
optionA:min/max AND optionB:max only
optionA:min only AND optionB:min/max
optionA:min only AND optionB:min only
optionA:min only AND optionB:max only
optionA:max only AND optionB:min/max
optionA:max only AND optionB:min only
optionA:max only AND optionB:max only
optionA:min/max AND optionC:min/max
optionA:min/max AND optionC:min only
optionA:min/max AND optionC:max only
optionA:min only AND optionC:min/max
optionA:min only AND optionC:min only
optionA:min only AND optionC:max only
optionA:max only AND optionC:min/max
optionA:max only AND optionC:min only
optionA:max only AND optionC:max only
optionA:min/max AND optionD:min/max
optionA:min/max AND optionD:min only
optionA:min/max AND optionD:max only
optionA:min only AND optionD:min/max
optionA:min only AND optionD:min only
optionA:min only AND optionD:max only
optionA:max only AND optionD:min/max
optionA:max only AND optionD:min only
optionA:max only AND optionD:max only
optionA:min/max AND optionE:min/max
optionA:min/max AND optionE:min only
optionA:min/max AND optionE:max only
optionA:min only AND optionE:min/max
optionA:min only AND optionE:min only
optionA:min only AND optionE:max only
optionA:max only AND optionE:min/max
optionA:max only AND optionE:min only
optionA:max only AND optionE:max only
and so on with each additional options and its three states... as you can see,
the sheer number of combinations is huge!
in my original attempt i started with if/then/else but that got very hard to
follow very fast... so i decided to implement all the options in a bitmap so i
could more easily use a case statement and simply list the decimal value of the
valid bit patterns as the selection option... that is much easier to follow but
can easily get confused...
it has been many years since i've had to code such a decision tree and my (20+
year) old code is not available for me to dig out and (try to) follow... so i'm
asking how you would handle this situation so as to make it easy to implement,
easy to grok, easy to follow when reading the code AND easy to expand or shrink
if/when necessary...
--
NOTE: No off-list assistance is given without prior approval.
Please keep mailing list traffic on the list unless
private contact is specifically requested and granted.
More information about the fpc-pascal
mailing list