Closed lxy3300 closed 8 months ago
Move the code to the src
directory and change the name to cultrual_algorithm.py
.
Add test_cultural_algorithm.py
for unit tests under the test
directory.
Changes for the code part:
fitness_function
to value_fitness
, and add two unit tests test_value_fitness_returns_correct_value
and test_value_fitness_raises_value_error
.initialize_population function
to a piece of code in the main part.accept
function, and add a unit test test_initialize_belief_space_returns_correct_value
.update
function to a pure function, and add the corresponding unit test test_update_returns_correct_value
.influence
functions to pure functions, and add the corresponding unit tests.influence_method_4
function.Changes for the cultural-algoritms.rst
:
Thanks for the feedback!
Fix bugs in cultural_algorithm.py
:
I found that update
and all influence
functions are still impure, so I changed the copy
to deepcopy
.
Modify test_cultural_algorithm.py
:
test_value_fitness_returns_correct_value
and test_value_fitness_raises_value_error
.test_initialize_belief_space_returns_correct_value
into 2 functions and modify the tests.test_update_returns_correct_value
into 2 functions.test_influence_method_1_returns_correct_value
, it should have all cases since it just has one case? But I still add one test case.influence
functions, I add one test case. This test case covers all cases under if condition.I'm not sure what I did. I wanted to resolve the conflict, so I fetched the new main for rebase, finally pushed, and then my pull request has more of everything under novelty search.
I changed the description of the belief space, the original description had some errors.
I'm not sure what I did. I wanted to resolve the conflict, so I fetched the new main for rebase, finally pushed, and then my pull request has more of everything under novelty search.
It's because the PR was not up to date with the main branch. I updated it --- problem solved.
What
Add site content related to cultural algorithm.
Why
This is for my lecture and my topic is cultural algorithm.
Where
Create a cultural-algorithms directory under /site/student-lectures, which contains added files. Add the cultural-algorithm site to toctree in index.rst.
How
Add rst file about the content of cultural algorithms. Add a figure showing the components of the cultural algorithm. Add a Python file for an example of the cultural algorithm.