First, "abeatsb" means A-beats-B, with A=this, and B=other.
Now betterThan returns true IFF A beats B on some objective and B never
beats A (on any objective).

-I return false as soon as B beats A on some objective x, since A
can't be better than B.   No need to visit the rest of the criteria.

-If A beats B on some objective, or they tie, you need to go on; however,
if they're always equal, the correct return value is false. That's where
the variable abeatsb comes in: it detects A=B.

Bottom line: betterThan returns true if 2 conditions are satisfied:
1. B never beats A: that's satisfied when I'm done with all objectives (no
premature "return false" along thew way)
2. A beats B at least once: that's "abeatsb"

I guess I should have called it abeatsbAtLeastOnce.


On Sun, 20 Sep 2009, Zheng Yin wrote:

> Hi, Sean,
> I just try to use the multi-objective and have some query about the code
> below. About the betterThan function,
> for (int x=0;x<multifitness.length;x++)
>                 {
>                 if (multifitness[x] > other.multifitness[x]) abeatsb =
> true;
>                 if (multifitness[x] < other.multifitness[x]) return false;
>                 }
>             }
> Shall "if (multifitness[x] < other.multifitness[x]) return false;"
> should be "if (multifitness[x] < other.multifitness[x]) abeatsb= false;"???
> With the current code not all the criteria will go through.
> Thanks very much and looking forward to your answer.
> Zheng