/// <summary> /// charger le graphe2 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chargeDuGraphe2ToolStripMenuItem_Click(object sender, EventArgs e) { if (this.pictureBoxGraphe2.Image != null) { pictureBoxGraphe2.Image.Dispose(); } // this.isoLP.Graph2 = GraphLibManager.LoadGraph(this.richTextBoxAppariement, this.toolStripStatusLabel1); string nomFichier = GraphLibManager.ChoisirDirectory(); this.isoLP.Graph2 = GraphLibManager.LoadGraph(nomFichier, comboBoxGraphe.SelectedIndex); if (this.isoLP.Graph2 != null) { GraphLibManager.DisplayGraph(this.isoLP.Graph2, this.pictureBoxGraphe2, "./Graph2.jpg", toolStripStatusLabel1); this.isoLP.Graph2.Name = "Graph2"; if (!this.isoLP.Graph2.IsDirected) { this.isoLP.DirectedGraph2 = GraphLibManager.LoadGraph(nomFichier, comboBoxGraphe.SelectedIndex); GraphLibManager.transToDirectedGraph(this.isoLP.DirectedGraph2, false); this.isoLP.DirectedGraph2.Name = "Graph2"; } else { this.isoLP.DirectedGraph2 = this.isoLP.Graph2; } } }
/// <summary> /// Charger le graphe1 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chargeDuGraphe1ToolStripMenuItem_Click(object sender, EventArgs e) { if (this.pictureBoxGraphe1.Image != null) { pictureBoxGraphe1.Image.Dispose(); } string nomFichier = GraphLibManager.ChoisirDirectory(); this.isoLP.Graph1 = GraphLibManager.LoadGraph(nomFichier, this.comboBoxGraphe.SelectedIndex); if (this.isoLP.Graph1 != null) { GraphLibManager.DisplayGraph(this.isoLP.Graph1, this.pictureBoxGraphe1, "./Graph1.jpg", toolStripStatusLabel1); this.isoLP.Graph1.Name = "Graph1"; if (!this.isoLP.Graph1.IsDirected) { this.isoLP.DirectedGraph1 = GraphLibManager.LoadGraph(nomFichier, this.comboBoxGraphe.SelectedIndex); GraphLibManager.transToDirectedGraph(this.isoLP.DirectedGraph1, false); this.isoLP.DirectedGraph1.Name = "Graph1"; } else { this.isoLP.DirectedGraph1 = this.isoLP.Graph1; } } }
private bool runTestByMethode(int graphType, int methode, int noOfNodes) { string methodeName = "", solverType = "", formulaType = ""; int mode = 0; switch (methode) { case 1: methodeName = "F1bCplexUnCoeur"; solverType = "CPLEX"; formulaType = "IsoGraphInexactF1b"; mode = 0; break; case 2: methodeName = "F1bCplexPlusieursCoeurs"; solverType = "CPLEX"; formulaType = "IsoGraphInexactF1b"; mode = 1; break; case 3: methodeName = "F2bCPLEXUnCoeur"; solverType = "CPLEX"; formulaType = "IsoGraphInexactF2b"; mode = 0; break; case 4: methodeName = "F2bCplexPlusieursCoeurs"; solverType = "CPLEX"; formulaType = "IsoGraphInexactF2b"; mode = 1; break; case 5: methodeName = "F1bGlpkUnCoeur"; solverType = "GLPK"; formulaType = "IsoGraphInexactF1b"; mode = 0; break; case 6: methodeName = "F2bGlpkUnCoeur"; solverType = "GLPK"; formulaType = "IsoGraphInexactF2b"; mode = 0; break; case 7: methodeName = "BranchAndBound"; solverType = "GLPK"; formulaType = "EditPath"; mode = 0; break; case 10: methodeName = "GEDBLPjusticehero"; solverType = "CPLEX"; formulaType = "BLPjusticehero"; mode = 0; break; case 11: methodeName = "BLPjusticeheroQuadratic"; solverType = "CPLEX"; formulaType = "BLPjusticeheroQuadratic"; mode = 0; break; case 12: methodeName = "QAPGMGED"; solverType = "CPLEX"; formulaType = "QAPGMGED"; mode = 0; break; } string strToWrite = ""; for (int i = 0; i < classMap.Count; i++) { for (int j = 0; j < classMap.Count; j++) { try { this.graph1 = GraphLibManager.LoadGraph((classMap[i][0]), graphType); //LoadGraph(this.richTextGraph, this.toolStripStatusTestLabel); this.graph2 = GraphLibManager.LoadGraph(classMap[j][0], graphType); Console.Out.WriteLine("i:" + i + "---> j : " + j); Console.Out.WriteLine(graph1.Id + "--->" + graph2.Id); } catch (Exception e) { MessageBox.Show("Ne peut pas charger les graphes." + e); return(false); } if ((graph1 == null) || (graph2 == null)) { j++; //jump the wrong .gxl if exist } else if (this.graph1.IsDirected ^ this.graph2.IsDirected) { j++; } else { /* if (!(this.graph1.IsDirected) && !(this.graph2.IsDirected)) * { * GraphLibManager.transToDirectedGraph(this.graph1,false); * GraphLibManager.transToDirectedGraph(this.graph2,false); * this.flagTransform = true; * }*/ this.flagTransform = false; this.iso = new IsomorphismLP(); iso.Graph1 = this.graph1; iso.Graph2 = this.graph2; iso.DirectedGraph1 = this.graph1; iso.DirectedGraph2 = this.graph2; this.iso.SolverType = solverType; //this.comboBoxSolveur2.SelectedIndex == 0 ? "CPLEX" : "GLPK"; this.iso.FormulaType = formulaType; // Program.formulas[formulaTypeIndice];//Program.formulas[this.comboBoxProblem2.SelectedIndex]; this.iso.initial(); Program.nbCoeursCplex = int.Parse(textBoxnbthread.Text); this.iso.Solver.setThreadNumber(Program.nbCoeursCplex); /*if (mode == 0) * this.iso.Solver.setThreadNumber(1); * else if (mode == 1) * this.iso.Solver.setThreadNumber(Program.nbCoeursCplex);*/ iso.run(); try { fs = new FileStream(csvPath + "\\result" + this.graphTypeStr + noOfNodes + "nodes.csv", System.IO.FileMode.Append, System.IO.FileAccess.Write); monStream = new StreamWriter(fs, this.outputEncoding); strToWrite = methodeName + ";rien;" + classMap[i][0] + ";" + classMap[j][0] + ";"; // strToWrite = methodeName + ";rien;" + graph1.Id + ";" + graph2.Id + ";"; strToWrite += iso.Graph1.ListNodes.Count + ";" + iso.Graph2.ListNodes.Count + ";"; if (this.flagTransform) { strToWrite += iso.Graph1.ListEdges.Count / 2 + ";" + iso.Graph2.ListEdges.Count / 2 + ";"; } else { strToWrite += iso.Graph1.ListEdges.Count + ";" + iso.Graph2.ListEdges.Count + ";"; } this.flagTransform = false; //strToWrite += (iso.MatchingResult.Distance.ToString()).Replace(',','.') + ";"; strToWrite += iso.MatchingResult.Distance + ";"; strToWrite += iso.MatchingResult.NbNodes + ";"; strToWrite += "-1;"; strToWrite += iso.MatchingResult.TimeUse + ";"; if (iso.MatchingResult.Feasible) { strToWrite += "true;"; } else { strToWrite += "false;"; } if (iso.MatchingResult.Optimal) { strToWrite += "true;"; } else { strToWrite += "false;"; } if (iso.MatchingResult.MemoryOverFlow) { strToWrite += "true;"; } else { strToWrite += "false;"; } if (iso.MatchingResult.TimeOverFlow) { strToWrite += "true;"; } else { strToWrite += "false;"; } strToWrite += classMap[i][1] + ";"; strToWrite += classMap[j][1] + ";"; strToWrite += MakeMatchingToString(iso.MatchingResult.NodeMatchingDictionary); monStream.WriteLine(strToWrite); } catch (Exception) { throw; } finally { if (monStream != null) { monStream.Close(); } iso.Solver.closeSolver(); } } } } return(true); }