flipCode - Tech File - Alexander Herz [an error occurred while processing this directive]
Alexander Herz
Click the name for some bio info

E-Mail: softcore@web.de



   01/14/2000, Tech File Update


'lo man..has been a while...
I think it's realy time to update mytechfile....so here it goes...

hi folks...
has been a while so I'm gonna start with what I was up to in the recent time and then I'll explain some new ideas I had ...

basically I was goddamn busy in the recent time...school till 15:30 in the afternoon..many tests and work from..guess when..15:45 till late evening... I became bugtester at zeiss...well..not realy zeiss but a suc comp called carl zeiss vision doin some microscope and imageprocessing... they have some damn neat equipment over there..high end pcs and latest 3d cards ..and of course development machines..that makes it possible to test your stuff on up to date hardware..but my new stuff is based on ogl..and the G400 has realy bad ogl driver support...my codes run on any machine I tryed..as long there is no g400 inside...I got a sys parity error :) the digi cams realy rock and you can do cool things with the microscopes overthere.. Ppl there became realy good lads of mine..some are strange but most are nice..and have some idea about coding..what can be helpfull in places.. I mostly don't have a proper meal..and come hoem late..but I get much fun and money I need to go out in the weekend... What is very importand ..as I found my new gf while going out :) she realy sweet..but hey..let's come back to the topic :)

I did some research in the past winter holdays apart from skiing and shit btw: a happy new year anybody... I looked at kohonen basically..and worked out that there are far more easy/fast ways to evaluate/learn a kohonen network..infact you don't need a network at all to get equal or at least very similar results..but you're much faster as you don't need to run your inputs through a big net...and as soon you get complexer probs or many desired patterns to train your net on your net gets very huge...many patterns mean high res net and n factors inputed to find a pattern need an n-dimensional net..not good...

my first idea was to to 'map' all inputs(input vector) through a funtion into different 'sections' of a 1 dimensional net..but I had no real idea how to be able to do this mapping... so I had a look on how the net is trained ... not let's have a short review on this as some might not know are have forgotten...those who know how a kohonen net work should look for the topic 'KOHONEN ALGO' as there the realy new stuff comes

to train our kohonen net we need an input vector on which the net is trained to recognize(and similar ones)..for simpliness we assume a 2d net... and our input is (20,30) where these value can mean almost anything..but to make it even more easy let's say the first value represents the health of a bot..and the second the ammo....

now we want our bot to do certain things in certain situations..for example it should run away from enemys if the health and/or the ammo is low... so we train our net on this case by passing values describing this situation to our net and seeing which of its neurons get's activated (as neurons are initiated to random there will a random one win) win here means that his vectors(every neuron has a vector saved along with himself)is closest to the inputed vector

formular to used to calc closeness: for 2d:
(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)

for 3d
(x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)

for every other dimension just add one +(n2-n1)*(n2-n1)

...now as we probably did not have a perfect match we adjust our winners vector to be closer to our input vector..and we do the same for some neighbours around our winner...

so if we did this several times for the same situation and if we pass now a situation (input vector) to the net which is close to our learned value (maybe (19,33)) a neuron close to our learned value wins and therefore we probably have a situation which is very similar to the learned one and we should perform the same action as we would for the learned values...

now we've learned our net to run away if health is approxemately at 20 and ammo at 30...but our bot needs to handle more cases.. if the health is low and the ammo high he should still run away from enemys so we train the net with (20,80) and connect the same action as we did with (20,30)...

now we learn the bot all other behaviors he needs to know in the same way...

KOHONEN ALGO

now this was the rather bring and slow to compute standart stuff... I cannot guaranty that anything here is new..I just came up with it and think it's much more compftible than what we used yet...

we do the same example as aboth (train a 'bot' on some actions and having 2 input values)but with a new way... (our bot has just 2 variables in this case...(h,a) where h is health and a is ammo)

todo so we need a new datastructure which is not a huge array of vectors but an array of n vectors where n is the number of patterns you want to learn our 'net'...that saves us a huge ammount of memory and and several cache probs...now you save all your desired patterns in this list

for our example... we want our bot to run away at (20,30) ...(20 health,30 ammo) or similar situations..so we save (20,30) in our array... also we want it to run away at (20,80) so we save this also....

now our 'net' is trained to recognize the save patterns...

if input some situation ((19,33) again) we have to calc the distance of the inputed vector to our saved vectors(target vectors)... then we have to find the target vector with the shortest distance to our input vector and to perfrom the action linked to our target vector (in out case run away)

this is what kohonen is based on...and I was rather suprised to find out that it is so easy....

you can gain great results by passing more inputs describing the actual situation of your 'bot' or whatever and using the 'right' target vectors... you need to experiment a bit or maybe you can use reinforcement learning to optimize your targetvectors..but that's another story..

you should group problems to several levels...means that you have highlevel problems like obbey the groupleader and attack a certain enemy from behind or not cause your live is in danger ..and low level ones like low health -> run and have one 'net' (no idea how to call my thing) for each level and maybe some if the structs linking em..so you can work realy complex bahviour... and remember..all this stuff can be seen some logical analyser only ..so if you want more human behavior you can introduce some randomness or take a 'bot's feelings as input or so...

I found a good site on reinforcement at
http://www-anw.cs.umass.edu/~mharmon/rltutorial/frames.html

the site that got my thinking about all this is:
http://www.botepidemic.com/neuralbot/nb_sites2.htm

and I got info on neural nets from
http://www.generation5.org/

thx to everybody who helped me with this kinda stuff including Adam Moveranski(hope I spelled it right:) , Aleks Jakulin , Alexandra Kalamar (for beeing so sweet :)

my mum just came down and complained that I don't work for school..so I hope it was worth it and some ppl read this and maybe mail me teir ideas/results/comments!! (I'm waiting.. !)

next time I'll be dealing with a 'new' way of usong dlls to modularize your apps.. but as said..I'm never shure if soembody else had this idea before...so If I'm saying old standart shit..just lemmu know and I'll shut up and try to find something better...

happy new year,
happy coding,
happy what ever...
and try to find your own solutions..do not just recode what's already there...

greets,
Alex





  • 07/05/2000 - fastculling
  • 05/15/2000 - parties&fpu fun
  • 04/03/2000 - Tech File Update
  • 02/11/2000 - Tech File Update
  • 01/14/2000 - Tech File Update
  • 06/28/1999 - Rendering Cities
  • 06/24/1999 - Bones Animation
  • 06/22/1999 - Introduction

  • This document may not be reproduced in any way without explicit permission from the author and flipCode. All Rights Reserved. Best viewed at a high resolution. The views expressed in this document are the views of the author and NOT neccesarily of anyone else associated with flipCode.

    [an error occurred while processing this directive]