X-Git-Url: https://ruin.nu/git/?p=germs.git;a=blobdiff_plain;f=src%2Fmodelidentifier.cpp;h=820d75abd73bbc58a215a704652502e17388893a;hp=56b6935c48a4050bda6be087f9899f8f2af45b40;hb=f8575ea6c0982bba5ccf42771b2994d19500c0a3;hpb=67df9f01df85be7e0ddcc0d53c89534aae009ed9 diff --git a/src/modelidentifier.cpp b/src/modelidentifier.cpp index 56b6935..820d75a 100644 --- a/src/modelidentifier.cpp +++ b/src/modelidentifier.cpp @@ -22,6 +22,8 @@ #include "genealgorithms.h" #include +#include "models.h" +#include "model.h" using namespace std; @@ -36,7 +38,7 @@ ModelIdentifier::~ModelIdentifier(){ fann_destroy(_ann); } -std::map ModelIdentifier::identify(const GeneOrder& go){ +priority_queue > ModelIdentifier::identify(const GeneOrder& go){ int pos = 0; int neg = 0; for (GeneOrder::iterator g = go.begin(); g != go.end(); ++g){ @@ -78,22 +80,11 @@ std::map ModelIdentifier::identify(const GeneOrde double *output = fann_run(_ann,&input[0]); - map scores; - scores[X] = output[0]; - scores[Zipper] = output[1]; - scores[Whirl] = output[2]; - scores[FatX] = output[3]; - scores[Cloud] = output[4]; + priority_queue > scores; + scores.push(pair(output[0],Model(new Models::X))); + scores.push(pair(output[1],Model(new Models::Zipper))); + scores.push(pair(output[2],Model(new Models::ModelImpl))); + scores.push(pair(output[3],Model(new Models::FatX))); + scores.push(pair(output[4],Model(new Models::Cloud))); return scores; } - -string ModelIdentifier::modelName(Model m){ - switch (m){ - case Whirl : return "Whirl"; - case X : return "X"; - case FatX : return "FatX"; - case Zipper : return "Zipper"; - case Cloud : return "Cloud"; - } - return "Unknown model"; -}