--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2006 by Michael Andreen *
+ * andreen@student.chalmers.se *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
+ ***************************************************************************/
+
+#include "modelidentifier.h"
+#include "genealgorithms.h"
+
+#include <doublefann.h>
+
+using namespace std;
+
+ModelIdentifier::ModelIdentifier(std::string ann){
+ _ann = fann_create_from_file(ann.c_str());
+ if(!_ann){
+ throw invalid_argument("Could not create network");
+ }
+}
+
+ModelIdentifier::~ModelIdentifier(){
+ fann_destroy(_ann);
+}
+
+std::map<ModelIdentifier::Model,double> ModelIdentifier::identify(const GeneOrder& go){
+ int pos = 0;
+ int neg = 0;
+ for (GeneOrder::iterator g = go.begin(); g != go.end(); ++g){
+ if (*g >= 0)
+ ++pos;
+ else
+ ++neg;
+ }
+ map<Model,double> scores;
+ scores[X] = 1;
+ scores[Whirl] = -1;
+ return scores;
+}