コード例 #1
0
ファイル: Indexes.cs プロジェクト: sadit/natix
        public static string Execute(IndexArgumentSetup setup, string nick, string idxname, Func<MetricDB, Index> create)
        {
            var resname = GetResultName (nick, idxname, setup, "");
            if (File.Exists (resname)) {
                return resname;
            }
            MetricDB db = SpaceGenericIO.Load (setup.BINARY_DATABASE);
            Index idx;

            if (!File.Exists (idxname)) {
                Console.WriteLine ("*** creating index {0}", idxname);
                var s = DateTime.Now.Ticks;
                var c = db.NumberDistances;
                idx = create (db);
                SaveConstructionTime (idxname, DateTime.Now.Ticks - s, db.NumberDistances - c);
                IndexGenericIO.Save (idxname, idx);
            } else {
                idx = IndexGenericIO.Load (idxname);
            }

            if (!File.Exists (resname)) {
                PerformSearch (resname, idx, idxname, setup);
            }

            return resname;
        }
コード例 #2
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 // sisap 2012 version
 public static string ExecuteApproxGraph(IndexArgumentSetup setup, string nick, int neighbors, int restarts)
 {
     var idxname = String.Format ("{0}/Index.ApproxGraph.neighbors={1}-restarts={2}", nick, neighbors, restarts);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new ApproxGraph ();
         IDX.Build (db, (short)neighbors, (short)restarts);
         return IDX;
     });
 }
コード例 #3
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteAPG_OptTabuSatNeighborhoodMontecarloStart(IndexArgumentSetup setup, string nick)
 {
     var idxname = String.Format ("{0}/Index.APG-OptTabuSatNeighborhoodMontecarloStart", nick);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new APG_OptTabuSatNeighborhoodMontecarloStart ();
         IDX.Build (db);
         return IDX;
     });
 }
コード例 #4
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteLocalSearchMontecarloBeam(IndexArgumentSetup setup, string nick, int beamsize, int neighbors)
 {
     var idxname = String.Format ("{0}/Index.LocalSearchMontecarloBeam.beamsize={1}-neighbors={2}", nick, beamsize, neighbors);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new LocalSearchMontecarloBeam ();
         IDX.Build (db, neighbors, beamsize);
         return IDX;
     });
 }
コード例 #5
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteSeq(IndexArgumentSetup setup, string nick)
 {
     var idxname = String.Format ("{0}/Index.Seq", nick);
     return Execute (setup, nick, idxname, (db) => {
         var seq = new Sequential ();
         seq.Build (db);
         return seq;
     });
 }
コード例 #6
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteSATForest(IndexArgumentSetup setup, string nick)
 {
     var idxname = String.Format ("{0}/Index.SATForest", nick);
     return Execute (setup, nick, idxname, (db) => {
         var expected_prob = 0.9;
         var prob = 0.17;
         var satapprox = new  SAT_Forest();
         int numindexes = (int)Math.Ceiling(Math.Log(1.0 - expected_prob) / Math.Log(1 - prob));
         satapprox.Build(db, numindexes, new Random());
         return satapprox;
     });
 }
コード例 #7
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteSATApprox(IndexArgumentSetup setup, string nick)
 {
     var idxname = String.Format ("{0}/Index.SATApprox", nick);
     return Execute (setup, nick, idxname, (db) => {
         var sat = new SAT();
         sat.Build(db, new Random());
         var satapprox = new SAT_ApproxSearch();
         satapprox.Build(sat);
         return satapprox;
     });
 }
