Print

Print


I think the words you're looking for in English are minimize and maximize.  ECJ maximizes the fitness function; that is, it tries to find individuals with the largest value of the fitness function.  If you want to minimize; that is, the best solution to your problem is the individual with the smallest value of the fitness function, you can simply take the additive or multiplicative inverse of your problem's natural objective function as your fitness.  For example, if I am trying to find the route between two places that involves the fewest left turns, and I have written a function that counts the number of left turns in a route, then I can minimize using ECJ by making my fitness 1/(number of left turns).

Aside:  This isn't just a trivial example.  Big delivery companies like UPS and FedEx have discovered that they can save time and fuel by minimizing the number of left turns their trucks have to make in the course of delivering their packages.  :)

From: ECJ Evolutionary Computation Toolkit [mailto:[log in to unmask]] On Behalf Of André Pinz Borges
Sent: Monday, July 15, 2013 8:50 AM
To: [log in to unmask]
Subject: Re: How to select individual with minor fitness

Thanks Bojan for your answer...
How can I invert the fitness? I have to do this in my fitness function?


On Mon, Jul 15, 2013 at 9:16 AM, Bojan Janisch <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hey Andre,

why don't you just invert your fitness?

fitness best individual of generation 1: 5
fitness best individual of generation 2: 6
fitness best individual of generation 3: 4
fitness best individual of generation 4: 8
to

fitness best individual of generation 1: infinite - 5
fitness best individual of generation 2: infinite - 6
fitness best individual of generation 3: infinite - 4
fitness best individual of generation 4: infinite - 8

Now your max should be generation 3 because 4 is the lowest score.

minor and major can be easy inverted.

Greetings

Bojan


----- Ursprüngliche Mail -----
Von: "André Pinz Borges" <[log in to unmask]<mailto:[log in to unmask]>>
An: [log in to unmask]<mailto:[log in to unmask]>
Gesendet: Montag, 15. Juli 2013 14:03:59
Betreff: Re: How to select individual with minor fitness





Normally the algorithm selects the individual with major value of fitness, for the example above will be selected the individual of generation 4:
fitness best individual of generation 1: 5
fitness best individual of generation 2: 6
fitness best individual of generation 3: 4
fitness best individual of generation 4: 8

but I want to select the individual that has the mijor/less value of fitness (in the case of example, the generation 3).

Thanks








On Mon, Jul 15, 2013 at 4:03 AM, Sean Luke < [log in to unmask]<mailto:[log in to unmask]> > wrote:


I'm sorry, I don't know what you mean by "minor" and "major" fitnesses.

Sean



On Jul 14, 2013, at 10:27 PM, André Pinz Borges wrote:

> Hello,
>
> I implemented tutorial 3, but I would like to select the individual with minor value of fitness and the tutorial selects the individual with major fitness.
>
> How can I do this?? I look at source code, but I don't find how..
>
> Thanks!