GreedyCrossOver using IntegerGene in distance()

View: New views
2 Messages — Rating Filter:   Alert me  

GreedyCrossOver using IntegerGene in distance()

by Vivek Mittal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I've just downloaded JGAP with a view to learn how to use it.  I
thought I'll start with the TravellingSalesman example first.  I have
modified the example class to use StringGene instead of IntegerGene
and have updated the abstract distance method to my own distance
function.  When I execute the code, I get a ClassCastException thrown
by GreedyCrossover.distance saying that it was expecting IntegerGene
and not StringGene.  Looking at the docs for GreedyCrossover, it says
that the distance function just takes the difference between the two
IntegerGene functions - the same as the sample code.

How do I make it use the distance function that I have written.  Do I
have to modify the class as provided by JGAP or do I just extend it.
If I extend it, what else do I need to change in the
TravellingSalesman class to make it use the extended class.

Thanks

Vivek

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users

Parent Message unknown Re: GreedyCrossOver using IntegerGene in distance()

by Klaus Meffert-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Vivek,

it seems as if you should modify (or copy and adapt) the GreedyCrossover class. You also have to care about the mutation operator class. Your fitness function should already work with strings, I assume. The evolution process should be generic enough to fit your needs.

Maybe just try it. It should not take that much time to get first feedback from a program run.

Best

Klaus
----- original Nachricht --------

Betreff: [jgap-users] GreedyCrossOver using IntegerGene in distance()
Gesendet: Fr, 18. Jul 2008
Von: Vivek Mittal<vivek@...>

> Hi,
>
> I've just downloaded JGAP with a view to learn how to use it.  I
> thought I'll start with the TravellingSalesman example first.  I have
> modified the example class to use StringGene instead of IntegerGene
> and have updated the abstract distance method to my own distance
> function.  When I execute the code, I get a ClassCastException thrown
> by GreedyCrossover.distance saying that it was expecting IntegerGene
> and not StringGene.  Looking at the docs for GreedyCrossover, it says
> that the distance function just takes the difference between the two
> IntegerGene functions - the same as the sample code.
>
> How do I make it use the distance function that I have written.  Do I
> have to modify the class as provided by JGAP or do I just extend it.
> If I extend it, what else do I need to change in the
> TravellingSalesman class to make it use the extended class.
>
> Thanks
>
> Vivek
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> jgap-users mailing list
> jgap-users@...
> https://lists.sourceforge.net/lists/listinfo/jgap-users
>

--- original Nachricht Ende ----


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jgap-users mailing list
jgap-users@...
https://lists.sourceforge.net/lists/listinfo/jgap-users
LightInTheBox - Buy quality products at wholesale price