@@ 31-41 (lines=11) @@ | ||
28 | return self.value > other.value |
|
29 | def __ge__(self, other): |
|
30 | return self.value >= other.value |
|
31 | class ReversedFitnessValue(FitnessValue): |
|
32 | def __init__(self, value): |
|
33 | super(ReversedFitnessValue, self).__init__(value) |
|
34 | def __lt__(self, other): |
|
35 | return self.value > other.value |
|
36 | def __le__(self, other): |
|
37 | return self.value >= other.value |
|
38 | def __gt__(self, other): |
|
39 | return self.value < other.value |
|
40 | def __ge__(self, other): |
|
41 | return self.value <= other.value |
|
42 | ||
43 | ||
44 | _ORDERING_HASH = defaultdict(lambda: 'natural', perplexity='reversed') |
|
@@ 20-30 (lines=11) @@ | ||
17 | return "{:.2f}".format(self.value) |
|
18 | def __repr__(self): |
|
19 | return "{:.2f}".format(self.value) |
|
20 | class NaturalFitnessValue(FitnessValue): |
|
21 | def __init__(self, value): |
|
22 | super(NaturalFitnessValue, self).__init__(value) |
|
23 | def __lt__(self, other): |
|
24 | return self.value < other.value |
|
25 | def __le__(self, other): |
|
26 | return self.value <= other.value |
|
27 | def __gt__(self, other): |
|
28 | return self.value > other.value |
|
29 | def __ge__(self, other): |
|
30 | return self.value >= other.value |
|
31 | class ReversedFitnessValue(FitnessValue): |
|
32 | def __init__(self, value): |
|
33 | super(ReversedFitnessValue, self).__init__(value) |