11 #include "geneorder.h"
12 #include "modelidentifier.h"
13 #include "genesorter.h"
14 #include "sortaction.h"
16 typedef pair<ModelIdentifier::Model,double> modelpair;
20 bool operator()(T s1, T s2){
21 return s1.first < s2.first;
25 int main(int argc, char** argv){
27 string ann = "default.ann";
30 while ((opt = getopt(argc, argv, "n:h")) != -1) {
36 cout << "Usage: " << argv[0] << " [OPTION] [FILE]" << endl
37 << endl << " -n <ann> Specifies which artificial neural network to use for identification. '" << ann << "' is used by default"
38 << endl << " -h Prints this help message"
40 << "With no FILE, or if FILE is '-', stdin will be used"
45 cerr << "Usage: " << argv[0] << " [-n <ann>] [-h] [FILE]" << endl;
52 if (optind == argc || *argv[optind] == '-'){
55 file.open(argv[optind]);
57 cerr << "Could not open file: '" << argv[optind] << "'" << endl;
64 copy(istream_iterator<int>(*in), istream_iterator<int>(),
66 GeneOrder go(g.begin(),g.end());
69 ModelIdentifier mi(ann);
70 map<ModelIdentifier::Model,double> scores = mi.identify(go);
71 priority_queue<pair<double,ModelIdentifier::Model>,vector<pair<double,ModelIdentifier::Model> >, ScoreCmp > pq;
72 for (map<ModelIdentifier::Model,double>::iterator m = scores.begin();
73 m != scores.end(); ++m){
75 pq.push(pair<double,ModelIdentifier::Model>(m->second,m->first));
78 while (pq.size() > 0){
79 cout << "Model: " << mi.modelName(pq.top().second) << " score: " << pq.top().first << endl;
83 //TODO: Chose a sorter
86 GeneSorter::ActionList al = so.sort(go);