[galib] GAParameterList Trouble

hneil@fastwebnet.it hneil at fastwebnet.it
Fri Nov 4 14:49:20 EST 2005


My program puts heavy emphasis on using the GAParameterList for its use.
 I extend the class and add additional parameters.  I designed it so that
I can tweak the parameters prior to initializing the GA, and it will follow
that behavior (makes it easy to modify parameters).

Though, I have been getting odd behavior from it lately.

I'll show you what I mean.  In this particular code, I'm trying to randomly
generate a number between two float values, and assign it to a parameter.
 

        std::cout << "lin max = " << linearScalingMultiplierMaximum << "\n";
        std::cout << "lin min = " << linearScalingMultiplierMinimum << "\n";
        floattmp = GARandomFloat(linearScalingMultiplierMinimum,
                linearScalingMultiplierMaximum);
        std::cout << "floattmp = " << floattmp << "\n";

        n.set("HLLinearScalingMultiplier", floattmp);

        float floattmp2 = 8;
        n.get("HLLinearScalingMultiplier", &floattmp2);
        std::cout << "HLLinearScalingMultiplier = " << floattmp2 << "\n";

Outputs the following lines when run:

lin max = 1.6
lin min = 1
floattmp = 1.46855
HLLinearScalingMultiplier = 8

The only conclusion I can come up with is that get is not doing its job.
 This should work though, shouldn't it?  Passing a float pointer should have
itself assigned to the value to be returned, right?  It seems to ignore it
on the contrary.  

Thanks in advance for any help you could provide.

Neil

------------------
Neil S. Harmon
hneil at clemson.edu
(864)-858-4474





More information about the galib mailing list