private static void manycomparison(string[] args)
        {
            //CxlNNodes cxlNNNodes = new CxlNNodes(noOfNodes, this.graphType, this.dbDirecttory, this.trainingFile, this.readTrainingCXLFile);
            string          dbDirecttory = "D:\\recherche\\data\\GREC\\GREC\\data";
            List <string[]> classMap     = GraphLibManager.loadGraphClass("D:\\recherche\\data\\GREC\\GREC\\data\\cplex.cxl", dbDirecttory);


            System.IO.StreamWriter monStream = null;
            for (int i = 0; i < classMap.Count; i++)
            {
                for (int j = 0; j < classMap.Count; j++)
                {
                    try
                    {
                        Graph  g1     = new Graph();
                        Graph  g2     = new Graph();
                        string g1file = classMap[i][0];
                        string g2file = classMap[j][0];
                        string res    = onecomparisonwithres(g1file, g2file);

                        System.IO.FileStream fs = new System.IO.FileStream("res.csv", System.IO.FileMode.Append, System.IO.FileAccess.Write);
                        monStream = new System.IO.StreamWriter(fs);
                        monStream.WriteLine(res);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        if (monStream != null)
                        {
                            monStream.Close();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void buttonTester_Click(object sender, EventArgs e)
        {
            if (int.TryParse(this.textBoxDebut.Text, out nodeDebut))
            {
                if (nodeDebut < 2)
                {
                    MessageBox.Show("il faut la valeur de  \"debut\" supérieur ou égale à 5");
                    return;
                }
                if (int.TryParse(this.textBoxFin.Text, out nodeFin))
                {
                    if (nodeFin < nodeDebut)
                    {
                        MessageBox.Show("la valeur de \"fin\" pas valide ");
                        return;
                    }
                    else if (int.TryParse(this.textBoxinterval.Text, out interval))
                    {
                        if (interval < 0)
                        {
                            MessageBox.Show("la valeur d'interval pas valide ");
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("la valeur d'interval pas valide ");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("la valeur de  \"fin\" pas valide ");
                    return;
                }
            }
            else
            {
                MessageBox.Show("la valeur de  \"debut\" pas valide ");
                return;
            }


            //Integer.partextBox1.Text

            double.TryParse(this.textBox1.Text, out Program.MAXTIME_SIMPLEX);
            Program.MAXTIME_SECOND = Program.MAXTIME_SIMPLEX / 1000.0;

            double.TryParse(this.textBox2.Text, out Program.MAXMEMORY_MB);

            graphType = this.comboBoxGraphe.SelectedIndex;
            if (graphType == Program.noGrec)
            {
                graphTypeStr        = "Grec";
                this.MaxNumberNodes = 20;
            }

            if (graphType == Program.noLetter)
            {
                graphTypeStr        = "Letter";
                this.MaxNumberNodes = 10;
            }

            if (graphType == Program.noAlkane)
            {
                graphTypeStr        = "Alkane";
                this.MaxNumberNodes = 30;
            }

            if (graphType == Program.noMuta)
            {
                graphTypeStr        = "Mutagen";
                this.MaxNumberNodes = 85;
            }


            if (graphType == Program.noPRO)
            {
                graphTypeStr        = "Protein";
                this.MaxNumberNodes = 85;
            }

            if (graphType == Program.noIlpiso)
            {
                graphTypeStr        = "ILPISO";
                this.MaxNumberNodes = 50;
            }



            if (graphType == Program.noLOW)
            {
                graphTypeStr = "LOW";
            }

            if (nodeDebut < 1)
            {
                this.nodeDebut = 1;
            }
            if (nodeFin > this.MaxNumberNodes)
            {
                this.nodeFin = this.MaxNumberNodes;
            }
            //if (interval == 0) interval = 1;
            if (allFiles == null)
            {
                MessageBox.Show("Choisissez un dossier de graphes, svp");
            }
            else if (allFiles.Length < 1)
            {
                MessageBox.Show("Le dossier choisit n'est pas valide");
            }
            else
            {
                this.toolStripStatusTestLabel.Text = "test en cours";

                /**
                 * Generer les fichiers cxl regrouper par noeud
                 **/
                for (int noOfNodes = this.nodeDebut; noOfNodes <= this.nodeFin; noOfNodes += this.interval)
                {
                    if (dbDirecttory != null)
                    {
                        readTrainingCXLFile = this.dbDirecttory + "\\cplex.cxl";


                        //donc pas de découpe en sous base
                        if (interval == 0)
                        {
                            this.trainingFile = this.dbDirecttory + "\\cplex.cxl";
                            interval          = 0;
                            nodeFin           = 0;
                            noOfNodes         = 10000;
                        }
                        else
                        {
                            this.trainingFile = this.dbDirecttory + "\\train" + noOfNodes + ".cxl";
                            //this.trainingFile = this.dbDirecttory + "\\mixed-graphs.cxl";
                            CxlNNodes cxlNNNodes = new CxlNNodes(noOfNodes, this.graphType, this.dbDirecttory, this.trainingFile, this.readTrainingCXLFile);
                        }
                        classMap = GraphLibManager.loadGraphClass(this.trainingFile, this.dbDirecttory);
                        try
                        {
                            if (!this.checkBox7.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "";
                                fs = new FileStream(csvPath + "\\result" + this.graphTypeStr + noOfNodes + "nodes.csv", System.IO.FileMode.Create, System.IO.FileAccess.Write);
                                //monStream = new StreamWriter(fs, System.Text.UnicodeEncoding.UTF8);
                                monStream = new StreamWriter(fs, outputEncoding);
                                monStream.WriteLine("Method;Param;Graph1 Name;Graph2 Name;Graph1 nb nodes;" +
                                                    "Graph2 nb nodes;Graph1 nb edges;Graph2 nb edges; distance;" +
                                                    "explored nodes;max open size;time;feasible solution found;" +
                                                    "optimal solution found;memory overflow;time overflow;class Graph1;class Graph2;Node Matching");
                                monStream.WriteLine(classMap.Count + ";;;;;;;;;;;;;;;;;;");
                            }
                        }
                        catch (Exception OpenFileException)
                        {
                            MessageBox.Show("Impossible à écrir dans le fichier csv : " + OpenFileException.ToString());
                            return;
                        }
                        finally
                        {
                            if (monStream != null)
                            {
                                monStream.Close();
                            }
                        }

                        //  continue;
                        try
                        {
                            this.toolStripStatusTestLabel.Text = "";
                            this.toolStripStatusTestLabel.Text = "en cours...";
                            if (this.checkBox7.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "branch and bound";


                                //Create process
                                System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
                                double time = (Program.MAXTIME_SECOND * 1000);
                                pProcess.StartInfo.FileName = "java";
                                // pProcess.StartInfo.Arguments = "-Xmx1024m -jar " + binPath + "\\ressource\\EditPath.jar " +
                                //      this.dbDirecttory + " " + csvPath + "\\result" + this.graphTypeStr + noOfNodes + "nodes.csv" + " 0 " + this.graphType + " "+time+" 5 " + noOfNodes;
                                pProcess.StartInfo.Arguments = "-Xmx1024m -jar " + binPath + "\\ressource\\grapheditdistance.jar " +
                                                               this.dbDirecttory + " " + csvPath + "\\result" + this.graphTypeStr + noOfNodes + "nodes.csv" + " 13 0 60000 2,6,3,100,1,3,5,3";

                                pProcess.StartInfo.UseShellExecute        = false;
                                pProcess.StartInfo.RedirectStandardOutput = true;
                                pProcess.StartInfo.RedirectStandardError  = true;
                                pProcess.StartInfo.CreateNoWindow         = true;

                                //Start the process
                                pProcess.Start();
                                string strOutput = pProcess.StandardOutput.ReadToEnd();
                                string strError  = pProcess.StandardError.ReadToEnd();

                                pProcess.WaitForExit();
                                Console.Out.WriteLine(strOutput);
                                Console.Out.WriteLine(strError);
                            }
                            if (this.checkBox1.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F1b cplex avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 1, noOfNodes))
                                {
                                    return;
                                }
                            }
                            if (this.checkBox2.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F1b cplex avec plusieurs coeurs";
                                if (!this.runTestByMethode(graphType, 2, noOfNodes))
                                {
                                    return;
                                }
                            }
                            if (this.checkBox3.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F2b cplex avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 3, noOfNodes))
                                {
                                    return;
                                }
                            }
                            if (this.checkBox4.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F2b cplex avec plusieurs coeurs";
                                if (!this.runTestByMethode(graphType, 4, noOfNodes))
                                {
                                    return;
                                }
                            }
                            if (this.checkBox5.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F1b glpk avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 5, noOfNodes))
                                {
                                    return;
                                }
                            }
                            if (this.checkBox6.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "F2b glpk avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 6, noOfNodes))
                                {
                                    return;
                                }
                            }

                            if (this.checkBox10.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "BLPjusticehero cplex avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 10, noOfNodes))
                                {
                                    return;
                                }
                            }

                            if (this.checkBox11.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "BLPjusticehero Quadratic cplex avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 11, noOfNodes))
                                {
                                    return;
                                }
                            }

                            if (this.checkBox12.Checked)
                            {
                                this.toolStripStatusTestLabel.Text = "QAPGMGED cplex avec un seul coeur";
                                if (!this.runTestByMethode(graphType, 12, noOfNodes))
                                {
                                    return;
                                }
                            }
                        }
                        catch (Exception exce)
                        {
                            Console.Out.WriteLine("Exception : " + exce.ToString());
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                this.toolStripStatusTestLabel.Text = "Fini";
                Console.SetOut(System.IO.TextWriter.Null);
                return;
            }
        }