Good Things Come To Those Who Weight

A_Set_of_Grocery_Balance_Scale_as284a709b

I will be introducing weighting of options into the automated choice methodology, taking into account inherent percentage, energy required and relative rewards.

For four choices, it might look a little something like this (from Standing Back Control):

Suplex
49% —> 27 energy, so x 1/27 —> scores 2 points and gets 2 points for side control
49 x 1/27 x 4 = 7.259 —NORMALISED—> 0.09775

Drag Down
58% —> 24 energy, x 1/24 —> scores 2 points and gets 4 points for back control
58 x 1/24 x 6 = 14.5 —NORMALISED—> 0.1952

Takedown into 50-50
35% —> 7 energy, 1/7 — > scores 2 points for takedown
35 x 1/7 x 2 = 10 —NORMALISED—> 0.1347

Transition to Single Leg
85% —> 2 energy, 1/2 —> scores no points (set as 1, to avoid NaN error)
85 x 1/2 x 1 = 42.5 —NORMALISED—> 0.5723

The four nomalised values are then put into a cumulative Vector<Double>, which – in conjuction with a Vector<Integer> of moveIDs, matches the moveID to the value below which a random value must be in order to select it.

This moveID Vector will look as follows:

0) 131
1) 136
2) 130
3) 248

The Vector will look as follows:

0) 0.09775
1) 0.29295
2) 0.42765
3) 0.99995 (ROUND THIS LAST VALUE TO 1)

And the logic for choosing the move will look as follows:

    double choiceResult = Math.random();
    for (int index = 0; index < cumulativeProbabilityVector.size(); index++){
        if (choiceResult <= cumulativeProbabilityVector.get(index){
            moveID = moveIDVector.get(index);
            break;
        }
    }

Of course, I can always tailor the complexity of arriving at the initial weightings, but the entire essence of the process is already there. Good stuff. On the way to some decent AI.

 

TRP

PS. Just thought, the actual weighting of the weighting could be altered, depending on the situation: With 100% energy, the energy weighting is 0% important, at 75% the weighting is 25% important, etc. and the less time that remains, the more important submissions become etc.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s