Robo Home | Changes | Preferences | AllPages

Fuzzy Logic Targeting

I was thinking about this earlier and thought, hey why hasn't this page been made yet. I know the basics of Fuzzy logic, who doesn't but putting those basics into RoboCode is another thing altogeather. I figure fuzzy logic can be more of an -add on- then a actual gun. What is this technique, does anyone know, does it work? I have ideas on how it could work. But I just wanted to know why this page was here.

If anyone wants me to toss my idea on here feel free to ask, but it would probably make the aiming worse then better. -- Ann

Isn't GF targeting an implementation of fuzzy logic? It involves making decisions based on imperfect data. It assigns a 'goodness' score for the 'perfect data' indicating something, and then picks the best score - that sounds like fuzzy logic to me. --Jp

I wouldn't call GF targeting fuzzy logic. I think an example of fuzzy logic would be something like this: If damage taken per round > 40, enemy is a strong bot. If damage taken per round is < 20, enemy is a weak bot. If 20 < damage taken per round < 40, then "strongness" of enemy is (damage per round - 20) / 20. If behaviors against strong bots (like a flattener perhaps) were partially enabled based on this strongness factor, that would be an application of fuzzy logic. Basically fuzzy logic is just a way of saying that there are values in between true and false, or strong and weak in my example. --David Alves

I figured it would be something like the an gf betweem two bins, using otehr bins to get a fuzzy idea where between them to aim. However all my playing around in this has just crashed and burned. Overall it seems to lower the targeting score by a bit on a 39 segment gun. It might do better on a lower segment gun and thus be a nice add fast learning addon.

As for a gun in itself it could be something like a AverageBearingOffset? gun with a fuzzy offset based on the last few turns. Or push my first idea to an extreme and only have 3 to 5 bins total and use fuzzy logic to determine the placement (would require something that definitely works). -- Chase-san

Chase-san, you may want to reconsider the 3 - 5 bin approach. Remember that bins represent physical bearings within the possible bearings a bot may move. For example, in the time it takes a power 3 bullet to arrive, a bot can move a maximum of 46 degrees in either direction; so 3 bins might look like this:

bin[0] -> -46
bin[1] -> 0
bin[2] -> 46

Five bins:

bin[0] -> -46
bin[1] -> -23
bin[2] -> 0
bin[3] -> 23
bin[4] -> 46

Seven bins:

bin[0] -> -46
bin[1] -> -30.67
bin[2] -> -15.34
bin[3] -> 0
bin[4] -> 15.34
bin[5] -> 30.67
bin[6] -> 46

Basically, by using more bins, you make your statistical estimation more precise. 3 bins can only represents head on targeting (bearing 0) and linear targeting (bearing +/-46). A savvy bot will hide between these bearings. The flip side is that too many bins make your bot learn slowly. There's a tradeoff and most competitive bots use between 15 and 75 bins(at least the open source bots).

As for fuzzy logic, I often confuse probability with fuzzy logic. Strictly speaking, all of the learning bots I can think of use probability and I'm not aware of any that use true mathematical fuzzy logic. This article seems good about explaining the distinction: http://en.wikipedia.org/wiki/Fuzzy_logic. Cheers and best of luck in your hunt for 25. --Corbos

Maybe it is just my technique, but I don't see how slicing up the guess factor / bearing offset data more finely affects learning speed. Higher segmentation, definitely, but not more visit count bins. Then again when I register a hit I don't store a hit in just one bin. Ugluk has 101 bins in his bearing offset gun, and 111 in his guess-factor gun. It's certainly not the best gun around, but it's at 82% in the TC2K6 compared to the best bot at 90%. -- Martin (edit: the TC2K6 score does not include my recently added GF gun)

Well, if you picture a gun with a million bins, it's unlikely that any bin would get more than one visit, so your gun wouldn't pick the proper one, there would be too many bins that were tied with 1 hit each. I think that's the basic issue with too many bins: the more bins you have, the fewer visits per bin you have, so the harder it is to see a clear best bin. Have you tried changing your gun to use only 30-50 bins? For reference, Phoenix uses 31. I believe Dookious uses 47.--David Alves

Well, when I register a hit I measure the arc of the wave that crashed against me, and I drape that arc across my bins. So if I have a million bins, I'll be draping the hit across 150000 or so. The next wave crashes and drapes across another 150000ish, creating some overlap. The area of overlap is now the high point. I can pick one of the 75000 or so high water marks at random, or whatever technique you would use in a 30 bin setup in the same situation. It is my version of bin smoothing. -- Martin

Sounds like a good way of handling the issue I mentioned. =)--David Alves

If I remember correctly FuzzyLogic? is just a possible set of data between two well defined sets of data (or even two other possible sets of data). However if you wanted to do a "pure" FuzzyLogic? gun, you would have to define it as something like, the bot was here and now its here, so now it should be between here and that other place. I personally think a "good" Pure FuzzyLogic? gun is fiction. Sure you could make a pure fuzzylogic gun, but I doupt it would fire anywhere near the correct vectors. Thus I think at best it could be used as a add on to a already existing gun type (one that atleast has some margin of success). Being a little fuzzy about where your enemy is going to be is gonna make you miss, IMHO. -- Chase-san

Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited November 14, 2006 21:29 EST by Chase-san (diff)