Hi all, i am currently trying to create a counter which can help me select an action (A,B,C) depending on the highest value in that state.
Example:
First, the random counter would random between "HIGHEST" or "RANDOM". The probability of the random counter would be 90% "highest" and 10% "random". How i went about doing this is
randomcounter = Int((100 - 1 + 1) * Rnd + 1)
If epsilon > 10 Then
counter = "Q"
Else
counter = "random"
End If
<tbody>
</tbody>
After the random counter has chosen between the 2. If it chose "HIGHEST", then based on a state(i would have determined this before), it would chose the highest value and give the corresponding action.
<tbody>
</tbody>
In this example, my current state is State5. If my counter randoms to a "HIGHEST", im trying to get vba to store "Action C" (being the highest out of 4,6,7).
If the counter randoms to a "Random", the action stored would random between the 2 other action,not the highest value which is "Action A" or "Action C".
i am currently stuck using an index match formula in excel but im trying to implement in vba coding. One way i could think of would be:
If randomcounter = "Highest" and State = 1 Then
Actiontaken = max(range("B6:D6"))
thats really all i got..
Your help is much appreciated!
Example:
First, the random counter would random between "HIGHEST" or "RANDOM". The probability of the random counter would be 90% "highest" and 10% "random". How i went about doing this is
randomcounter = Int((100 - 1 + 1) * Rnd + 1)
If epsilon > 10 Then
counter = "Q"
Else
counter = "random"
End If
Random Counter | HIGHEST OR RANDOM |
<tbody>
</tbody>
After the random counter has chosen between the 2. If it chose "HIGHEST", then based on a state(i would have determined this before), it would chose the highest value and give the corresponding action.
Action A | Action B | Action C | |
State1 | 0 | 0 | 0 |
State2 | 2 | 1 | 3 |
State3 | 1 | 2 | 3 |
State4 | 1 | 2 | 3 |
State5 | 4 | 6 | 7 |
State6 | 1 | 8 | 6 |
State7 | 2 | 5 | 9 |
State8 | 0 | 0 | 1 |
State9 | 2 | 0 | 3 |
State10 | 8 | 6 | 0 |
<tbody>
</tbody>
In this example, my current state is State5. If my counter randoms to a "HIGHEST", im trying to get vba to store "Action C" (being the highest out of 4,6,7).
If the counter randoms to a "Random", the action stored would random between the 2 other action,not the highest value which is "Action A" or "Action C".
i am currently stuck using an index match formula in excel but im trying to implement in vba coding. One way i could think of would be:
If randomcounter = "Highest" and State = 1 Then
Actiontaken = max(range("B6:D6"))
thats really all i got..
Your help is much appreciated!
Last edited: