> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Carlos
> Sent: 12 January 2007 16:09
> To: [email protected]
> Subject: [Tutor] Problems with a Class
>
> This is the area of the algorith that I think holds the info
> that I need:
>
> def evolve(self, generations = 100):
>
> self.halt_reached = 0
>
> for gen in range(generations):
>
> #Changed.
> print 'GEN:',gen, self.entities
>
> self.do_mutation()
> self.do_crossover()
> print "Average fitness generation " + str(gen) + ": " +
> str(self.avg_fitness())
> if self.debug == 1:
> self.echo_fitness()
> if self.halt >= 0:
> max_entity = self.get_max_fitness()
> fit = self.calc_fitness(max_entity)
> if fit >= halt:
> self.halt_reached = 1
> return [max_entity]
I think if you change this line to:
return self.entities, [max_entity]
And handle the return as a tuple of two lists, you should get what you
want. It does mean changing the code that calls this function to handle
the different return value, of course.
dom
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor