So I've written an implementation of the ant colony optimization (ACO) meta-heuristic, and I'd like to write some unit tests. However, I'm not sure of the best way to test a method whose ability to return "correct" answers varies depending on various settings.
How does one unit test a heuristic algorithm?
Code lives at https://github.com/rhgrant10/pants by the way.
I test my TSP implementation with this integration test class , which does 2 tests:
On top of that, I have unit tests to test the specific components of my algorithm, to check if they behave as expected, for example this unit test class .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.