Difference between revisions of "Pyramid Bins"

From Robowiki
Jump to navigation Jump to search
(Created page with "A form of statistical targeting that combines guess factors, segmentation, and visit count stats. ==Idea== Segmentation typically involves segmenting into a significant number ...")
 
Line 3: Line 3:
 
==Idea==
 
==Idea==
  
Segmentation typically involves segmenting into a significant number of buckets- it's not untypical to see 30 buckets or more. However, by scanning the target's distance to ourselves, we can actually reduce the number of buckets to only a fraction, based on the maximum escape angle.
+
Segmentation typically involves segmenting into a significant number of buckets- it's not untypical to see 30 buckets or more. However, by scanning the distance to our target, we can actually reduce the number of buckets to only a fraction of what's typically used, based on the maximum escape angle and chord lengths. The result is greatly improved learning speeds and improved accuracy.
  
 
==Implementation==
 
==Implementation==

Revision as of 05:14, 23 March 2011

A form of statistical targeting that combines guess factors, segmentation, and visit count stats.

Idea

Segmentation typically involves segmenting into a significant number of buckets- it's not untypical to see 30 buckets or more. However, by scanning the distance to our target, we can actually reduce the number of buckets to only a fraction of what's typically used, based on the maximum escape angle and chord lengths. The result is greatly improved learning speeds and improved accuracy.

Implementation

In order to implement pyramid segmentation, we simply need to make a few calculations to determine how many buckets we'll need at any particular range. -First, calculate the Maximum Escape Angle. -Then using the triangle used to calculate the MEA, calculate the length of the side opposite the MEA. Since the triangle is Right, this comes out to be 'distance to target' * tan(MEA). Call this length 'C'. -Divide 'C' by twice the width of a bot minus one, 36 * 2 - 1 = 71, and take the ceiling of the result. This gives the minimum number of buckets needed to hit the target at that distance.

By pre-calculating which distances lead to a change in the number of buckets, we can very easily implement this into our code. For simple purposes, the breaks are at d=79n/tan(MEA) for all integer n (but this only needs to be calculated up to the size of the battlefield). For Firepower=3, this comes out to a break at every 75 units, which isn't bad given that the size of a typical battlefield is 800 (that is, 11 buckets at most).

Notice that we used buckets of width 79- This means that in order to to work properly our gun must fire directly into the center of each bucket.