|
-
Nov 23rd, 2006, 11:44 AM
#1
Thread Starter
Lively Member
combination generator
hey
im making a decision table, and i have 8/9 rules with each answer being y or n. This is going to mean there are over 250 combernations!
I was wondering if there is a program that works this out for you?
Cheers
Laura
-
Nov 23rd, 2006, 11:50 AM
#2
Re: combination generator
Welcome to VBForums 
There are some algorithms that can do that, but what do you mean with decision table? Like an array? Can you clarify your idea a bit?
-
Nov 23rd, 2006, 12:00 PM
#3
Thread Starter
Lively Member
Re: combination generator
hey
sorry for not making myself clear, kind of hard to explain.
I have to make a decision table and it looks like this
hopefull this will help 
RULE | DOCTOR
---------------------------------------------------
Name|y|n|n|n|
Addy|Y|y|n|n|
Date|y|y|y|n|
Time|y|y|y|y|
Book?|y|n|n|n|
to explain this table:
I have the rules that have to be yes in order for the booking to go a head.
If they are all Y then the booking is a y
If even one of them is a n then the booking is a n
I have about 8 or 9 rules before the booking, which means i have over 200 different combernations (sp?) to work out
Does this make sense?
-
Nov 23rd, 2006, 01:52 PM
#4
Member
Re: combination generator
Hi Laura.
One way to do this would be to scan the array of answers and add 1 to a counter for all "Y" you encounter.
If the final result is less than 8 or 9 then it would be a no.
Example:
VB Code:
dim Answers(9) as string
dim Counter as integer,a as integer
for a=1 to 9
if ucase(Answers(a))="Y" then Counter=counter+1
next
if counter<9 then Msgbox "No booking!"
I don't know what your code looks like, if you even use an array so this will probably not fit into your code without modifications...
-
Nov 23rd, 2006, 02:01 PM
#5
Frenzied Member
Re: combination generator
You don't need to evaluate every possible combination.
You need to evaluate each rule one by one and if one of the rules is false you make the decision false.
VB Code:
decision = (rule1 And rule2 And rule3 And rule4)
Or
VB Code:
decision = True
decision = decision And rule1
decision = decision And rule2
decision = decision And rule3
decision = decision And rule4
decision and the rules are booleans.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|