Skip to content

Method callbacks for on_function and crossover/mutation set to None #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

borisarloff
Copy link

The modifications to pygad are annotated as "#barloff" for easy search. The modifications:
(1) Allow to pass the user's Class instance reference for persistence flow of computations
(2) The user Class instance reference is now an optional parameter (cls_inst) provisioned to GA class constructor
(3) The on_crossover and on_mutation references now are always executed, even when crossover_type and mutation_type are None.
Now, when the fitness function or a on_ (e.g., on_parents) callback is made, the user is passed a reference to its own class instance. The implementation has access to its own attributes from within the callbacks.

The modifications to pygad are annotated as "#barloff" for easy search. This modifications (1) allow to pass the user's Class instance reference for persistence flow of computations; (2) this Class instance reference is now declared in the on_ GA call implementations, set to None as default at the user side, and (3) specifically for on_crossover and on_mutation references now are always executed, even when crossover_type and mutation_type are None.
@ahmedfgad ahmedfgad added the enhancement New feature or request label Feb 25, 2023
@ahmedfgad
Copy link
Owner

Thanks @borisarloff. Such features are supported.

@ahmedfgad ahmedfgad closed this Mar 1, 2023
@borisarloff borisarloff deleted the barloff branch March 19, 2023 15:14
@borisarloff
Copy link
Author

@ahmedfgad, thank you for the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants