Happy-Algorithms-League / hal-cgp

Cartesian genetic programming (CGP) in pure Python.
GNU General Public License v3.0
28 stars 10 forks source link

Allow printing of individual with `fitness=None` for all objectives #383

Open jakobj opened 7 months ago

jakobj commented 7 months ago

At the moment one can not print an individual before its fitness (for any objective) is determined. Ultimately this is caused by, e.g., this call sequence IndividualSingleGenome::__repr__->IndividualBase::fitness in which the following check breaks

if len(fitness_all_objectives) == 0:
    raise runtimeerror(f"fitness of individual {self.idx} is none for all objectives.")

https://github.com/Happy-Algorithms-League/hal-cgp/blob/master/cgp/individual.py#L49

Not sure why this was introduced in the first place, but we should make sure nothing else breaks when removing this check.