Bug in the Genome class?

idevx <[email protected]> Wed, 15 Jun 2005 22:00:03 -0300 (ART)
Newsgroups gmane.comp.breve
Message-ID <[email protected]>
Hi, first of all, sorry! - It seems that every mail I
send to this list is to report a bug.

OK, I was having trouble with a simulation using a
Genome subclass, and so I made a test app to see if
the crossover operator was doing what I expected. It
wasn't :(
In the code below, I have three Genome subclass
objects, and I do a crossover between objects 1 & 2,
and save the result in 3, but in every case object 3
ends up being equal to object 2.

TIA

- Ignacio

Test Code:
------------
@include "Mobile.tz"
@include "Control.tz"
@include "Shape.tz"

@use Genome.

Controller myController.

Control : myController {
    + variables:
        thing1 (object).
        thing2 (object).
        thing3 (object).
               =20
    + to init:
        i (int).
        thing1 =3D new CrossoverTestThing.
        thing2 =3D new CrossoverTestThing.
        thing3 =3D new CrossoverTestThing.
        thing1 set-values one 1.0 two 2.0 three 3.0.
        thing2 set-values one 10.0 two 20.0 three
30.0.
        thing3 set-values one 100.0 two 200.0 three
300.0.
        print
"Before________________________________".
        thing1 print-self.
        thing2 print-self.
        thing3 print-self.
       =20
        for i=3D0, i < 5, i++:
        {
	        thing3 crossover from-parent-1 thing2
from-parent-2 thing2.
	        print
"After_________________________________".
	        thing1 print-self.
	        thing2 print-self.
	        thing3 print-self.
        }
       =20
        self end-simulation.
}
       =20
Genome : CrossoverTestThing
{
    + variables:
        one (float).
        two (float).
        three (float).
       =20
    + to set-values one newOne (float) two newTwo
(float) three newThree (float):
        one =3D newOne.
        two =3D newTwo.
        three =3D newThree.
       =20
    + to print-self:
        print "",self,":",one,two,three.
}

-------------------
Output:
Before________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 100.000000
200.000000 300.000000
After_________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 10.000000 20.000000
30.000000
After_________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 10.000000 20.000000
30.000000
After_________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 10.000000 20.000000
30.000000
After_________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 10.000000 20.000000
30.000000
After_________________________________
 CrossoverTestThing (0x4d4a1f0)  : 1.000000 2.000000
3.000000
 CrossoverTestThing (0x4d49bb0)  : 10.000000 20.000000
30.000000
 CrossoverTestThing (0x4d2f930)  : 10.000000 20.000000
30.000000


------------
http://www.wirelesshamster.com


	=09
___________________________________=20
A tu celular =BFno le falta algo?=20
Us=E1 Yahoo! Messenger y Correo Yahoo! en tu tel=E9fono celular.=20
M=E1s informaci=F3n en http://movil.yahoo.com.ar
_______________________________________________
breve mailing list
[email protected]
http://lists.spiderland.org/mailman/listinfo/breve