コード例 #8
0
ファイル: Indexes.cs プロジェクト: sadit/natix
        public static List<string> ExecuteMultiNeighborhoodHash(IndexArgumentSetup setup, string nick, double expected_recall, int max_instances)
        {
            var idxname = String.Format ("{0}/Index.MultiNeighborhoodHash.max_instances={1}-qarg={2}-expected-recall={3}", nick, max_instances, setup.QARG, expected_recall);
            var resname = Execute (setup, nick, idxname, (db) => {
                var parameters = MultiNeighborhoodHash.EstimateParameters (db, max_instances, (int)Math.Abs (setup.QARG), expected_recall, 96);
                /*if (parameters.NumberOfInstances == 1) {
                    idx = parameters.Index;
                } else {*/
                var IDX = new MultiNeighborhoodHash ();
                IDX.Build (db, parameters);
                return IDX;
            });
            var resnameList = new List<string> ();
            resnameList.Add (resname);

            resname = GetResultName (nick, idxname, setup, "Adaptive");
            resnameList.Add (resname);

            if (!File.Exists (resname)) {
                var idx = IndexGenericIO.Load (idxname);
                idx = new AdaptiveNeighborhoodHash(idx as MultiNeighborhoodHash);
                PerformSearch (resname, idx, idxname, setup);
            }
            return resnameList;
        }
コード例 #9
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteMetricGraphGreedy(IndexArgumentSetup setup, string nick, int neighbors)
 {
     var idxname = String.Format ("{0}/Index.MetricGraphGreedy.neighbors={1}", nick, neighbors);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new MetricGraphGreedy ();
         IDX.Build (db, neighbors);
         return IDX;
     });
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void MainDOC(IndexArgumentSetup setup)
        {
            var basename = Path.GetFileName (setup.DATABASE);
            var nick = String.Format("{0}{1}", setup.PREFIX, basename);

            if (!Directory.Exists (nick)) {
                Directory.CreateDirectory (nick);
            }

            ExecuteMain (nick, setup, () => {
                DocumentDB sp;
                if (!File.Exists(setup.BINARY_DATABASE)) {
                    sp = new DocumentDB();
                    var list = new List<string>(Directory.EnumerateFiles(setup.DATABASE));
                    list.Sort();
                    sp.Build(setup.DATABASE, list);
                    SpaceGenericIO.Save(setup.BINARY_DATABASE, sp);
                }
            });
        }
コード例 #11
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string GetResultName(string nick, string idxname, IndexArgumentSetup setup, string suffix)
 {
     if (suffix.Length > 0) {
         suffix = "." + suffix;
     }
     return String.Format(
         "{0}/Res.{1}.{2}.qarg={3}{4}.json",
         nick,
         Path.GetFileName(idxname),
         Path.GetFileName(setup.QUERIES),
         setup.QARG,
         suffix
     );
 }
