X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Fgenesorter.cpp;h=3ce89ad493d6163ee568a0f4e3697a1face13946;hb=cc8cefc83ca7216594d937b839673efafeee68f4;hp=03f19db1d8949ced3f18cb229671b590cb19acc0;hpb=7e811915a713eeef44f03385a1fc1f74a5301c30;p=germs.git diff --git a/src/genesorter.cpp b/src/genesorter.cpp index 03f19db..3ce89ad 100644 --- a/src/genesorter.cpp +++ b/src/genesorter.cpp @@ -35,15 +35,14 @@ GeneSorter::ActionList GeneSorter::sort(const GeneOrder& go){ ActionList al; GeneOrder temp(go); while(inversionDistance(temp) > 0){ - cout << "AL: " << al.size() << " : "; - cout << "Distance: " << inversionDistance(temp) << " : "; - copy(temp.begin(), temp.end(), ostream_iterator(cout, " ")); - cout << endl; + //cout << "Distance: " << inversionDistance(temp) << " : "; + //copy(temp.begin(), temp.end(), ostream_iterator(cout, " ")); + //cout << endl; ActionList safe = safeActions(temp); if (safe.size() > 0){ safe[0](temp); + cout << "Action: " << safe[0].toString() << endl; al.push_back(safe[0]); - cout << "AL: " << al.size() << " : "; }else return ActionList(); //TODO: Need to handle hurdles. } @@ -69,8 +68,8 @@ GeneSorter::ActionList GeneSorter::safeActions(const GeneOrder& go){ for (size_t i = 0; i < intervals.size(); ++i){ if (intervals[i].oriented && intervals[i].first != intervals[i].second){ SortAction sa(new ReverseAction(intervals[i])); - size_t score = scoreActions(go,sa); - cout << "Inversion: " << min(intervals[i].first,intervals[i].second) << ":" << max(intervals[i].first,intervals[i].second)-1 << " Score: " << score << endl; + size_t score = scoreAction(go,sa); + //cout << "Inversion: " << min(intervals[i].first,intervals[i].second) << ":" << max(intervals[i].first,intervals[i].second)-1 << " Score: " << score << endl; pq.push(pair(score,sa)); } } @@ -81,7 +80,7 @@ GeneSorter::ActionList GeneSorter::safeActions(const GeneOrder& go){ return al; } -size_t GeneSorter::scoreActions(const GeneOrder& go, SortAction& sa){ +size_t GeneSorter::scoreAction(const GeneOrder& go, SortAction& sa){ GeneOrder temp(go); sa(temp); vector intervals = findIntervals(temp);