Skip to content
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

[BUGFIX] Create reproducible version of random search layout optimizer for testing #940

Merged
merged 4 commits into from
Jul 10, 2024

Conversation

misi9170
Copy link
Collaborator

@misi9170 misi9170 commented Jul 9, 2024

As reported in #936 , the regression tests for the random search layout optimizer can sometimes fail. I believe that the cause for this is that the optimizer is run for one second during the test; however, depending on the machine, it may take more or less steps over that period.

This PR alters the LayoutOptimizationRandomSearch code to make it modular, and then adds a debugging version of the optimization routine that will take a fixed number of steps (in particular, 100 random perturbations per generation, 1 individual per generation, and 2 generations).

This should enable reproducible regression test results.

@misi9170 misi9170 added the bug Something isn't working label Jul 9, 2024
@misi9170 misi9170 requested a review from paulf81 July 9, 2024 19:43
@misi9170
Copy link
Collaborator Author

misi9170 commented Jul 9, 2024

Note that after the changes, I still get the same result (as on the develop branch) running examples/examples_layout_optimization/003_genetic_random_search.py if I fix the random seed to the LayoutOptimizationRandomSearch.

Copy link
Collaborator

@paulf81 paulf81 left a comment

Choose a reason for hiding this comment

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

Looks good! Can confirm now test passes on my machine in both regular and debug mode, tricky one, nice job!

@misi9170 misi9170 merged commit 3d13d91 into NREL:develop Jul 10, 2024
8 checks passed
@misi9170 misi9170 deleted the bugfix/grs_debug branch July 10, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants