Commit 6aed89a6 by Robert Ricci

Add a new function to test for equality of two scores - just make

```sure they're within some tolerance of each other. Use this so that
cumulative float point errors don't cause us to spit out scary
looking false positive warnings.```
parent 75de1dc5
 ... ... @@ -978,7 +978,7 @@ NOTQUITEDONE: // Check to make sure that our 'clean' solution scores the same as // the initial score - if not, that indicates a bug if (get_score() != initial_score) { if (!compare_scores(get_score(),initial_score)) { cerr << "*** WARNING: 'Clean' score does not match initial score" << endl << " This indicates a bug - contact the operators" << endl << " (initial score: " << initial_score << ... ...
 ... ... @@ -720,7 +720,7 @@ int main(int argc,char **argv) fclose(deltaout); #endif if ((get_score() > absbest) || (violated > absbestviolated)) { if ((!compare_scores(get_score(),absbest)) || (violated > absbestviolated)) { cerr << "Internal error: Invalid migration assumptions." << endl; cerr << "score:" << get_score() << " absbest:" << absbest << " violated:" << violated << " absbestviolated:" << ... ...
 ... ... @@ -6,6 +6,14 @@ #include "solution.h" bool compare_scores(double score1, double score2) { if ((score1 < (score2 + ITTY_BITTY)) && (score1 > (score2 - ITTY_BITTY))) { return 1; } else { return 0; } } /* * Print out the current solution */ ... ...
 ... ... @@ -38,6 +38,14 @@ extern assigned_map absassigned; /* Print a solution */ void print_solution(); /* Check to see if two scores are, for all intents and purposes, the same */ bool compare_scores(double score1, double score2); /* The amount by twhich two scores can differ and still look the same - should * be << than the smallest possible weight */ const double ITTY_BITTY = 0.00001; /* * These structs are used for traversing edges, etc. to produce graphviz * outputs. They are used as functors. ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!