|
From: | Nicolas Garrido |
Subject: | Trouble Memory |
Date: | Tue, 11 May 1999 10:12:42 +0200 |
Hi, I need your help please.
I am making a simulation where each agent
uses Genetic Algorithms for taking a decision about what
is her/his best coalition.
In each step of simulation every agent
starts from an initial population of coalitions and calculates her/his best
coalition by AG.
As I had problems with
memory I simplify (the inessential code has been removed) the
code for understanding where the problem is and finally I arrived to this
code:
- processMessage { [self makePopulation]; // Here, the agent must make her/his calculation by AG // .................. [self clearPopulation]; return self;}
- (void) makePopulation{ unsigned i; curPopMap=[Map create:[self getZone]]; for (i=0 ; i<popSize ;i++){ Coalition *c; c=[Coalition createBegin: [self getZone]]; [c setOwnerID:selfID]; c=[c createEnd]; [c randomInit]; [curPopMap at:c insert: c]; } } - (void) clearPopulation { [curPopMap removeAll]; } Initially, in the simulation there are n-Agent
and the Scheduler calls for each agent the message processMessage.
The problem is that the use of memory raises quickly. I thought that
with [curPopMap removeAll] I could free the memory.
I will welcome any suggestions on how to handle this problem and any
suggestions about memory administration.
Thanks
Nico.
|
[Prev in Thread] | Current Thread | [Next in Thread] |