Skip to content

Conversation

@HenrikMettler
Copy link
Contributor

Addresses #373. This is based on an implementation I used in a project with hal-cgp, thus the default values for permissible-values. There is two open questions, marked as todo in the code comments.

For convenience i put a short example at the end. I can extend this to a full example before merging or remove it.

@HenrikMettler HenrikMettler self-assigned this Nov 21, 2022
@HenrikMettler HenrikMettler force-pushed the dev/random_local_search branch from 2f6ee3b to 7865a93 Compare November 21, 2022 14:23
@HenrikMettler
Copy link
Contributor Author

(CI-check fail seems like an unrelated mypy issue)

@HenrikMettler HenrikMettler requested a review from jakobj November 21, 2022 14:28
Copy link
Member

@jakobj jakobj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great stuff, thanks for working on this! 🚀

I left a few comments, please address them before we merge this

objective: Callable,
seed: int,
n_steps: int = 10, # todo: should this be dependent on the number of parameters?
permissible_values: np.ndarray = np.logspace(start=0, stop=7, num=8, base=2, dtype=int),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the current implementation, is it, for example, possible to say "parameters should be uniformly sampled in the interval [0, 1]"? if not, I think it would be a good idea to make the generation of permissible values modular to support such use cases

params=params_sampled, params_names=params_names
)
# evaluate fitness
self.objective(new_ind)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, the local-search objective should not modify individuals but return a fitness value

ind.fitness = new_ind.fitness


if __name__ == "__main__":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rest should be moved into a test I guess ;)

@jakobj jakobj added this to the 0.4.0 milestone Dec 6, 2022
@jakobj jakobj linked an issue Dec 6, 2022 that may be closed by this pull request
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.

Local search randomly over a set of values

3 participants