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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With