trevorstephens / gplearn

Genetic Programming in Python, with a scikit-learn inspired API
http://gplearn.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.62k stars 283 forks source link

Constraint in gplearn #216

Closed JinkaiGUAN closed 2 years ago

JinkaiGUAN commented 3 years ago

Is your feature request related to a problem? Please describe.

When I am solving fluid dynamics problems using gplearn, I found it is really difficult for me to put some constraints on the individual, such as integration equal yo one. So do you have any simple or underlying idea for such problem?

Describe the solution you'd like

Additional context

trevorstephens commented 3 years ago

You cannont constrain the program but you could apply a heavy penalty in a custom fitness function which might have a similar affect. https://gplearn.readthedocs.io/en/stable/advanced.html#custom-fitness