コード例 #12
0
ファイル: Indexes.cs プロジェクト: sadit/natix
        public static List<string> ExecuteKNRSEQ(IndexArgumentSetup setup, string nick, int numrefs, int k, double maxcand_ratio)
        {
            var idxname = String.Format ("{0}/Index.knrseq-{1}-{2}", nick, numrefs, k);
            MetricDB db = SpaceGenericIO.Load (setup.BINARY_DATABASE);
            Index idx;
            var suffix = "";

            var resnamelist = new List<string> ();
            if (!File.Exists (idxname)) {
                Console.WriteLine ("*** creating index {0}", idxname);
                var s = DateTime.Now.Ticks;
                var c = db.NumberDistances;
                var IDX = new KnrSeqSearch ();
                var refsDB = new SampleSpace("", db, numrefs);
                var refsIDX = new EPTable ();
                refsIDX.Build(refsDB, 4, (_db, _rand) => new EPListOptimizedA(_db, 4, _rand));
                if (k == 0) {
                    k = KnrEstimateParameters.EstimateKnrEnsuringSharedNeighborhoods (db, refsIDX, (int)Math.Abs (setup.QARG));
                    suffix = String.Format ("estimated-K={0}.", k);
                }
                IDX.Build (db, refsIDX, k, int.MaxValue);
                SaveConstructionTime (idxname, DateTime.Now.Ticks - s, db.NumberDistances - c);
                IndexGenericIO.Save (idxname, IDX);
                idx = IDX;
            } else {
                Console.WriteLine ("*** loading index {0}", idxname);
                idx = IndexGenericIO.Load (idxname);
                if (k == 0) {
                    var _idx = idx as KnrSeqSearch;
                    suffix = String.Format ("estimated-K={0}.", _idx.K);
                }
            }
            string resname;
            // PPIndex
            resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.PPI", maxcand_ratio));
            resnamelist.Add(resname);
            if (!File.Exists (resname)) {
                var knr = idx as KnrSeqSearch;
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                PerformSearch (resname, knr, idxname, setup);
            }
            // KnrSeqSearchCosine
            resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.COS", maxcand_ratio));
            resnamelist.Add(resname);
            if (!File.Exists (resname)) {
                var knr = new KnrSeqSearchCosine(idx as KnrSeqSearch);
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                PerformSearch (resname, knr, idxname, setup);
            }
            // KnrSeqSearchFootrule
            resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.FOOTRULE", maxcand_ratio));
            resnamelist.Add(resname);
            if (!File.Exists (resname)) {
                var knr = new KnrSeqSearchFootrule(idx as KnrSeqSearch);
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                PerformSearch (resname, knr, idxname, setup);
            }
            // KnrSeqSearchJaccLCS
            resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.JACCLCS", maxcand_ratio));
            resnamelist.Add(resname);
            if (!File.Exists (resname)) {
                var knr = new KnrSeqSearchJaccLCS(idx as KnrSeqSearch);
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                PerformSearch (resname, knr, idxname, setup);
            }
            // KnrSeqSearchLCSv3
            resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.LCSv3", maxcand_ratio));
            resnamelist.Add(resname);
            if (!File.Exists (resname)) {
                var knr = new KnrSeqSearchLCSv3(idx as KnrSeqSearch);
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                PerformSearch (resname, knr, idxname, setup);
            }
            // NAPP
            foreach (var ksearch in setup.KNR_KSEARCH) {
                var knr = new NAPP(idx as KnrSeqSearch);
                knr.MAXCAND = (int)(idx.DB.Count * maxcand_ratio);
                resname = GetResultName (nick, idxname, setup, String.Format(suffix + "maxcand={0}.NAPP.ksearch={1}", maxcand_ratio, ksearch));
                resnamelist.Add(resname);
                if (!File.Exists (resname)) {
                    PerformSearch (resname, knr, idxname, setup);
                }
            }
            return resnamelist;
        }
コード例 #13
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteLocalSearchBestFirst(IndexArgumentSetup setup, string nick, int neighbors, int restarts)
 {
     var idxname = String.Format ("{0}/Index.LocalSearchBestFirst.neighbors={1}-restarts={2}", nick, neighbors, restarts);
     return Execute (setup, nick, idxname, (db) => {
         var idx = new LocalSearchBestFirst ();
         idx.Build (db, neighbors, restarts);
         return idx;
     });
 }
