X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=src%2Fmain.cpp;h=94109b4e4cce83e47329ce482186e44b740722f7;hb=97b75639e059f35874dd8f71f86cb36f6ec4e4a4;hp=1c6a85ecc85790716e6a8559e1ea86117d716922;hpb=90e2c43b99205b0d7a300209011231cd8d11f7a0;p=germs.git diff --git a/src/main.cpp b/src/main.cpp index 1c6a85e..94109b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,15 +12,8 @@ using namespace std; #include "modelidentifier.h" #include "genesorter.h" #include "sortaction.h" - -typedef pair modelpair; - -struct ScoreCmp { - template - bool operator()(T s1, T s2){ - return s1.first < s2.first; - } -}; +#include "genealgorithms.h" +#include "model.h" int main(int argc, char** argv){ @@ -67,23 +60,25 @@ int main(int argc, char** argv){ //TODO: Identify ModelIdentifier mi(ann); - map scores = mi.identify(go); - priority_queue,vector >, ScoreCmp > pq; - for (map::iterator m = scores.begin(); - m != scores.end(); ++m){ - if (m->second > 0){ - pq.push(pair(m->second,m->first)); - } - } - while (pq.size() > 0){ - cout << "Model: " << mi.modelName(pq.top().second) << " score: " << pq.top().first << endl; - pq.pop(); - } + priority_queue > pq = mi.identify(go); + Model model = pq.top().second; + //while (pq.size() > 0){ + cout << "Model: " << model.name() << " score: " << pq.top().first << endl; + //pq.pop(); + //} + + cout << "Distance: " << inversionDistance(go) << " : "; + copy(go.begin(), go.end(), ostream_iterator(cout, " ")); + cout << endl; //TODO: Chose a sorter GeneSorter so; //TODO: Sort - GeneSorter::ActionList al = so.sort(go); + GeneSorter::ActionList al = so.sort(go,model); + + for (GeneSorter::ActionList::iterator sa = al.begin(); sa != al.end(); ++sa){ + cout << "Action: " << sa->toString() << " model score: " << model.score(*sa,go) << endl; + } //TODO: Print result return EXIT_SUCCESS; }