[galib] customization problem

#SAWHNEY ADITI# aditi at pmail.ntu.edu.sg
Thu Jun 9 03:18:15 EDT 2005


Supposing these below are the protoptypes for my customized initializer and objectiev functions.

float objective(GAGenome &, float);

void RouteInitializer(GAGenome &, float );

 
my question is how now do i pass the float parameter to teh fiunctions. normally to make gagenome use my customized function i would just issue:
GARealGenome genome(numCustomer+numVeh, alleles, objective);

genome.initializer(RouteInitializer);

but how will i pass my float parameter? oor should i make my parameter a global variable?

I'm sorry for the amateurish quetsiosn but i am new to galib and c++.

Thanks,

Aditi


________________________________

From: galib-bounces at mit.edu on behalf of Christian S. Perone
Sent: Tue 6/7/2005 3:30 AM
To: galib at mit.edu
Subject: Re: [galib] minimization problem



Hello,

*GALinearScaling*(float c = /gaDefLinearScalingMultiplier/)
    The fitness scores are derived from the objective scores using the
    linear scaling method described in Goldberg's book. You can specify
    the scaling coefficient. *Negative objective scores are not allowed
    with this method.* Objective scores are converted to fitness scores
    using the relation

You can read in http://lancet.mit.edu/galib-2.4/API.html about the
Linear Scaling that not
allow negative scores. To minimize the objective function just call
ga.minimize(), like Anthony said.
This function is in GABaseGA.h:
    (...)
       int minimize() { return minimaxi(MINIMIZE); }

and the minimaxi() is in GABaseGA.c:
    (...)
       if(m==MINIMIZE)
          pop->order(GAPopulation::LOW_IS_BEST);

I hope that this can help.

energenius energenius wrote:

> Hi,
>
> I'm using GALib.2.4.5 with VC6.0. I want to minimize my objective
> function. Although my program works properly in maximization, when I
> use ga.minimize(), it stucks and gives no response. How can i solve
> this problem?
>
> May adding a minus sign in front of the objective function be a solution?
>
> Thanks in advance.
>
> _________________________________________________________________
> En etkili ve güvenilir PC Korumayi tercih edin, rahat edin!
> http://www.msn.com.tr/security/
>
> _______________________________________________
> galib mailing list
> galib at mit.edu
> http://mailman.mit.edu/mailman/listinfo/galib
>
>


       
       
               
____________________________________________________
Yahoo! Mail, cada vez melhor: agora com 1GB de espaço grátis! http://mail.yahoo.com.br
_______________________________________________
galib mailing list
galib at mit.edu
http://mailman.mit.edu/mailman/listinfo/galib





More information about the galib mailing list