I have made a genetic algorithm in Java, it's in the form of a library that can be added to several applications. During development I've made some (jUnit) tests that could be functional tests, but they don't have asserts because the algorithm is nondeterministic. So, they are not suitable for automatic testing, and when run a time later you must spend time to see what to look at the solution.
Solutions are vehicle routes, can be print out to XLS format, and actual tests are made at the time that a necessity arises, so you know what to look for in that very moment. They have a distance value and a time value, that have a reasonable values for every example, and the route itself, that must not have certain zig-zags though sometimes there just must be zig-zags.
I could just assert that that values are in that reasonable ranges, but these are not clear and I wouldn't be sure I don't left in bad solutions. It would be great to know what people is doing if anything or what do you think about this matter.
EDIT: To clarify the goal:
- Unit testing is pretty solved. I could isolate random number generation code from logic code in diferent functions, and I test logic functions passing them non random numbers from testing code.
- I want to have some functional tests ala Cucumber or Selenium tests, with no fake data. Real input that generates real output. (I'm not saying I wanna use Cucumber or Selenium specifically, only saying that what I asking for is not unit testing and that the behavior of the algorithm must be real and no faked in any way)
The library is used in diferent projects, and the input data of every project follows the same model, but it's biased in diferent ways. One project data can have lots of repetitions of the same point, while another project don't. One can have vehicles that reach the limit capacity very fast, while at others this limit hardly can be reached.
The goal is to have sample data from every project which is inserted in, in order to have fast feedback of the behavior of the algorithm while modifying it (like modifying or adding mutation or crossover operators, or adding new parametrization). Thus its behavior must not be faked in any way.
Given all this, the problem I ask about is to find a way to make effective asserts of the whole behavior. I wanted to ask how other have dealt with this problem, or what do you guys can say about it.