コード例 #14
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteApproxGraphOptSimplerOptRandomRestarts(IndexArgumentSetup setup, string nick, int neighbors)
 {
     var idxname = String.Format ("{0}/Index.ApproxGraphOptSimplerRandomRestarts.neighbors={1}", nick, neighbors);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new ApproxGraphOptRandomRestartsS ();
         IDX.Build (db, neighbors);
         return IDX;
     });
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void MainWIKTIONARY(IndexArgumentSetup setup)
        {
            var basename = Path.GetFileName (setup.DATABASE);
            var nick = String.Format("{0}{1}", setup.PREFIX, basename);

            if (!Directory.Exists (nick)) {
                Directory.CreateDirectory (nick);
            }

            ExecuteMain (nick, setup, () => {
                if (!File.Exists(setup.BINARY_DATABASE)) {
                    Wiktionary sp = new Wiktionary();
                    sp.Build(setup.DATABASE);
                    SpaceGenericIO.Save(setup.BINARY_DATABASE, sp);
                }
            });
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void ExecuteMain(string nick, IndexArgumentSetup setup, Action prepare_db)
        {
            var dbname = String.Format ("DB.{0}", Path.GetFileName(setup.DATABASE));
            setup.BINARY_DATABASE = dbname;

            prepare_db ();

            // It is required to be already on memory at this point. The reason is to avoid the loading of several instances
            // of the same database
            SpaceGenericIO.Load (setup.BINARY_DATABASE);

            var arglist = new System.Collections.Concurrent.ConcurrentQueue<String> ();
            arglist.Enqueue ("--save");
            arglist.Enqueue (String.Format ("Tab.ApproxIndexes.{0}.{1}.qarg={2}.json", nick, Path.GetFileName (setup.QUERIES), setup.QARG));
                /*var arglist = new List<string> () {
                "--save",
                String.Format("Tab.{0}.{1}.qarg={2}.json", nick, Path.GetFileName(setup.QUERIES), setup.QARG)
                */

            if (setup.ExecuteSequential) {
                arglist.Enqueue (Indexes.ExecuteSeq (setup, nick));
            }
            var actionlist = new List<Action> ();
            // arglist.Add (Indexes.ExecuteSATApprox (setup, nick));
            // arglist.Add (Indexes.ExecuteSATForest (setup, nick));

            foreach (var max_instances in setup.NeighborhoodHash_MaxInstances) {
                foreach (var expected_recall in setup.NeighborhoodHash_ExpectedRecall) {
                    var _max_instances = max_instances;
                    var _expected_recall = expected_recall;
                    actionlist.Add (() => {
                        var reslist = Indexes.ExecuteMultiNeighborhoodHash (setup, nick, _expected_recall, _max_instances);
                        foreach (var res in reslist) {
                            arglist.Enqueue(res);
                        }
                    });
                }
            }

            foreach (var numrefs in setup.KNR_NUMREFS) {
                foreach (var k in setup.KNR_KBUILD) {
                    foreach (var maxcand_ratio in setup.KNR_MAXCANDRATIO) {
                        var _numrefs = numrefs;
                        var _k = k;
                        var _maxcand_ratio = maxcand_ratio;
                        actionlist.Add (() => {
                            var reslist = Indexes.ExecuteKNRSEQ (setup, nick, _numrefs, _k, _maxcand_ratio);
                            foreach (var res in reslist) {
                                arglist.Enqueue(res);
                            }
                        });
                    }
                }
            }

            //			actionlist.Add (() => {
            //				var resname = Indexes.ExecuteAPG_OptTabuSatNeighborhood (setup, nick);
            //				arglist.Enqueue(resname);
            //			});
            //
            //			actionlist.Add (() => {
            //				var resname = Indexes.ExecuteAPG_OptTabuSatNeighborhoodMontecarloStart(setup, nick);
            //				arglist.Enqueue(resname);
            //			});

            foreach (var neighbors in setup.OPTSEARCH_NEIGHBORS) {
                // arglist.Add (Indexes.ExecuteLocalSearchRestarts (setup, nick, dbname, setup.QUERIES, neighbors));
                // arglist.Add (Indexes.ExecuteLocalSearchBestFirst (setup, nick, dbname, setup.QUERIES, neighbors));
                var _neighbors = neighbors;

                actionlist.Add (() => {
                    var resname = Indexes.ExecuteApproxGraphOptRestartsIS(setup, nick, _neighbors);
                    arglist.Enqueue(resname);
                });

                actionlist.Add (() => {
                    var resname = Indexes.ExecuteApproxGraphOptRandomRestarts(setup, nick, _neighbors);
                    arglist.Enqueue(resname);
                });

            //				actionlist.Add (() => {
            //					var resname = Indexes.ExecuteApproxGraphOptSimplerOptRandomRestarts(setup, nick, _neighbors);
            //					arglist.Enqueue(resname);
            //				});

                actionlist.Add (() => {
                    var resname = Indexes.ExecuteMetricGraphGreedy(setup, nick, _neighbors);
                    arglist.Enqueue(resname);
                });

                foreach (var restarts in setup.OPTSEARCH_RESTARTS) {
                    var _restarts = restarts;
                    actionlist.Add (() => {
                        var resname = Indexes.ExecuteApproxGraphIS(setup, nick, _neighbors, _restarts);
                        arglist.Enqueue(resname);
                    });
            //					actionlist.Add (() => {
            //						var resname = Indexes.ExecuteApproxGraph(setup, nick, _neighbors, _restarts);
            //						arglist.Enqueue(resname);
            //					});
                }

                actionlist.Add (() => {
                    var resname = Indexes.ExecuteLocalSearchGallopingBeam(setup, nick, _neighbors);
                    arglist.Enqueue(resname);
                });

                foreach (var beamsize in setup.OPTSEARCH_BEAMSIZE) {
                    var _beamsize = beamsize;
                    actionlist.Add (() => {
                        var resname = Indexes.ExecuteLocalSearchBeam(setup, nick, _beamsize, _neighbors);
                        arglist.Enqueue(resname);
                    });

            //					actionlist.Add (() => {
            //						var resname = Indexes.ExecuteLocalSearchMontecarloBeam(setup, nick, _beamsize, _neighbors);
            //						arglist.Enqueue(resname);
            //					});
                }
            }

            foreach (var numInstances in setup.LSHFloatVector_INDEXES) {
                foreach (var numSamples in setup.LSHFloatVector_SAMPLES) {
                    var _numInstances = numInstances;
                    var _numSamples = numSamples;
                    actionlist.Add (() => {
                        var resname = Indexes.ExecuteLSHFloatVector (setup, nick, _numInstances, _numSamples);
                        arglist.Enqueue(resname);
                    });
                }
            }

            if (setup.SPAWN == 1) {
                foreach (var action in actionlist) {
                    action.Invoke ();
                }
            } else {
                LongParallel.ForEach (actionlist, (a) => a.Invoke (), setup.SPAWN);
            }
            if (setup.ExecuteSearch) {
                Commands.Check (arglist);
            }
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void MainVEC(IndexArgumentSetup setup, string stype)
        {
            var basename = Path.GetFileName (setup.DATABASE);
            var nick = String.Format("{0}{1}", setup.PREFIX, basename);

            if (!Directory.Exists (nick)) {
                Directory.CreateDirectory (nick);
            }

            switch (stype) {
            case "VEC":
                ExecuteMain (nick, setup, () => {
                    if (!File.Exists (setup.BINARY_DATABASE)) {
                        MemMinkowskiVectorDB<float> db = new MemMinkowskiVectorDB<float> ();
                        db.Build (setup.DATABASE);
                        SpaceGenericIO.Save (setup.BINARY_DATABASE, db);
                    }
                });
                break;
            case "VEC_UInt8":
                ExecuteMain (nick, setup, () => {
                    if (!File.Exists (setup.BINARY_DATABASE)) {
                        MemMinkowskiVectorDB<byte> db = new MemMinkowskiVectorDB<byte> ();
                        db.Build (setup.DATABASE);
                        SpaceGenericIO.Save (setup.BINARY_DATABASE, db);
                    }
                });
                break;

            case "VEC_Int8":
                ExecuteMain (nick, setup, () => {
                    if (!File.Exists (setup.BINARY_DATABASE)) {
                        MemMinkowskiVectorDB<sbyte> db = new MemMinkowskiVectorDB<sbyte> ();
                        db.Build (setup.DATABASE);
                        SpaceGenericIO.Save (setup.BINARY_DATABASE, db);
                    }
                });
                break;

            case "VEC_Int16":
                ExecuteMain (nick, setup, () => {
                    if (!File.Exists (setup.BINARY_DATABASE)) {
                        MemMinkowskiVectorDB<short> db = new MemMinkowskiVectorDB<short> ();
                        db.Build (setup.DATABASE);
                        SpaceGenericIO.Save (setup.BINARY_DATABASE, db);
                    }
                });
                break;

            case "VEC_UInt16":
                ExecuteMain (nick, setup, () => {
                    if (!File.Exists (setup.BINARY_DATABASE)) {
                        MemMinkowskiVectorDB<ushort> db = new MemMinkowskiVectorDB<ushort> ();
                        db.Build (setup.DATABASE);
                        SpaceGenericIO.Save (setup.BINARY_DATABASE, db);
                    }
                });
                break;
            default:
                throw new ArgumentException ("Error unknown vector subtype " + stype);
            }
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void MainSEQED(IndexArgumentSetup setup)
        {
            var basename = Path.GetFileName (setup.DATABASE);
            var nick = String.Format("{0}{1}", setup.PREFIX, basename);

            if (!Directory.Exists (nick)) {
                Directory.CreateDirectory (nick);
            }

            ExecuteMain (nick, setup, () => {
                SeqLevenshteinSpace<int> sp;
                if (!File.Exists(setup.BINARY_DATABASE)) {
                    sp = new SeqLevenshteinSpace<int>();
                    sp.Build(setup.DATABASE);
                    SpaceGenericIO.Save(setup.BINARY_DATABASE, sp);
                }
            });
        }
コード例 #19
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static void PerformSearch(string resname, Index idx, string idxname, IndexArgumentSetup setup)
 {
     if (setup.ExecuteSearch) {
         var ops = new ShellSearchOptions (setup.QUERIES, idxname, resname);
         var qstream = new QueryStream (setup.QUERIES, setup.QARG);
         Commands.Search (idx, qstream.Iterate (), ops);
         GC.Collect ();
     }
 }
コード例 #20
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteLocalSearchRestarts(IndexArgumentSetup setup, string nick, int neighbors)
 {
     var idxname = String.Format ("{0}/Index.LocalSearchRestarts.neighbors={1}", nick, neighbors);
     return Execute (setup, nick, idxname, (db) => {
         var IDX = new LocalSearchRestarts ();
         IDX.Build (db, neighbors);
         return IDX;
     });
 }
コード例 #21
0
ファイル: Indexes.cs プロジェクト: sadit/natix
 public static string ExecuteLSHFloatVector(IndexArgumentSetup setup, string nick, int num_indexes, int width)
 {
     var idxname = String.Format ("{0}/Index.LSH.{1}-{2}", nick, num_indexes, width);
     return Execute (setup, nick, idxname, (db) => {
         var lsh = new MLSH_FloatVectorL2 ();
         lsh.Build (db, width, num_indexes);
         return lsh;
     });
 }
コード例 #22
0
ファイル: Program.cs プロジェクト: sadit/natix
        public static void Main(string[] args)
        {
            OptionSet ops = null;
            var setup = new IndexArgumentSetup ();
            string stype = null;

            ops = new OptionSet() {
                {"database=", "Database in its ascii format. It will create a file DB.dbname in the current directory", v => setup.DATABASE = v },
                {"queries=", "Queries in its ascii format", v => setup.QUERIES = v },
                {"stype=", "The type of the metric space. Valid names VEC, VEC_Int16, VEC_UInt16, VEC_Int8, VEC_UInt8, DOC, SEQ-ED, STR-ED, WIKTIONARY, COPHIR282", v => stype = v},
                {"qtype=", "Type of query, negative values should be integers and means for near neighbor search, positive values means for range search. Defaults to -30 (30NN)", v => setup.QARG = Double.Parse(v)},
                {"prefix=", "Experiment's prefix", v => setup.PREFIX = v},
                {"seq", "Execute sequential search", v => setup.ExecuteSequential = true},
                {"neighborhoodhash=", "Run MutiNeighborhoodHash with the given parameters (recalllist:instanceslist)",
                    v => {
                        var _args = v.Split(':');
                        LoadList(_args[0], setup.NeighborhoodHash_ExpectedRecall);
                        LoadList(_args[1], setup.NeighborhoodHash_MaxInstances);
                    }
                },
                /*{"neighborhoodhash-recall=", "Run MutiNeighborhoodHash with the given parameters (recalllist:instanceslist)", v => LoadList(v, setup.NeighborhoodHash_ExpectedRecall)},
                {"neighborhoodhash-instances=", "Run NeighborhoodHash with the given maximum number of hashes", v => LoadList(v, setup.NeighborhoodHash_MaxInstances)},*/
                {"optsearch=", "Run optsearch with the specified parameters (in format neighborlist:beamsizelist:restartlist)",
                    v => {
                        var _args = v.Split(':');
                        LoadList(_args[0], setup.OPTSEARCH_NEIGHBORS);
                        LoadList(_args[1], setup.OPTSEARCH_BEAMSIZE);
                        LoadList(_args[2], setup.OPTSEARCH_RESTARTS);
                    }
                },

                {"knr=", "Run knr with the specified parameters (format numrefslist:kbuildlist:maxcandlist[:nappksearchlist])",
                    v => {
                        var _args = v.Split(':');
                        LoadList(_args[0], setup.KNR_NUMREFS);
                        LoadList(_args[1], setup.KNR_KBUILD);
                        LoadList(_args[2], setup.KNR_MAXCANDRATIO);
                        if (_args.Length == 4) {
                            LoadList(_args[3], setup.KNR_KSEARCH);
                        }
                    }
                },

                /*{"optsearch-beamsize=", "Run LOCALSEARCH with the given list of beam sizes", v => LoadList(v, setup.OPTSEARCH_BEAMSIZE)},
                {"optsearch-restarts=", "Run LOCALSEARCH/APG with the given list of restarts", v => LoadList(v, setup.OPTSEARCH_RESTARTS)},
                {"optsearch-neighbors=", "Run LOCALSEARCH/APG with the given list of outgoing degrees (neighbors)", v => LoadList(v, setup.OPTSEARCH_NEIGHBORS)},*/

                /*{"knr-numrefs=", "Run KnrSeq methods with the given list of # refs (comma sep.)",	v => LoadList(v, setup.KNR_NUMREFS)},
                {"knr-kbuild=", "Create KnrSeq indexes with the given list of near references (comma sep.)",	v => LoadList(v, setup.KNR_KBUILD)},
                {"napp-ksearch=", "Search KnrSeq indexes with the given list of near references (comma sep.)",	v => LoadList(v, setup.KNR_KSEARCH)},
                {"knr-maxcand=", "Run KnrSeq methods with the given list of maxcand (comma sep., ratio)",	v => LoadList(v, setup.KNR_MAXCANDRATIO)},*/
                {"lsh-instances=", "A list of instances to for LSH_FloatVectors (comma sep.)", v=> LoadList(v, setup.LSHFloatVector_INDEXES)},
                {"lsh-width=", "A list of widths for LSH_FloatVectors (comma sep.)", v=> LoadList(v, setup.LSHFloatVector_SAMPLES)},
                //{"parameterless", "Enable parameterless indexes", v => setup.ExecuteParameterless = true},
                {"skip-search", v => setup.ExecuteSearch = false},
                {"cores=", v => setup.CORES = int.Parse(v)},
                {"spawn=", "Number of running concurrent tests (indexes), notice that a spawn != 1 could produce weird values on performance variables sensed by self tunning indexes", v => setup.SPAWN = int.Parse(v)},
                {"help|h", "Shows this help", v => {
                        ops.WriteOptionDescriptions(Console.Out);
                        System.Environment.Exit(0);
                    }
                }
            };
            ops.Parse(args);
            if (setup.DATABASE == null) {
                ops.WriteOptionDescriptions (Console.Out);
                throw new ArgumentNullException ("The database argument is mandatory");
            }
            if (setup.QUERIES == null) {
                ops.WriteOptionDescriptions (Console.Out);
                throw new ArgumentNullException ("The queries argument is mandatory");
            }
            if (stype == null) {
                ops.WriteOptionDescriptions (Console.Out);
                throw new ArgumentNullException ("The stype argument is mandatory");
            }
            if (stype.StartsWith("VEC")) {
                MainVEC (setup, stype);
            } else if (stype == "DOC") {
                MainDOC (setup);
            } else if (stype == "SEQ-ED") {
                MainSEQED (setup);
            } else if (stype == "STR-ED") {
                MainSTRED (setup);
            } else if (stype == "WIKTIONARY") {
                MainWIKTIONARY (setup);
            } else {
                throw new ArgumentException (String.Format("Unknown space type {0}", stype));
            }
        }