[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"zone" or "getZone"? and one additiona question.
From: |
Jae Chan Oh |
Subject: |
"zone" or "getZone"? and one additiona question. |
Date: |
Thu, 13 Mar 1997 17:59:31 -0500 (EST) |
Hi Glen, thansk a lot for all your help. My program
seems to be very close to a workable version.
Two questions though:
(1)
In an older version of GA lib. by Merelo, they use "zone" for
the argument for createBegin. i.e. as follows:
gen = [BinChromosome createBegin: zone];
Instead, I would like to use:
gen = [BinChromosome createBegin: [self getZone]]
What are the differences? (I'm using "zone" for my current
version since I'm using old version of GA lib but...)
(2)
I have a strange error that I can get around it but I don't like
the error anyway (and who does?):
I have a method called "updatePersonEnergy" for a Person class.
When I try to call this method as follows I get core dump
in the middle of program run. I mean the method is called
succefully for, say, 5 or 6 times then the core dump.
energySpent1 = -((double) (numInspected * inspectCost));
[self updatePersonEnergy: energySpent1];
So I changed the above line as follows:
energySpent1 = -((double) (numInspected * inspectCost));
if (energySpent1 + [self getPersonEnergy] < 0.0)
energySpent1 = 0.0;
else if (energySpent1 + [self getPersonEnergy] > MAX_ENERGY)
energySpent1 = MAX_ENERGY;
[self updatePersonEnergy: energySpent1];
Then it works fine. Now wait! wait not so fast. :-)
I already do have these guard statements of "ifs" in my updatePersonEnergy
method as follows.
-updatePersonEnergy: (double) v
{
double temp;
if ((energy + v) < 0.0)
energy = 0.0;
else if ((energy + v) > MAX_ENERGY)
energy = MAX_ENERGY;
else
energy = energy + v;
return self;
}
Now I can only conclude that the "updatePersonEnergy" method does not like to
receive a big number as an argument. The energySpent with the if statements
can be as big as +80*80*1 or as small as -80*80*1. But these are not that
big numbers though. BTW, energySpent1 is declared as a double type so
it should be compatible with the argument type of "updatePersonEnergy".
But again, when I trim the value with the above if statement, the
value can be from 0 to say 500. Without the trim,
I get error like: "can not recognize method updatePersonEnergy in Activity
for Each." after 5 or 6 successful call to the method "updatePersonEnergy".
Any ideas?
Thank you,
-Jae
- Re: problem with Raster, (continued)
- Re: problem with Raster, Sven Thommesen, 1997/03/06
- Re: problem with Raster, mcmullin, 1997/03/10
- Re: problem with Raster, Jae Chan Oh, 1997/03/10
- Building objects on the fly, glen e. p. ropella, 1997/03/10
- Re: Building objects on the fly, Jae Chan Oh, 1997/03/10
- Re: Building objects on the fly, glen e. p. ropella, 1997/03/11
- Re: Building objects on the fly, Jae Chan Oh, 1997/03/11
- Re: Building objects on the fly, glen e. p. ropella, 1997/03/11
- "zone" or "getZone"? and one additiona question.,
Jae Chan Oh <=
- Classifier systems, Tony Bigbee, 1997/03/13
- Maintaining a Debian Swarm package, Thor Sigvaldason, 1997/03/14
- Re: Maintaining a Debian Swarm package, Karl Sackett, 1997/03/14
- Re: Classifier systems, Rick Riolo, 1997/03/14
- "zone" or "getZone"? and one additiona question., J.J. Merelo Guervos, 1997/03/14
- Re: "zone" or "getZone"? and one additiona question., Jae Chan Oh, 1997/03/14
- Re: "zone" or "getZone"? and one additiona question., glen e. p. ropella, 1997/03/14
- "zone" or "getZone"? and one additiona question., glen e. p. ropella, 1997/03/14
- Re: "zone" or "getZone"? and one additiona question., Jae Chan Oh, 1997/03/15
- Re: "zone" or "getZone"? and one additiona question., Ken Cline, 1997/03/15