Hi,
I'm sorry if this is a silly thing to ask but it has been bugging me for a bit and seems to be the only loose end in my project...
I am implementing the Travelling Salesman Problem in
java and have created an application that compares 6 of the existing heuristics.
I however, have problems with determining the time that each heuristic takes to run. What I have done for the time being is:
void heuristic() {
before = System.currentTimeMillis();
//TSP Heuristic
after = System.currentTimeMillis();
timeSpent = after - before;
}
After running the same heuristic with the same input several times, I have found that the value of timeSpent varies by �30 milliseconds which isn't very satisfactory.
I was wandering if anyone might be able to offer a suggestion as to how I could improve the accuracy of the heuristic timing.
Any help would be greatly appreciated...