Updating probability distribution for decision making in game AI.

62 Views Asked by At

I'm programming an AI simulation where a car is randomly driving around a area. Within this area there are 5 repair shops. While driving, the car get's damaged (1% for every step). Once the damage of the car is 100%, it will find a shop to repair, while finding a repair shop the car takes no more damage.

For finding the shop, the car uses A* on a graph based on euclidean distance. The amount of nodes (steps) in the path is used to represent damage it would normally take when driving. The car always wants to be back on the road as soon as possible. So when a shop that repairs 80% is 30 nodes away, but a shop that repairs 70% is only 12 nodes away, it should prefer the 70%, although it repaired less, it's the best repair value to be back on the road as fast as possible.

The car makes a discision on what repair shop must be travelled to, based on it's experiences with those repair shops.

At the very start, the car doesn't know how good a shop might be, so the distribution of the shops is something like:

  • Shop A : 20%
  • Shop B : 20%
  • Shop C : 20%
  • Shop D : 20%
  • Shop E : 20%

The formula to find the right spot is based on the average experience of that shop - the amount of node in the path(found with A*) from the car to that shop. It will then choose the shop with the highest percentage left.

  • Shop A: average repair = 70%, distance = 35 nodes.
  • Shop B: average repair = 55%, distance = 5 nodes.

Decision will be :

  • Shop A : 70% - 35%(nodes) = 35%
  • Shop B : 55% - 5%(nodes) = 50%.

50% is a better choice for the car, so it will choose B.

Different stores repair the car at different rates, these rates are unknown to the car.

  • Shop A : Repairs between 20% and 100% at random.
  • Shop B : Repairs between 30% and 80% at random.
  • Shop C : Repairs 50%
  • Shop D : Repairs between 30% and 80% at random.
  • Shop E : Repairs between 20% and 100% at random.

The likelihood of the car going to one of these spots is updated each time it get's repaired.

My question here is: How to update the distribution of different shops, from the cars perspective, such that the repair cost is always taken into account. I have no prior knowledge in this subject and just hoping I can be pointed to the right direction from here.