Skip to content

Conversation

ahmedfgad
Copy link
Owner

There are many improvements but the main contribution is introducing a new parameter called gene_constraint that accepts constraints about each individual gene.

For example,

pygad.GA(..., gene_constraint=[lambda solution: solution[0]>20])

It has the limitation of not detecting the dependencies among the genes. For example, it must detect that gene 0 depends on gene 1 and thus it has to enforce the gene constraint for gene 1 at first. But this is not supported yet.

pygad.GA(..., gene_constraint=[lambda solution: solution[0]>solution[1], lambda solution: solution[0]>20])

@ahmedfgad ahmedfgad merged commit e6ba8e1 into master Jul 6, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant