You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Atm the easiest way to deal with this is probably within the objective function, ie by penalizing such terms with a fitness penalty eg:
defobjective(individual):
f=individual.to_numpy()
f_sympy=individual.to_sympy()
# your normal evaluationindividual.fitness=evaluate(f)
# penalize high exponentsifexponent_too_high(f_sympy)
individual.fitness-=penaltyreturnindividual
Where exponent_to_high is a function that evaluates your sympy expression, according to your criteria (my guess is that for the high exponents you would have to use sympy log, however this obviously depends on the exact problem)
Another way, if expression in general get "too complex" is to reduce the length of the genome (n_rows and n_columns).
Currently we don't have a built-in feature for measuring expression complexity yet, however this for sure is on the list for future extensions.
it would certainly make for an interesting example to show how one can add a penalty term in the objective which is, for example, exponential in the largest exponent of the expression. anyone up for this? happy to review the corresponding PR ;)
Is it possible to tell CGP to exclude certain terms/operations in the formulae, for instance avoid to high exponents?
The text was updated successfully, but these errors were encountered: