NetLogo - How to give memory to agents -
here give problem , code.
problem: each agent attaches each position m (each m has fixed amount of food, worse, better) score u_im updated in course of time. scores set zero. every time player chosen access resources, probability epsilon choses position @ random, otherwise choses positions sequentially in order of highest score registered far. every position visited, score updated u_im -> u_im - c (the cost) if position found occupied , u_im -> u_im + u_mi if found free.
how can create array u_mi? (that saves best resources (=the ones more food) have visited far)
edit//: ok, did it!
if needs kind of code, feel free contact me :)
that's impressive code 1 day's experience !
yes, list of payoff-memory nomads_own variable how it. have keep both position , payoff or won't able sort them. may want limit memory (eg last 5 or best 5 or similar) if starts slowing down because asking every turtle keep list of patches.
on question of 'not doing anything' - possible while
loop stuck if there aren't available locations. try doing way (which better anyway has select once):
to move-to-empty-one-of [locations] ;; nomads procedure let candidates locations [not any? nomads-here] if any? candidates [ move-to one-of candidates ] end
note: not tested
Comments
Post a Comment