Sfoglia il codice sorgente

Add new tests for multithreading simulations

Eric Ramat 9 anni fa
parent
commit
7e6d40a944

+ 18 - 30
src/tests/boost_graph/graph_manager.hpp

@@ -419,8 +419,6 @@ public:
                             parent_connections);
 
         // build coordinators (graphs)
-        //boost::timer t;
-
         for (unsigned int i = 0; i < graphs.size(); ++i) {
             Coordinator* coordinator = 0;
             std::ostringstream ss;
@@ -428,7 +426,8 @@ public:
             ss << "S" << i;
             coordinator =
                 new Coordinator(ss.str(), paradevs::common::NoParameters(),
-                                GraphParameters(graphs[i], input_edges[i],
+                                GraphParameters(graphs[i],
+                                                input_edges[i],
                                                 output_edges[i]));
             _coordinators.push_back(coordinator);
             HeapHierarchicalGraphManager < GraphBuilder >::add_child(
@@ -436,8 +435,6 @@ public:
 
         }
 
-        // std::cout << "Root:" << std::endl;
-
         // builds internal connections (edges)
         for (Connections::const_iterator it = parent_connections.begin();
              it != parent_connections.end(); ++it) {
@@ -455,14 +452,6 @@ public:
                         _coordinators[connection.second.first - 1],
                         ss_in.str())) {
 
-                // std::cout << "link = "
-                //           << _coordinators[connection.first.first - 1]
-                //     ->get_name()
-                //           << "::" << ss_out.str() << " -> "
-                //           << _coordinators[connection.second.first - 1]
-                //     ->get_name()
-                //           << "::" << ss_in.str() << std::endl;
-
                 HeapHierarchicalGraphManager <
                     GraphBuilder >::add_link(
                         _coordinators[connection.first.first - 1],
@@ -471,8 +460,6 @@ public:
                         ss_in.str());
             }
         }
-        //double t3 = t.elapsed();
-        //std::cout << "tmp_constr = " << t3 << std::endl;
     }
 
     virtual ~HeapHierarchicalGraphManager()
@@ -488,7 +475,8 @@ private:
         common::DoubleTime,
         BuiltFlatGraphManager,
         common::NoParameters,
-        GraphParameters > Coordinator;
+        GraphParameters
+    > Coordinator;
     typedef std::vector < Coordinator* > Coordinators;
 
     Coordinators _coordinators;
@@ -535,7 +523,6 @@ public:
             _coordinators.push_back(coordinator);
             ParallelHeapHierarchicalGraphManager < GraphBuilder >::add_child(
                 coordinator);
-
         }
 
         // builds internal connections (edges)
@@ -601,28 +588,29 @@ public:
     void transition(const common::Models < common::DoubleTime >& receivers,
                     paradevs::common::DoubleTime::type t)
     {
-        typename Coordinators::const_iterator it = _coordinators.begin();
-        bool found = false;
+        common::Models < common::DoubleTime >::const_iterator it =
+            receivers.begin();
+
+        while (it != receivers.end()) {
+            if (not (*it)->is_atomic()) {
+                typename Coordinators::const_iterator itc =
+                    std::find(_coordinators.begin(), _coordinators.end(), *it);
 
-        while (not found) {
-            if (std::find(receivers.begin(), receivers.end(),
-                          *it) != receivers.end()) {
-                (*it)->get_sender().send(
+                (*itc)->get_sender().send(
                     paradevs::pdevs::multithreading::transition_message <
                         paradevs::common::DoubleTime >(t));
-                found = true;
-            } else {
-                ++it;
             }
+            ++it;
         }
     }
 
 private:
     typedef paradevs::pdevs::multithreading::Coordinator <
-    common::DoubleTime,
-    ParallelBuiltFlatGraphManager,
-    common::NoParameters,
-    GraphParameters > ParallelCoordinator;
+      common::DoubleTime,
+      ParallelBuiltFlatGraphManager,
+      common::NoParameters,
+      GraphParameters
+    > ParallelCoordinator;
 
     typedef std::vector < ParallelCoordinator* > Coordinators;
 

+ 12 - 11
src/tests/boost_graph/graph_partitioning.hpp

@@ -52,16 +52,16 @@ public:
                OutputEdgeList& output_edges,
                Connections& parent_connections)
     {
-		std::cout<<"**"<<cluster_number<<"**"<<std::endl;
+		// std::cout<<"**"<<cluster_number<<"**"<<std::endl;
         OrientedGraph go;
-        
+
         /** Méthode de contraction possible :
-         *  HEM : hem standars amélioré en temps 
-         *  HEM_degree : hem aves suppression de l'aléatoire 
+         *  HEM : hem standars amélioré en temps
+         *  HEM_degree : hem aves suppression de l'aléatoire
          *  autre : random_matching
          *  **/
-        std::vector<std::string> parameters = {"HEM", 
-											  partitioning_method_name, 
+        std::vector<std::string> parameters = {"HEM",
+											  partitioning_method_name,
 											  "diff", "ratio"};
         generator.generate(go);
 
@@ -73,10 +73,10 @@ public:
         if (contraction_coef_flag) {
 			uint coars = num_vertices(go) / contraction_coef;
 			uint nbr_tirage = 10;
-			std::vector<uint> numeric_parameters = {coars, 
-													cluster_number, 
+			std::vector<uint> numeric_parameters = {coars,
+													cluster_number,
 													nbr_tirage};
-        
+
             graphs = Multiniveau(&go, numeric_parameters,
                                  parameters, edge_partie ,
                                  output_edges, input_edges,
@@ -84,9 +84,9 @@ public:
         } else {
 			uint nbr_tirage = 10;
 			std::vector<uint> numeric_parameters = {contraction_coef ,
-													cluster_number, 
+													cluster_number,
 													nbr_tirage};
-	        
+
             graphs = Multiniveau(&go, numeric_parameters,
                                  parameters, edge_partie ,
                                  output_edges, input_edges,
@@ -113,6 +113,7 @@ public:
         //         std::cout << "}" << std::endl;
         //     }
         // }
+
         // {
         //     unsigned int i = 0;
 

+ 21 - 7
src/tests/boost_graph/models.hpp

@@ -30,8 +30,22 @@
 #include <paradevs/common/time/DoubleTime.hpp>
 #include <paradevs/kernel/pdevs/Dynamics.hpp>
 
+#define DELAY 100
+
 namespace paradevs { namespace tests { namespace boost_graph {
 
+void delay()
+{
+    for (unsigned int i = 0; i < DELAY; ++i) {
+        std::vector < int > v;
+
+        for (unsigned int j = 1000; j > 0; --j) {
+            v.push_back(j);
+        }
+        std::sort(v.begin(), v.end());
+    }
+}
+
 struct TopPixelParameters
 { };
 
@@ -52,6 +66,8 @@ public:
     virtual void dint(typename common::DoubleTime::type /* t */)
     {
 
+        delay();
+
         // std::cout << TopPixel < SchedulerHandle >::get_name() << " at "
         //           << t << ": dint" << std::endl;
 
@@ -68,11 +84,10 @@ public:
     { return 1; }
 
     virtual common::Bag < common::DoubleTime > lambda(
-        typename common::DoubleTime::type /* t */) const
+        typename common::DoubleTime::type t) const
     {
 
-        // std::cout << TopPixel < SchedulerHandle >::get_name() << " at "
-        //           << t << ": lambda" << std::endl;
+        // std::cout << get_name() << " at " << t << ": lambda" << std::endl;
 
         common::Bag < common::DoubleTime > bag;
 
@@ -111,8 +126,7 @@ public:
     virtual void dint(typename common::DoubleTime::type t)
     {
 
-        // std::cout << NormalPixel < SchedulerHandle >::get_name() << " at "
-        //           << t << ": dint" << std::endl;
+        delay();
 
         if (_phase == SEND) {
             _phase = WAIT;
@@ -126,7 +140,7 @@ public:
                       const common::Bag < common::DoubleTime >& bag)
     {
 
-        // std::cout << NormalPixel < SchedulerHandle >::get_name() << " at "
+        // std::cout << get_name() << " at "
         //           << t << ": dext -> "
         //           << bag.to_string() << std::endl;
 
@@ -143,7 +157,7 @@ public:
             }
         }
 
-        // std::cout << NormalPixel < SchedulerHandle >::get_name() << " at "
+        // std::cout << get_name() << " at "
         //           << t << ": dext -> "
         //           << _received << "/" << _neighbour_number
         //           << std::endl;

+ 198 - 198
src/tests/boost_graph/partitioning/gggp.cpp

@@ -57,11 +57,11 @@ void ggp(UnorientedGraph *g, Entiers *sommetsSource,
 				}
 				index_partition = i;
 				if(distance != -1){
-					ggp(g, sommetsSource, sommetsDestination, Partition, 
-						Partition.at(i)->at(rand_fini(0,Partition.at(i)->size())), 
+					ggp(g, sommetsSource, sommetsDestination, Partition,
+						Partition.at(i)->at(rand_fini(0,Partition.at(i)->size())),
 						index_partition, distance);
 				}else{
-					ggp(g, sommetsSource, sommetsDestination, Partition, 
+					ggp(g, sommetsSource, sommetsDestination, Partition,
 						rand_fini(0,Partition.at(i)->size()),
 						index_partition, distance);
 				}
@@ -69,7 +69,7 @@ void ggp(UnorientedGraph *g, Entiers *sommetsSource,
             }
         }
     }
-    
+
     double poids_max=0;
     for(uint i=0;i<sommetsSource->size();i++){
         poids_max+=(*g)[sommetsSource->at(i)]._weight;
@@ -81,13 +81,13 @@ void ggp(UnorientedGraph *g, Entiers *sommetsSource,
 		poids=(*g)[sommetsSource->at(rand)]._weight;
 		sommetsDestination->push_back(sommetsSource->at(rand));
 		sommetsSource->erase(sommetsSource->begin() + rand);
-		
+
 	}else{
 		poids=(*g)[rand]._weight;
 		sommetsDestination->push_back(rand);
 		suprim_val(*sommetsSource,rand);
 	}
-	
+
     uint cpt = 0;
     while(poids<poids_max && sommetsSource->size()>1)
     {
@@ -132,7 +132,7 @@ void ggp(UnorientedGraph *g, Entiers *sommetsSource,
         cpt++;
 
     }
-    
+
     sort(sommetsDestination->begin(), sommetsDestination->end());
 }
 
@@ -143,13 +143,13 @@ void Transfert_vertex_bissection(UnorientedGraph *g, Entiers *sommetsSource, Ent
 	{
 		double tmp_cut = cut;
 		if(name == "cut"){
-			sommets_cut.push_back(modif_Cout_coupe(*sommetsDestination,sommets_adj.at(i),tmp_cut,g)); 
+			sommets_cut.push_back(modif_Cout_coupe(*sommetsDestination,sommets_adj.at(i),tmp_cut,g));
 		}else if(name == "ratio"){
 			//std::cout<<"adj : "<<(*g)[sommets_adj.at(i)]._index<<" cut = "<<Modif_ratio_cut(g, sommetsSource, sommetsDestination, sommets_adj.at(i), tmp_cut)<<std::endl;
 			sommets_cut.push_back(Modif_ratio_cut(g, sommetsSource, sommetsDestination, sommets_adj.at(i), tmp_cut));
 		}
 	}
-	
+
 	cut = *min_element(sommets_cut.begin(),sommets_cut.end());
 	//std::cout<<"*** Passage 3 cut ***** : "<<cut<<std::endl;
 	//std::cout<<"Meilleur voisin : "<<(*g)[sommets_adj.at(recherche_val_double(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end())))]._index<<std::endl;
@@ -159,9 +159,9 @@ void Transfert_vertex_bissection(UnorientedGraph *g, Entiers *sommetsSource, Ent
 	//std::cout<<"*** Passage 3 cutb ***"<<std::endl;
 	suprim_val(*sommetsSource, sommets_adj[recherche_val_double(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]);
 	suprim_val(sommets_adj, sommets_adj[recherche_val_double(sommets_cut,*min_element(sommets_cut.begin(),sommets_cut.end()))]);
-	
+
 	//std::cout<<"*** Passage 3 fin ***"<<std::endl;
-	
+
 }
 
 void Tirage_transfert_vertex_bissection(UnorientedGraph *g, Entiers *sommetsSource, Entiers *sommetsDestination, const std::string &name, double &poids, double &cut){
@@ -194,16 +194,16 @@ bool Best_transfert_vertex_bissection(UnorientedGraph *g, Entiers *sommetsSource
 			Tirage_transfert_vertex_bissection(g, sommetsSource, sommetsDestination, name, poids, cut);
 			if((poids < (poids_max - poids_max*PC/100)) & (sommetsSource->size()>1)){
 				Best_transfert_vertex_bissection(g, sommetsSource, sommetsDestination, sommets_adj,
-												name, poids, poids_max, PC, stop, cpt, cut);	
-			}else{			
+												name, poids, poids_max, PC, stop, cpt, cut);
+			}else{
 				//std::cout<<"*** Passage 1ac ***"<<std::endl;
 				return true;
-			}			       
-		}else{	
+			}
+		}else{
 			//std::cout<<"*** Passage 1b ***"<<std::endl;
 			return true;
 		}
-		
+
 	}
 	else if ((sommets_adj.size() == 0) & (cpt>=stop)){
 		//std::cout<<"*** Passage 2 ***"<<std::endl;
@@ -224,7 +224,7 @@ void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource, Entiers *sommetsDesti
     Entiers sommets_adj;
     double poids_max = 0;
     double poids, cut;
-    
+
     if(sommetsSource->size()==1){
         Entiers tailles;
         for(uint i=0;i<Partition.size();i++){
@@ -245,7 +245,7 @@ void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource, Entiers *sommetsDesti
 						index_partition, name, distance);
 				else
 					gggp_pond(g, sommetsSource, sommetsDestination,
-						Partition, rand_fini(0,Partition.at(i)->size()), 
+						Partition, rand_fini(0,Partition.at(i)->size()),
 						index_partition, name ,distance);
                 return;
             }
@@ -256,14 +256,14 @@ void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource, Entiers *sommetsDesti
         poids_max+=(*g)[sommetsSource->at(i)]._weight;
     }
     poids_max/=2.;
-   
+
     if(distance == -1){
 		poids=(*g)[sommetsSource->at(rand)]._weight;
 		if(name == "cut"){
 			cut = Degree(*g,sommetsSource->at(rand));
 		}else if(name == "ratio"){
 			cut = Degree(*g,sommetsSource->at(rand));
-			double tmp_cut = cut/2./(*g)[sommetsSource->at(rand)]._weight 
+			double tmp_cut = cut/2./(*g)[sommetsSource->at(rand)]._weight
 				   + cut/2./(Cluster_Weight(*g,*sommetsSource)-(*g)[sommetsSource->at(rand)]._weight);
 			cut = tmp_cut;
 		}
@@ -288,7 +288,7 @@ void gggp_pond(UnorientedGraph *g, Entiers *sommetsSource, Entiers *sommetsDesti
 		if(next == true){
 			sort(sommetsDestination->begin(), sommetsDestination->end());
 			return;
-		}										
+		}
     }
     sort(sommetsDestination->begin(), sommetsDestination->end());
 }
@@ -299,7 +299,7 @@ if(sommets_adj.size()==0)
 	std::cout<<"*** Passage ***"<<std::endl;
 	if(poids < (poids_max - poids_max*40/100)){
 		Tirage_transfert_vertex_bissection(g, sommetsSource, sommetsDestination, name, poids);
-		
+
 		Liste_Voisin(*sommetsDestination,sommets_adj,*g);
 		if(sommets_adj.size() != 0){
 			Transfert_vertex_bissection(g, sommetsSource, sommetsDestination, sommets_adj, name, poids);
@@ -311,7 +311,7 @@ if(sommets_adj.size()==0)
 		sort(sommetsDestination->begin(), sommetsDestination->end());
 		return;
 	}
-	
+
 }
 else{
 	Transfert_vertex_bissection(g, sommetsSource, sommetsDestination, sommets_adj, name, poids);
@@ -319,14 +319,14 @@ else{
 
 
 void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
-             const std::string &nom_cut, int nbr_tirage, 
+             const std::string &nom_cut, int nbr_tirage,
              const std::string &nom_strat, bool rec, int distance)
 {
-	
+
 	UnorientedGraph copy_graph;
 	boost::copy_graph(*g,copy_graph);
 	int cpt = 0;
-	
+
 	for(int i = 0; i<floor(log(nbr_parties)/log(2)); i++){
 		for(int j = 0; j< pow(2,i);j++) {
 			if(distance == -1){
@@ -336,7 +336,7 @@ void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
 					Optimisation_method_neighbour_minweight(g,part,j, nom_cut, nom_strat);
 			}else
 				Optimisation_method_neighbour_distance(g,part,j,nbr_tirage, distance, nom_cut, nom_strat);
-				
+
 			if(rec){
 				std::vector<std::string> color;
 				color.push_back("[color=blue2, fontcolor=blue2];");
@@ -355,7 +355,7 @@ void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
 				color.push_back("[color=purple1, fontcolor=purpule1];");
 				color.push_back("[color=crimson, fontcolor=crimson];");
 				color.push_back("[color=black, fontcolor=black];");
-	    		
+
 	    		std::vector<char* > nom;
 				char * tmp_nom1 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_1.txt";
 				nom.push_back(tmp_nom1);
@@ -366,7 +366,7 @@ void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
 				char * tmp_nom4 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_4.txt";
 				nom.push_back(tmp_nom4);
 				char * tmp_nom5 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_5.txt";
-				nom.push_back(tmp_nom5);	
+				nom.push_back(tmp_nom5);
 				char * tmp_nom6 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_6.txt";
 				nom.push_back(tmp_nom6);
 				char * tmp_nom7 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_7.txt";
@@ -377,9 +377,9 @@ void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
 				nom.push_back(tmp_nom9);
 				char * tmp_nom10 = "../../sortie_graphe/Tests/Graphes/Bissection/txt/bissection_10.txt";
 				nom.push_back(tmp_nom10);
-			
+
 	    		std::ofstream GRAPH2 (nom.at(cpt), std::ios::out);
-				GRAPH2<<"graph G {"<<std::endl;   
+				GRAPH2<<"graph G {"<<std::endl;
 				tie(vertexIt, vertexEnd) = vertices(copy_graph);
 				for (; vertexIt != vertexEnd; ++vertexIt) {
 					GRAPH2<<(copy_graph)[*vertexIt]._index<<" -- {";
@@ -390,31 +390,31 @@ void Iter_2l(EntiersEntiers &part, int nbr_parties, UnorientedGraph *g,
 							GRAPH2<<(copy_graph)[*neighbourIt]._index<<";";
 					}
 					GRAPH2<<"}"<<std::endl;
-				}   
-				
+				}
+
 				for(uint k=0; k<part.size(); k++){
 					for(uint t=0; t<part.at(k)->size(); t++)
 					{
 						GRAPH2<<(copy_graph)[part.at(k)->at(t)]._index<<color.at(k)<<std::endl;
 					}
 				}
-	    
-				GRAPH2<<"}";	
+
+				GRAPH2<<"}";
 				GRAPH2.close();
 			}
-			
+
 			cpt ++;
 		}
     }
 }
 
 void bissectionRec(UnorientedGraph *g, EntiersEntiers &Partition,
-                   int nbr_parties, const std::string &nom_cut, 
-                   int nbr_tirage, const std::string &nom_strat, 
+                   int nbr_parties, const std::string &nom_cut,
+                   int nbr_tirage, const std::string &nom_strat,
                    int distance)
-{	
+{
     if((nbr_parties&(nbr_parties-1)) == 0)
-        Iter_2l(Partition, nbr_parties, g, nom_cut, nbr_tirage, 
+        Iter_2l(Partition, nbr_parties, g, nom_cut, nbr_tirage,
 						   nom_strat, false, distance);
     else{
         int puissance_2=0;
@@ -442,15 +442,15 @@ void bissectionRec(UnorientedGraph *g, EntiersEntiers &Partition,
 			if(distance == -1){
 				if(nbr_tirage != 0){
 					Optimisation_method_neighbour(g, Partition, j,
-												  nbr_tirage, nom_cut, 
+												  nbr_tirage, nom_cut,
 												  nom_strat);
 				}else{
 					Optimisation_method_neighbour_degree(g, Partition, j,
 												  nom_cut, nom_strat);
 				}
 			}else{
-				Optimisation_method_neighbour_distance(g, Partition, j, 
-												  nbr_tirage, distance, 
+				Optimisation_method_neighbour_distance(g, Partition, j,
+												  nbr_tirage, distance,
 												  nom_cut, nom_strat);
 			}
         }
@@ -563,12 +563,12 @@ EntiersEntiers Random_equal_weight_partitioning(UnorientedGraph *g,
 	EntiersEntiers Partition;
 	Entiers random_order =  Random_Sort_Vector(num_vertices(*g));
 	uint cpt = 0;
-	
+
 	for(uint j = 0 ; j < parts_number ; j++){
 		Entiers *part = new Entiers();
 		Partition.push_back(part);
 	}
-	
+
 	for(uint id = 0; id < random_order.size(); id++){
 		Partition.at(cpt)->push_back(random_order.at(id));
 		cpt++;
@@ -590,9 +590,9 @@ EntiersEntiers Random_partitioning(UnorientedGraph *g,
 	uint nbr_vertices = num_vertices(*g);
 	Entiers random_order =  Random_Sort_Vector(nbr_vertices);
 	uint cpt = 0;
-	
+
 	std::vector<int> taille;
-	
+
 	int tmp_size = nbr_vertices;
 	for(uint i = 0; i < parts_number - 1; i++){
 		int t1;
@@ -608,11 +608,11 @@ EntiersEntiers Random_partitioning(UnorientedGraph *g,
 				t1 = rand_fini(1, floor(tmp_size*(60-10*i/4)/100));
 		}
 		tmp_size -= t1;
-		taille.push_back(t1);	
+		taille.push_back(t1);
 	}
-	
+
 	taille.push_back(tmp_size);
-	
+
 	for(uint id_size = 0; id_size < taille.size(); id_size ++){
 		Entiers *part = new Entiers();
 		uint cpt_taille = 0;
@@ -631,33 +631,33 @@ EntiersEntiers Random_partitioning(UnorientedGraph *g,
 	return Partition;
 }
 
-void Coarsening_Phase(Base_Graph &baseg, ListEntiersEntiers &liste_corr, 
-					  uint niveau, int nbr_vertex, 
+void Coarsening_Phase(Base_Graph &baseg, ListEntiersEntiers &liste_corr,
+					  uint niveau, int nbr_vertex,
 					  std::string parameter){
 	uint cpt = 0;
 	bool stop = false;
-	
+
     while(!stop){
     	if(parameter == "HEM")
-			stop = contraction_HEM(baseg.at(cpt), baseg, 
+			stop = contraction_HEM(baseg.at(cpt), baseg,
 									liste_corr, niveau, nbr_vertex);
 		else if(parameter == "HEM_degree")
-			stop = contraction_HEM_degree(baseg.at(cpt), baseg, 
+			stop = contraction_HEM_degree(baseg.at(cpt), baseg,
 									liste_corr, niveau, nbr_vertex);
     	else
-    		stop = contraction_Random_Maching(baseg.at(cpt), baseg, 
+    		stop = contraction_Random_Maching(baseg.at(cpt), baseg,
 									liste_corr, niveau, nbr_vertex);
         cpt++;
     }
-    std::cout<<std::endl;
-    
+    // std::cout<<std::endl;
+
 }
 
-EntiersEntiers Partitioning_Phase(const Base_Graph &baseg, 
-					const std::vector<uint> &numeric_parameters, 
-					const std::vector<std::string> &parameters, 
+EntiersEntiers Partitioning_Phase(const Base_Graph &baseg,
+					const std::vector<uint> &numeric_parameters,
+					const std::vector<std::string> &parameters,
 					int distance){
-						
+
     EntiersEntiers Partition;
     if(parameters.at(1) == "gggp" || parameters.at(1) == "ggp"){
 		Entiers *part = new Entiers();
@@ -665,8 +665,8 @@ EntiersEntiers Partitioning_Phase(const Base_Graph &baseg,
 			part->push_back(i);
 		Partition.push_back(part);
 		bissectionRec(baseg.at(baseg.size()-1), Partition,
-					  numeric_parameters.at(1), parameters.at(3), 
-					  numeric_parameters.at(2), parameters.at(1), 
+					  numeric_parameters.at(1), parameters.at(3),
+					  numeric_parameters.at(2), parameters.at(1),
 					  distance);
     }
     else if(parameters.at(1) == "rand")
@@ -675,17 +675,17 @@ EntiersEntiers Partitioning_Phase(const Base_Graph &baseg,
 	else
 		Partition = Random_equal_weight_partitioning(baseg.at(baseg.size()-1),
 										numeric_parameters.at(1));
-	
+
 	return Partition;
-    
+
 }
 
-void Uncoarsening_Phase(const Base_Graph &baseg, 
-						EntiersEntiers &Partition, 
-						const std::vector<std::string> &parameters, 
-						ListEntiersEntiers &liste_corr, 
+void Uncoarsening_Phase(const Base_Graph &baseg,
+						EntiersEntiers &Partition,
+						const std::vector<std::string> &parameters,
+						ListEntiersEntiers &liste_corr,
 						double poids_moy, bool rec){
-	
+
     ListEntiersEntiers::iterator lit(liste_corr.end());
     bool proj;
     uint taille_list = liste_corr.size();
@@ -766,32 +766,32 @@ void Uncoarsening_Phase(const Base_Graph &baseg,
 		const char * tmp_nom_a16 = "../../sortie_graphe/Tests/Graphes/Multiniveau/txt/projection_partition_affine_16.txt";
 		nom_a.push_back(tmp_nom_a16);
 	}
-	
+
     for(uint y =0 ; y < taille_list ; y++){
     	if(!proj){
     		projection(Partition,lit);
     		if(rec)
-				Plot_UnorientedGraph_All(baseg.at(baseg.size()-2-y), 
+				Plot_UnorientedGraph_All(baseg.at(baseg.size()-2-y),
 										 Partition,nom.at(y), true);
 
-    		double cut = Cut_cluster(Partition, 
-										*baseg.at(baseg.size()-2-y), 
+    		double cut = Cut_cluster(Partition,
+										*baseg.at(baseg.size()-2-y),
 										parameters.at(3));
     		if(parameters.at(2) == "charge")
-    			Affinage_equilibrage_charge(baseg.at(baseg.size()-2-y), 
+    			Affinage_equilibrage_charge(baseg.at(baseg.size()-2-y),
 										Partition);
     		else if(parameters.at(2) == "locale"){
-    			Affinage_recherche_locale(baseg.at(baseg.size()-2-y), 
+    			Affinage_recherche_locale(baseg.at(baseg.size()-2-y),
 										Partition, cut, parameters.at(3));}
-    		else	
-    			Affinache_gain_diff(baseg.at(baseg.size()-2-y), 
-										Partition, cut, 
+    		else
+    			Affinache_gain_diff(baseg.at(baseg.size()-2-y),
+										Partition, cut,
 										parameters.at(3), poids_moy);
-			
+
 			if(rec)
-				Plot_UnorientedGraph_All(baseg.at(baseg.size()-2-y), 
+				Plot_UnorientedGraph_All(baseg.at(baseg.size()-2-y),
 										Partition, nom_a.at(y), true);
-			
+
     		lit--;
     	}
 
@@ -803,15 +803,15 @@ void Uncoarsening_Phase(const Base_Graph &baseg,
  * 1 -> type_methode   : nom de la méthode de partitionnement
  * 2 -> choix_affinage : nom de la méthode d'affinage
  * 3 -> type_cut       : nom de la fonction objectif étudiée
- * 
+ *
  * std::vector<uint> numeric_parameters :
  * 0 -> niveau_contraction : niveau de contraction à atteindre
  * 1 -> nbr_parties        : nombre de parties de la partition
  * 2 -> nbr_tirage         : nombre de tirage de sommet de depart
- * 3 -> distance           : distance minimum de selection de sommet 
+ * 3 -> distance           : distance minimum de selection de sommet
  * 							 de depart par default -1
  */
-	 
+
 OrientedGraphs Multiniveau(OrientedGraph *go,
                            const std::vector<uint> &numeric_parameters,
                            const std::vector<std::string> &parameters,
@@ -820,124 +820,124 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
                            InputEdgeList& inputedgelist,
                            Connections& connections,
                            bool rec, int distance)
-{   
+{
     boost::timer t;
     double t1, t2, t3, t4;
     UnorientedGraph *g = new UnorientedGraph();
-	make_unoriented_graph(*go, *g); 
+	make_unoriented_graph(*go, *g);
     Base_Graph baseg;
     baseg.push_back(g);
     ListEntiersEntiers liste_corr;
     OrientedGraphs Graphes;
     int val_cpt = num_vertices(*g);
     bool time = true;
-    
+
     /*Eigen::MatrixXd Madj = adjacence_matrix(g);
 	std::cout << Madj << std::endl << std::endl;*/
-    
+
     if(numeric_parameters.at(0) != val_cpt && parameters.at(1) != "rand" && parameters.at(1) != "rande"){
-		
+
 		Coarsening_Phase(baseg, liste_corr, numeric_parameters.at(0), val_cpt, parameters.at(0));
-	    
+
 	    if(rec){
 			std::ofstream GRAPHp ("../../sortie_graphe/Tests/Graphes/Bissection/poids_graphe.txt", std::ios::out);
-			GRAPHp<<"Poids du graphe contracté : "<<std::endl;   
+			GRAPHp<<"Poids du graphe contracté : "<<std::endl;
 			tie(vertexIt, vertexEnd) = vertices(*baseg.at(baseg.size()-1));
 			for (; vertexIt != vertexEnd; ++vertexIt) {
 				GRAPHp<<(*baseg.at(baseg.size()-1))[*vertexIt]._index<<" --> "<<(*baseg.at(baseg.size()-1))[*vertexIt]._weight<<std::endl;;
-			}   
-			GRAPHp<<"}";	
+			}
+			GRAPHp<<"}";
 			GRAPHp.close();
 		}
-	
+
 		if(time){
 			t2 = t.elapsed();
-			std::cout << "C : " << t2 << " ; ";
+			// std::cout << "C : " << t2 << " ; ";
 		}
-	    
+
 	    if(rec)
 			Plot_UnorientedGraph(baseg.at(baseg.size()-1),"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/contraction_final.txt");
-		
+
 		UnorientedGraph copy_graph;
 		boost::copy_graph(*baseg.at(baseg.size()-1),copy_graph);
-	
-		EntiersEntiers Partition = Partitioning_Phase(baseg, 
+
+		EntiersEntiers Partition = Partitioning_Phase(baseg,
 							numeric_parameters, parameters, distance);
-	    
+
 	    if(time){
 			t3 = t.elapsed();
-			std::cout << "P : " << (t3 - t2) << " ; ";
+			// std::cout << "P : " << (t3 - t2) << " ; ";
 	    }
-	    
+
 	    if(rec)
 			Plot_UnorientedGraph_All(&copy_graph,Partition,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/contraction_final_partition.txt", true);
-				
+
 		double poids_moy = 0.;
 		for(uint i =0; i < Partition.size(); i++)
 			poids_moy += Cluster_Weight(copy_graph,*Partition.at(i));
 		poids_moy/=Partition.size();
 		poids_moy = -1; /*poids faible*/
-		
-		Uncoarsening_Phase(baseg, Partition, parameters, 
+
+		Uncoarsening_Phase(baseg, Partition, parameters,
 								  liste_corr, poids_moy, rec);
-								  
+
 		if(time){
 			t4 = t.elapsed();
-			std::cout << "A : " << (t4 - t3) << " ; "<<std::endl;
+			// std::cout << "A : " << (t4 - t3) << " ; "<<std::endl;
 	    }
-	    
+
 	    for(uint si = 0; si < Partition.size(); si++){
-			std::cout<<Partition.at(si)->size()<<std::endl;
+			// std::cout<<Partition.at(si)->size()<<std::endl;
 		}
-		std::cout<<std::endl;
-	    
+		// std::cout<<std::endl;
+
 	    double ratio_cut = Cut_cluster(Partition, *g, parameters.at(3));
-	    std::cout<<"Ratio : "<<ratio_cut<<std::endl;
-		
+	    // std::cout<<"Ratio : "<<ratio_cut<<std::endl;
+
 		Graphes = Graph_Partition(Partition, go, g, outputedgelist,
 	                              inputedgelist, connections);
 	    if(rec)
 			Plot_OrientedGraph_All(go,Partition,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/résultat_partitionnement.txt", true);
-		
+
 		for(uint it = 0 ; it < Partition.size(); it++ )
 		{
 			delete Partition.at(it);
-		}	                                         
+		}
 	}else{
 		UnorientedGraph *copie_g = new UnorientedGraph();
 		boost::copy_graph(*g,*copie_g);
-		
-		EntiersEntiers Partition = Partitioning_Phase(baseg, 
-								   numeric_parameters, parameters, 
+
+		EntiersEntiers Partition = Partitioning_Phase(baseg,
+								   numeric_parameters, parameters,
 								   distance);
-								   
+
 		if(time){
 		    t1 = t.elapsed();
-			std::cout << "P : " << t1 << " ; "<<std::endl;
+			// std::cout << "P : " << t1 << " ; "<<std::endl;
 	    }
-	    
+
 	    for(uint si = 0; si < Partition.size(); si++){
-			std::cout<<Partition.at(si)->size()<<std::endl;
+			// std::cout<<Partition.at(si)->size()<<std::endl;
 		}
-		std::cout<<std::endl;
-	    
+		// std::cout<<std::endl;
+
 	    double ratio_cut = Cut_cluster(Partition, *copie_g, parameters.at(3));
-	    std::cout<<"Ratio : "<<ratio_cut<<std::endl;
-			
-		Graphes = Graph_Partition(Partition, go, copie_g, 
+	    // std::cout<<"Ratio : "<<ratio_cut<<std::endl;
+
+		Graphes = Graph_Partition(Partition, go, copie_g,
 								  outputedgelist, inputedgelist,
 								  connections);
-                                             
+
         if(rec)
 			Plot_OrientedGraph_All(go,Partition,"../../sortie_graphe/Tests/Graphes/Multiniveau/txt/résultat_partitionnement.txt", true);
-		
+
 		delete copie_g;
 		for(uint it = 0 ; it < Partition.size(); it++ )
 		{
 			delete Partition.at(it);
 		}
 	}
-    
+
     for(ListEntiersEntiers::iterator it = liste_corr.begin(); it != liste_corr.end(); it++)
     {
         for(EntiersEntiers::iterator it1 = (*it)->begin(); it1 != (*it)->end(); it1++)
@@ -954,25 +954,25 @@ OrientedGraphs Multiniveau(OrientedGraph *go,
         delete *it;
         *it = NULL;
     }
-    
+
     return Graphes;
 }
 
-void Optimisation_method_neighbour(UnorientedGraph *g, 
-			EntiersEntiers &Partition, int index_partition, 
-			int nbr_tirage, const std::string &name_cut, 
+void Optimisation_method_neighbour(UnorientedGraph *g,
+			EntiersEntiers &Partition, int index_partition,
+			int nbr_tirage, const std::string &name_cut,
 			const std::string &name_strat){
-				
+
 	/*Initialisation des parametres*/
 	Entiers *part2_cons = new Entiers();
 	Entiers *part_cour_cons = new Entiers();
 	double cut = 1000000000.;
-	
+
 	Entiers Random_list_vertices =  Random_Sort_Vector(Partition.at(index_partition)->size());
-		
+
 	if(Partition.at(index_partition)->size()< nbr_tirage)
 		nbr_tirage = Partition.at(index_partition)->size();
-		
+
 	/*Boucle de conservation de la meilleure bissection*/
 	for(int k = 0; k<nbr_tirage; k++){
 		Entiers *part2 = new Entiers();
@@ -982,23 +982,23 @@ void Optimisation_method_neighbour(UnorientedGraph *g,
 		/*Recopie de la partie faisant l'objet de la bissection */
 		for(uint t=0; t<Partition.at(index_partition)->size();t++)
 			tmp_part->push_back(Partition.at(index_partition)->at(t));
-		
+
 		if(name_strat == "gggp")
-			gggp_pond(g, tmp_part, part2, Partition, 
+			gggp_pond(g, tmp_part, part2, Partition,
 					  Random_list_vertices.at(k), index_partition,
 					  name_cut , -1);
 		else if(name_strat == "ggp")
-			ggp(g, tmp_part, part2, Partition, 
+			ggp(g, tmp_part, part2, Partition,
 					  Random_list_vertices.at(k), index_partition ,-1);
 		else
 			std::cout<<"Nom de stratégie de partitionnement non valide ! "<<std::endl;
-		
-		new_cut = Best_Cut_cluster(Partition, tmp_part, 
+
+		new_cut = Best_Cut_cluster(Partition, tmp_part,
 					  part2, index_partition, *g, name_cut);
-		
-		/*conservation de l'information en cas d'amélioration 
+
+		/*conservation de l'information en cas d'amélioration
 		 * de la contrainte*/
-		if(new_cut<cut){ 
+		if(new_cut<cut){
 			cut = new_cut;
 			delete part2_cons;
 			delete part_cour_cons;
@@ -1008,9 +1008,9 @@ void Optimisation_method_neighbour(UnorientedGraph *g,
 		else{
 			delete tmp_part;
 			delete part2;
-		}	
+		}
 	}
-	
+
 	for (uint i=0; i<part_cour_cons->size();i++)
     {
         for (uint j=0; j<part2_cons->size();j++)
@@ -1018,18 +1018,18 @@ void Optimisation_method_neighbour(UnorientedGraph *g,
             remove_edge(part_cour_cons->at(i),part2_cons->at(j),*g);
         }
     }
-    
+
 	/*Modification des informations*/
 	delete Partition.at(index_partition);
 	Partition.at(index_partition)=part_cour_cons;
 	Partition.push_back(part2_cons);
 }
 
-void Optimisation_method_neighbour_distance(UnorientedGraph *g, 
-			EntiersEntiers &Partition, int index_partition, 
-			int nbr_tirage, int distance, const std::string &name_cut, 
+void Optimisation_method_neighbour_distance(UnorientedGraph *g,
+			EntiersEntiers &Partition, int index_partition,
+			int nbr_tirage, int distance, const std::string &name_cut,
 			const std::string &name_strat){
-	
+
 	/*Initialisation des parametres*/
 	Entiers *part2_cons = new Entiers();
 	Entiers *part_cour_cons = new Entiers();
@@ -1040,10 +1040,10 @@ void Optimisation_method_neighbour_distance(UnorientedGraph *g,
 	for(uint verx =0; verx<Partition.at(index_partition)->size(); verx++){
 		vertex_list.push_back(Partition.at(index_partition)->at(verx));
 	}
-	
+
 	if(Partition.at(index_partition)->size()< nbr_tirage)
 		nbr_tirage = Partition.at(index_partition)->size();
-		
+
 	/*Boucle de conservation de la meilleure bissection*/
 	for(int k = 0; k<nbr_tirage; k++){
 		std::list<int>::iterator Iter;
@@ -1054,10 +1054,10 @@ void Optimisation_method_neighbour_distance(UnorientedGraph *g,
 			val = *Iter;
 			tirage_distance(g, *Iter, vertex_list, distance);
 		}
-		else{	
+		else{
 			break;
 		}
-		
+
 		Entiers *part2 = new Entiers();
 		Entiers *tmp_part = new Entiers();
 		double new_cut;
@@ -1065,20 +1065,20 @@ void Optimisation_method_neighbour_distance(UnorientedGraph *g,
 		/*Recopie de la partie faisant l'objet de la bissection*/
 		for(uint t=0; t<Partition.at(index_partition)->size();t++)
 			tmp_part->push_back(Partition.at(index_partition)->at(t));
-		
+
 		if(name_strat == "gggp")
-			gggp_pond(g, tmp_part, part2, Partition, val, 
+			gggp_pond(g, tmp_part, part2, Partition, val,
 					  index_partition, name_cut, distance);
 		else if(name_strat == "ggp")
-			ggp(g, tmp_part, part2, Partition, val, 
+			ggp(g, tmp_part, part2, Partition, val,
 					  index_partition, distance);
 		else
 			std::cout<<"Nom de stratégie de partitionnement non valide ! "<<std::endl;
-		
-		new_cut = Best_Cut_cluster(Partition, tmp_part, part2, 
+
+		new_cut = Best_Cut_cluster(Partition, tmp_part, part2,
 					  index_partition, *g,name_cut);
-		
-		if(new_cut<cut){ 
+
+		if(new_cut<cut){
 			cut = new_cut;
 			delete part2_cons;
 			delete part_cour_cons;
@@ -1090,7 +1090,7 @@ void Optimisation_method_neighbour_distance(UnorientedGraph *g,
 			delete part2;
 		}
 	}
-	
+
 	for (uint i=0; i<part_cour_cons->size();i++)
     {
         for (uint j=0; j<part2_cons->size();j++)
@@ -1098,87 +1098,87 @@ void Optimisation_method_neighbour_distance(UnorientedGraph *g,
 			remove_edge(part_cour_cons->at(i), part2_cons->at(j), *g);
         }
     }
-    
+
 	/*Modification des informations*/
 	delete Partition.at(index_partition);
 	Partition.at(index_partition)=part_cour_cons;
 	Partition.push_back(part2_cons);
 }
 
-void Optimisation_method_neighbour_degree(UnorientedGraph *g, 
+void Optimisation_method_neighbour_degree(UnorientedGraph *g,
 			EntiersEntiers &Partition, int index_partition,
-			const std::string &name_cut, 
+			const std::string &name_cut,
 			const std::string &name_strat){
-	
+
 	std::vector<double> vertex_degree;
 	Entiers *part2 = new Entiers();
-	
+
 	for(uint i =0; i<Partition.at(index_partition)->size(); i++)
-		vertex_degree.push_back(Degree(*g, 
+		vertex_degree.push_back(Degree(*g,
 								Partition.at(index_partition)->at(i)));
 
-	
+
 	uint best_cpt = 0;
 	double  best_degree = vertex_degree.at(0);
-	
+
 	for(uint i =1; i<vertex_degree.size(); i++){
 		if(vertex_degree.at(i)>best_degree){
 			best_degree = vertex_degree.at(i);
 			best_cpt = i;
 		}
 	}
-	
+
 	if(name_strat == "gggp")
-		gggp_pond(g, Partition.at(index_partition), part2, 
+		gggp_pond(g, Partition.at(index_partition), part2,
 				  Partition, best_cpt, index_partition,
 				  name_cut, -1);
 	else if(name_strat == "ggp")
-		ggp(g ,Partition.at(index_partition), part2, Partition, 
+		ggp(g ,Partition.at(index_partition), part2, Partition,
 				  best_cpt, index_partition, -1);
 	else
 		std::cout<<"Nom de stratégie de partitionnement non valide ! "<<std::endl;
-	
+
 	for (uint i=0; i<Partition.at(index_partition)->size();i++){
         for (uint j=0; j<part2->size();j++){
-			remove_edge(Partition.at(index_partition)->at(i), 
+			remove_edge(Partition.at(index_partition)->at(i),
 						part2->at(j), *g);
         }
     }
 
-	Partition.push_back(part2);	
+	Partition.push_back(part2);
 }
 
-void Optimisation_method_neighbour_minweight(UnorientedGraph *g, 
+void Optimisation_method_neighbour_minweight(UnorientedGraph *g,
 					EntiersEntiers &Partition, int index_partition,
-					const std::string &name_cut, 
+					const std::string &name_cut,
 					const std::string &name_strat){
-	
+
 	std::vector<double> vertex_weight;
 	Entiers *part2 = new Entiers();
-	
+
 	for(uint i =0; i<Partition.at(index_partition)->size(); i++){
 		vertex_weight.push_back((*g)[Partition.at(index_partition)->at(i)]._weight);
 	}
-	
+
 	uint best_cpt = 0;
 	double  best_weight = vertex_weight.at(0);
-	
+
 	for(uint i =1; i<vertex_weight.size(); i++){
 		if(vertex_weight.at(i)>best_weight){
 			best_weight = vertex_weight.at(i);
 			best_cpt = i;
 		}
 	}
-	
+
 	if(name_cut == "ratio"){
 		int tmp_best_cpt;
 		tmp_best_cpt = Partition.at(index_partition)->at(best_cpt);
 		best_cpt = tmp_best_cpt;
 	}
-	
+
 	if(name_strat == "gggp"){
 		gggp_pond(g, Partition.at(index_partition), part2,
-					 Partition, best_cpt, index_partition, 
+					 Partition, best_cpt, index_partition,
 					 name_cut, -1);
 	} else if(name_strat == "ggp"){
 		ggp(g, Partition.at(index_partition), part2,
@@ -1186,21 +1186,21 @@ void Optimisation_method_neighbour_minweight(UnorientedGraph *g,
 	} else {
 		std::cout<<"Nom de stratégie de partitionnement non valide ! "<<std::endl;
 	}
-	
+
 	for (uint i=0; i<Partition.at(index_partition)->size();i++)
     {
         for (uint j=0; j<part2->size();j++)
         {
-			remove_edge(Partition.at(index_partition)->at(i), 
+			remove_edge(Partition.at(index_partition)->at(i),
 					 part2->at(j), *g);
         }
     }
 
 	Partition.push_back(part2);
-	
+
 }
 
-void tirage_distance(UnorientedGraph *g, int tirage, 
+void tirage_distance(UnorientedGraph *g, int tirage,
 						std::list<int> &vertex_list, int distance){
 	std::vector<std::list<int> > vertex_delete;
 	std::list<int> liste1;
@@ -1208,14 +1208,14 @@ void tirage_distance(UnorientedGraph *g, int tirage,
 
 	liste1.push_back(tirage);
 	vertex_delete.push_back(liste1);
-		
+
 	for(int i=0; i<distance; i++){
 		std::list<int> liste_tmp;
 		std::list<int>::iterator Ite_tmp;
 		for(Ite_tmp = vertex_delete.at(i).begin();
 								Ite_tmp != vertex_delete.at(i).end();
 								Ite_tmp ++){
-			tie(neighbourIt, neighbourEnd) = 
+			tie(neighbourIt, neighbourEnd) =
 								adjacent_vertices(*Ite_tmp,*g);
 			for (; neighbourIt != neighbourEnd; ++neighbourIt){
 				liste_tmp.push_back(*neighbourIt);
@@ -1225,12 +1225,12 @@ void tirage_distance(UnorientedGraph *g, int tirage,
 		liste_tmp.unique();
 		vertex_delete.push_back(liste_tmp);
 	}
-	
+
 	for(int index = 0; index < vertex_delete.size(); index ++){
 		vd.merge(vertex_delete.at(index));
 	}
 	vd.unique();
-		
+
 	std::list<int>::iterator Ite;
 	for(Ite = vd.begin(); Ite != vd.end(); Ite ++){
 		vertex_list.remove(*Ite);

+ 91 - 91
src/tests/boost_graph/partitioning/graph_build.cpp

@@ -76,9 +76,9 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
 		og[v7] = VertexProperties(7, 1., TOP_PIXEL);
 		og[v9] = VertexProperties(9, 1., TOP_PIXEL);
-		
+
 	} else if(edge_number == 38){
-		
+
 		vertex_to v0 = boost::add_vertex(og);
 		vertex_to v1 = boost::add_vertex(og);
 		vertex_to v2 = boost::add_vertex(og);
@@ -117,7 +117,7 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		vertex_to v35 = boost::add_vertex(og);
 		vertex_to v36 = boost::add_vertex(og);
 		vertex_to v37 = boost::add_vertex(og);
-		
+
 		add_edge(v1, v0, EdgeProperties(1.), og);
 		add_edge(v2, v0, EdgeProperties(1.), og);
 		add_edge(v3, v0, EdgeProperties(1.), og);
@@ -182,7 +182,7 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		add_edge(v36, v37, EdgeProperties(1.), og);
 		add_edge(v36, v33, EdgeProperties(1.), og);
 		add_edge(v37, v33, EdgeProperties(1.), og);
-		
+
 		add_edge(v4, v0, EdgeProperties(1.), og);
 		add_edge(v9, v2, EdgeProperties(1.), og);
 		add_edge(v28, v24, EdgeProperties(1.), og);
@@ -195,7 +195,7 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		add_edge(v21, v23, EdgeProperties(1.), og);
 		add_edge(v23, v20, EdgeProperties(1.), og);
 		add_edge(v26, v4, EdgeProperties(1.), og);
-		
+
 		og[v6] = VertexProperties(6, 1, NORMAL_PIXEL);
 		og[v8] = VertexProperties(8, 1, NORMAL_PIXEL);
 		og[v10] = VertexProperties(10, 1, NORMAL_PIXEL);
@@ -234,7 +234,7 @@ void build_graph(OrientedGraph& og, unsigned int edge_number)
 		og[v35] = VertexProperties(35, 1, NORMAL_PIXEL);
 		og[v36] = VertexProperties(36, 1, TOP_PIXEL);
 		og[v37] = VertexProperties(37, 1, NORMAL_PIXEL);
-		
+
 	}else{
 		std::cout<<"Le type de artificiel graphe choisi n'existe pas ! "<<std::endl;
 	}
@@ -313,7 +313,7 @@ void build_example_linked9(OrientedGraph& og)
 	vertex_to v7 = boost::add_vertex(og);
 	vertex_to v8 = boost::add_vertex(og);
 	vertex_to v9 = boost::add_vertex(og);
-	
+
 	add_edge(v1, v0, EdgeProperties(1.), og);
 	add_edge(v2, v0, EdgeProperties(1.), og);
 	add_edge(v3, v0, EdgeProperties(1.), og);
@@ -328,7 +328,7 @@ void build_example_linked9(OrientedGraph& og)
 	add_edge(v8, v2, EdgeProperties(1.), og);
 	add_edge(v9, v1, EdgeProperties(1.), og);
 	add_edge(v9, v3, EdgeProperties(1.), og);
-	
+
 	og[v6] = VertexProperties(6, 1, TOP_PIXEL);
 	og[v8] = VertexProperties(8, 1, TOP_PIXEL);
 	og[v0] = VertexProperties(0, 1, NORMAL_PIXEL);
@@ -750,11 +750,11 @@ void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, in
 
 	brhtg_exutoire(go,nbr_vertex,nbr_v_min,nbr_v_max,
 				Ram,Vertexs,nbr_passe);
-				
+
 	} else {
 			brhtg_source(go,nbr_vertex,nbr_source,nbr_v_min,nbr_v_max,niveau,Ram,Exu,Vertexs,nbr_passe,nbr_npb);
 	}
-	
+
 	std::vector < int > dg_in_vertex_list;
 	std::vector <vertex_to> dg_vertex_list;
 	OrientedGraph::vertex_iterator it_dg, end_dg;
@@ -779,7 +779,7 @@ void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, in
 			++dg_in_vertex_list[index];
 		}
 	}
-	
+
 	int compteur = 0;
 	for(uint i = 0; i<num_vertices(*go); i++){
 		bool indic = false;
@@ -795,19 +795,19 @@ void build_generator_graph(OrientedGraph *go, int nbr_vertex, int nbr_source, in
 		}
 		//std::cout<<(*go)[i]._index<<" "<<indic<<" -> "<<(*go)[i]._type<<std::endl;
 	}
-	
+
 	std::cout<<"Compteur : "<<compteur<<std::endl;
 }
 
 void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_couche, int nbr_v_min, int nbr_v_max){
 	std::vector<vertex_to> Vertexs;
 	OrientedGraph::in_edge_iterator ei, edge_end;
-	
+
 	for(int i =0; i<nbr_vertex; i++){
 		vertex_to vo = boost::add_vertex(*go);
 		Vertexs.push_back(vo);
 	}
-	
+
 	/*Création du vecteur contenant le nombre de sommets par couche*/
 	int midel_couche = nbr_couche-2;
 	int top_couche;
@@ -820,35 +820,35 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 	int tmp = 0;
 	std::vector<int> nbr_som_couche;
 	nbr_som_couche.push_back(1);
-	
+
 	for(int i = 1; i <= midel_couche; i++){
 		tmp += i;
 	}
-	
+
 	for(int i = 0; i < midel_couche; i++){
 		nbr_som_couche.push_back(floor((i+1)*nbr_vertex_midel_couche/tmp));
 	}
-	
+
 	nbr_som_couche.push_back(top_couche);
-	
+
 	int sum = 0;
 	for(int i = 0; i < nbr_som_couche.size(); i++){
 		sum += nbr_som_couche.at(i);
 	}
 	int reste = nbr_vertex - sum;
-	
+
 	/*std::cout<<"sum : "<<sum<<std::endl;
 	std::cout<<"midel_couche : "<<midel_couche<<std::endl;
 	std::cout<<"top_couche : "<<top_couche<<std::endl;
 	std::cout<<"nbr_vertex_midel_couche : "<<nbr_vertex_midel_couche<<std::endl;
 	std::cout<<"tmp : "<<tmp<<std::endl;
 	std::cout<<"reste : "<<reste<<std::endl;
-	
+
 	for(int i =0; i < nbr_som_couche.size(); i++){
 		std::cout<<nbr_som_couche.at(i)<<" ";
 	}
 	std::cout<<std::endl;*/
-	
+
 	while(reste != 0){
 		for(int i = 1; i <nbr_som_couche.size(); i++){
 			nbr_som_couche.at(i) += 1;
@@ -858,26 +858,26 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 			}
 		}
 	}
-	
+
 	/*for(int i =0; i < nbr_som_couche.size(); i++){
 		std::cout<<nbr_som_couche.at(i)<<" ";
 	}
 	std::cout<<std::endl;*/
-	
+
 	/*Génération du graphe*/
 	std::vector<int> tab_couche_som;
 	tab_couche_som.push_back(0);
-	
+
 	for(int i =1; i<nbr_som_couche.size(); i++){
 		tab_couche_som.push_back(tab_couche_som.at(i-1)+nbr_som_couche.at(i));
 	}
-	
+
 	/*for(int i =0; i < tab_couche_som.size(); i++){
 		std::cout<<tab_couche_som.at(i)<<" ";
 	}
 	std::cout<<std::endl;*/
 	int nbr_vois = nbr_v_max+2;
-	
+
 	int cpt = 0;
 	for(int i = tab_couche_som.at(tab_couche_som.size()-2)+1; i <= tab_couche_som.at(tab_couche_som.size()-1); i++){
 		std::vector<int> vertex_tmp;
@@ -904,7 +904,7 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 		cpt ++;
 	}
 	//std::cout<<"Passage !"<<std::endl;
-	
+
 	for(int j = 2; j < tab_couche_som.size()-1; j++){
 		cpt = 0;
 		for(int i = tab_couche_som.at(tab_couche_som.size()-1-j)+1; i <= tab_couche_som.at(tab_couche_som.size()-1-(j-1)); i++){
@@ -936,14 +936,14 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 				if(In_tab(vertex_tmp,val) != 1){
 					boost::add_edge(Vertexs.at(i), Vertexs.at(val), EdgeProperties(1.), *go);
 					vertex_tmp.push_back(val);
-					neigh_cpt ++;	
+					neigh_cpt ++;
 				}
 			}
 			cpt ++;
 		}
 	}
 	//std::cout<<"Passage2 !"<<std::endl;
-	
+
 	for(int i = tab_couche_som.at(0)+1; i <= tab_couche_som.at(1); i++){
 		//int val = rand_fini(0,2);
 		//if(val == 0){
@@ -951,7 +951,7 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 		//}
 	}
 	//std::cout<<"Passage3 !"<<std::endl;
-	
+
 	std::vector < int > dg_in_vertex_list;
 	std::vector <vertex_to> dg_vertex_list;
 	OrientedGraph::vertex_iterator it_dg, end_dg;
@@ -976,7 +976,7 @@ void build_generator_graph_linked(OrientedGraph *go, int nbr_vertex, int nbr_cou
 			++dg_in_vertex_list[index];
 		}
 	}
-	
+
 	for(uint i = 0; i<num_vertices(*go); i++){
 		bool indic = false;
 		for(tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
@@ -998,7 +998,7 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 		vertex_to vo = boost::add_vertex(*go);
 		Vertexs.push_back(vo);
 	}
-	
+
 	if(rec == true){
 		std::ofstream fichier (edge_weight, std::ios::out);
 		for(int i = 0; i<side; i++){
@@ -1007,7 +1007,7 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 				fichier<<i*side+j<<" "<<i*side+j+1<<" "<<1<<" "<<std::endl;
 			}
 		}
-		
+
 		for(int i = 0; i<side-1; i++){
 			for(int j = 0; j<side; j++){
 				boost::add_edge(i*side+j, (i+1)*side+j,EdgeProperties(1), *go);
@@ -1021,19 +1021,19 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 				boost::add_edge(i*side+j, i*side+j+1,EdgeProperties(1), *go);
 			}
 		}
-		
+
 		for(int i = 0; i<side-1; i++){
 			for(int j = 0; j<side; j++){
 				boost::add_edge(i*side+j, (i+1)*side+j,EdgeProperties(1), *go);
 			}
 		}
 	}
-		
+
 	(*go)[0] = VertexProperties(0, 1, TOP_PIXEL);
 	for(uint i = 1; i<num_vertices(*go); i++){
 			(*go)[i] = VertexProperties(i, 1, NORMAL_PIXEL);
 	}
-	
+
 	for(int ind=0; ind<vertex_selection.size(); ind++){
 		for(int ind_i = vertex_selection.at(ind).first; ind_i<vertex_selection.at(ind).second+1; ind_i++){
 			if(ind_i != 0)
@@ -1042,10 +1042,10 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 				(*go)[ind_i] = VertexProperties(ind_i, weight_vertex.at(ind), TOP_PIXEL);
 		}
 	}
-	
+
 	if(rec == false){
 		std::ifstream fichier (edge_weight, std::ios::in);
-		
+
 		if(fichier){
 			bool found;
 			edge_to e1;
@@ -1065,13 +1065,13 @@ void build_graph_grid(OrientedGraph *go, int side, const std::vector<std::pair<i
 			fichier.seekg(length+1, std::ios::beg);
 			cpt++;
 			}
-			
+
 		}else{
-			std::cerr<<"Bugggggg du fichier txt !!!! "<<std::endl;
+			// std::cerr<<"Bugggggg du fichier txt !!!! "<<std::endl;
 		}
 		fichier.close();
 	}
-	
+
 }
 
 void build_example_ligne(OrientedGraph& og)
@@ -1100,7 +1100,7 @@ void build_example_ligne(OrientedGraph& og)
 	og[v3] = VertexProperties(3, 1, NORMAL_PIXEL);
 	og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
 	og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
-	og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);	
+	og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
 }
 
 void build_example_grid(OrientedGraph& og)
@@ -1139,7 +1139,7 @@ void build_example_grid(OrientedGraph& og)
 	og[v4] = VertexProperties(4, 1, NORMAL_PIXEL);
 	og[v5] = VertexProperties(5, 1, NORMAL_PIXEL);
 	og[v7] = VertexProperties(7, 1, NORMAL_PIXEL);
-}	
+}
 
 void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 {
@@ -1147,21 +1147,21 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 	OrientedGraph::in_edge_iterator ei, edge_end;
 	double max_distance =  3000;//sqrt(2)*5*size_max/50;
 	double crit = sqrt(2)*5*size_max/1000;
-	
+
 	std::cout << "distance max : " << max_distance << std::endl;
 	std::cout << "crit : " << crit << std::endl;
 	for(uint i = 0; i < size_max; i++)
-	{	
+	{
 		std::pair<double,double> p;
 		p.first = rand()%(size_max*5-0) + 0;
 		p.second = rand()%(size_max*5-0) + 0;
 		point.push_back(p);
-	} 
-	
+	}
+
 	//std::cout << std::endl;
 	sort(point.begin(),point.end());
 	std::vector<std::vector<std::pair<double,uint> > > save_point_distance;
-	
+
 	for(uint id = 0 ; id < point.size() - 1; id++)
 	{
 		std::vector<std::pair<double,uint> > point_distance, point_distance_sort;
@@ -1182,20 +1182,20 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 				point_distance.push_back(pd);
 			}
 		}*/
-		
+
 		point_distance_sort = point_distance;
-		
+
 		sort(point_distance_sort.begin(), point_distance_sort.end());
 		std::vector<uint> deleted;
 		uint t;
-		
-		
-		
+
+
+
 		if(point_distance_sort.size() > 50)
 			t = point_distance_sort.size()/2;
 		else
 			t = point_distance_sort.size();
-		
+
 		/*if(name != "multi"){*/
 			for(uint i = 0 ; i < t; i++)
 			{
@@ -1212,20 +1212,20 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 			}
 		}*/
 		//std::cout<<std::endl;
-		
+
 		sort(deleted.begin(), deleted.end());
 		std::reverse(deleted.begin(), deleted.end());
-		
+
 		/*for(uint k = 0 ; k < deleted.size(); k++)
 			std::cout << deleted.at(k) << " " ;
 		std::cout<< std::endl << std::endl;*/
-		
+
 		/*std::cout << "A : " << std::endl;
 		for(uint pp = 0; pp < point_distance.size(); pp++)
 			std::cout << point_distance.at(pp).second << " ";
-			
+
 		std::cout<< std::endl << std::endl;*/
-		
+
 		if(deleted.size() > 1)
 		{
 			//std::cout<<"Deleted"<<std::endl;
@@ -1275,7 +1275,7 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 			//std::cout << deleted.at(0) << " ";
 			for(uint idp = 0; idp < point_distance.size(); idp++)
 			{
-				
+
 				if(point_distance.at(idp).second == deleted.at(0))
 				{
 					/*if(name != "multi")
@@ -1293,7 +1293,7 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 						for(uint j = idp; j < point_distance.size(); j++)
 							point_distance.at(j).second -= 1;
 						//std::cout << " toto " << std::endl;
-						
+
 					/*}else{
 						point.erase(point.begin() + idp);
 						point_distance.erase(point_distance.begin() + idp);
@@ -1314,16 +1314,16 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		/*std::cout << " B : " << std::endl;
 		for(uint pp = 0; pp < point_distance.size(); pp++)
 			std::cout << point_distance.at(pp).second << " ";
-			
+
 		std::cout << std::endl << std::endl;*/
-		
+
 		//sort(point_distance.begin(), point_distance.end());
 		save_point_distance.push_back(point_distance);
 		//std::cout << std::endl;
 	}
 	std::cout << "nombre de sommet" << point.size() << std::endl;
-	
-	
+
+
 	for(uint xt = 0; xt < save_point_distance.size(); xt++){
 		//std::cout << "** " << xt << " ** : ";
 		sort(save_point_distance.at(xt).begin(), save_point_distance.at(xt).end());
@@ -1332,25 +1332,25 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		}
 		std::cout << std::endl;*/
 	}
-	
-	
+
+
 	std::vector<vertex_to> Vertexs;
 	for(int i = 0; i < point.size(); i++){
 		vertex_to vo = boost::add_vertex(*go);
 		Vertexs.push_back(vo);
 	}
-	
+
 	//std::cout << point.size() << std::endl;
 	for(int i = 0; i < point.size() -1; i++){
 		//std::cout << i << std::endl;
 		double dist = 0.;
 		uint xi;
-		
+
 		//if(name != "multi")
 			xi = 0;
 		/*else
 			xi = 1;*/
-			
+
 		while(dist < max_distance & xi < save_point_distance.at(i).size())
 		{
 			dist = save_point_distance.at(i).at(xi).first;
@@ -1364,9 +1364,9 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		}
 		(*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
 	}
-	
+
 	(*go)[Vertexs.at(point.size()-1)] = VertexProperties(point.size()-1, 1., NORMAL_PIXEL);
-	
+
 	/*std::cout << "ok"<< point.size() << std::endl;
 	for(int i = 0; i < (point.size() - arcs_max); i++)
 	{
@@ -1377,15 +1377,15 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		Entiers arcs;
 		for(uint p = 0; p < ac; p++)
 			arcs.push_back(tmp_vector.at(p));
-		
+
 		//sort(arcs.begin(),arcs.end());
-		
+
 		for(uint j = 0; j < arcs.size(); j++)
 			add_edge(Vertexs.at(i), Vertexs.at(arcs.at(j)), EdgeProperties(1.), *go);
-		
+
 		(*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
 	}
-	
+
 	std::cout << "ok1"<<std::endl;
 	for(int i = point.size() - arcs_max; i < point.size() - 2; i++)
 	{
@@ -1394,20 +1394,20 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		Entiers arcs;
 		for(uint p = 0; p < ac; p++)
 			arcs.push_back(tmp_vector.at(p));
-			
+
 		sort(arcs.begin(),arcs.end());
-		
+
 		for(uint j = 0; j < arcs.size(); j++)
 			add_edge(Vertexs.at(i), Vertexs.at(arcs.at(j)), EdgeProperties(1.), *go);
-		
+
 		(*go)[Vertexs.at(i)] = VertexProperties(i, 1., NORMAL_PIXEL);
 	}
 	std::cout << "ok2"<<std::endl;
-	
+
 	add_edge(Vertexs.at(point.size()-2), Vertexs.at(point.size()-1), EdgeProperties(1.), *go);
 	(*go)[Vertexs.at(point.size()-2)] = VertexProperties(point.size()-2, 1., NORMAL_PIXEL);
 	(*go)[Vertexs.at(point.size()-1)] = VertexProperties(point.size()-1, 1., NORMAL_PIXEL);*/
-	
+
 	for(uint i = 0; i< point.size(); i++){
 		bool indic = false;
 		for(tie(ei,edge_end) = in_edges(i,*go); ei != edge_end; ++ei){
@@ -1421,8 +1421,8 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		}
 		//std::cout<<(*go)[i]._index<<" "<<indic<<" -> "<<(*go)[i]._type<<std::endl;
 	}
-	
-	
+
+
 }
 
 /*void build_graph_grid_center(OrientedGraph *go, int side, const std::vector<std::pair<int,int>> &vertex_selection, const Entiers &weight_vertex,const char *edge_weight, bool rec){
@@ -1432,20 +1432,20 @@ void build_parcellaire_graph(OrientedGraph *go, uint size_max, std::string name)
 		vertex_to vo = boost::add_vertex(*go);
 		Vertexs.push_back(vo);
 	}
-	
+
 	// Ité 0
 	for(uint i = 0; i < 4; i++){
 		boost::add_edge(0, 2 + 2*i ,EdgeProperties(1) , *go);
 	}
-	
-	// Ité 1 
-	
+
+	// Ité 1
+
 	for(uint i = 1; i < 9; i++){
-		
+
 	}
-	
-	
-	
+
+
+
 }*/
 
 /*Vérification de la pondération + vérification des poids de la contraction + vérification de la structure de contraction*/

+ 9 - 0
src/tests/multithreading/CMakeLists.txt

@@ -12,5 +12,14 @@ LINK_DIRECTORIES(
 ADD_EXECUTABLE(pdevs-multithreading-tests graph_manager.hpp tests.cpp)
 
 TARGET_LINK_LIBRARIES(pdevs-multithreading-tests
+  ${Boost_SYSTEM_LIBRARY}
+  ${Boost_TIMER_LIBRARY})
+
+ADD_EXECUTABLE(pdevs-multithreading-main graph_manager.hpp main.cpp
+  ../boost_graph/graph_builder.hpp ../boost_graph/graph_generator.hpp
+  ../boost_graph/graph_defs.hpp ../boost_graph/graph_manager.hpp
+  ../boost_graph/graph_partitioning.hpp ../boost_graph/models.hpp)
+
+TARGET_LINK_LIBRARIES(pdevs-multithreading-main partitioning
   ${Boost_SYSTEM_LIBRARY}
   ${Boost_TIMER_LIBRARY})

+ 130 - 0
src/tests/multithreading/main.cpp

@@ -0,0 +1,130 @@
+/**
+ * @file tests/multithreading/main.cpp
+ * @author The PARADEVS Development Team
+ * See the AUTHORS or Authors.txt file
+ */
+
+/*
+ * PARADEVS - the multimodeling and simulation environment
+ * This file is a part of the PARADEVS environment
+ *
+ * Copyright (C) 2013-2015 ULCO http://www.univ-litoral.fr
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <paradevs/common/RootCoordinator.hpp>
+
+#include <tests/boost_graph/models.hpp>
+#include <tests/boost_graph/graph_builder.hpp>
+#include <tests/boost_graph/graph_generator.hpp>
+#include <tests/boost_graph/graph_manager.hpp>
+#include <tests/boost_graph/graph_partitioning.hpp>
+
+#include <chrono>
+
+using namespace paradevs::common;
+using namespace std::chrono;
+
+void monothreading()
+{
+    unsigned int side = 100;
+    std::vector<std::pair<int,int>> vertex_selection;
+    std::pair<int,int> tmp;
+    tmp.first = 0;
+    tmp.second = 3;
+    vertex_selection.push_back(tmp);
+    paradevs::tests::boost_graph::Entiers weight_vertex;
+    weight_vertex.push_back(1);
+    const char *edge_weight;
+    edge_weight = "../../sortie_graphe/tests_grid.txt";
+    bool rec = false;
+
+    paradevs::tests::boost_graph::RandomGridGraphGenerator generator(
+        side, vertex_selection,  weight_vertex, edge_weight, rec);
+
+    paradevs::common::RootCoordinator <
+        DoubleTime, paradevs::pdevs::Coordinator <
+            DoubleTime,
+            paradevs::tests::boost_graph::HeapHierarchicalGraphManager <
+                paradevs::tests::boost_graph::PartitioningGraphBuilder >,
+            paradevs::common::NoParameters,
+            paradevs::tests::boost_graph::PartitioningParameters >
+        > rc(0, 10, "root", paradevs::common::NoParameters(),
+             paradevs::tests::boost_graph::PartitioningParameters(4,
+                                                                  "gggp",
+                                                                  20,
+                                                                  false,
+                                                                  generator));
+
+    steady_clock::time_point t1 = steady_clock::now();
+
+    rc.run();
+
+    steady_clock::time_point t2 = steady_clock::now();
+
+    duration < double > time_span = duration_cast <
+        duration < double > >(t2 - t1);
+
+    std::cout << "MONO = " << time_span.count() << std::endl;
+}
+
+void multithreading(int cluster_number)
+{
+    unsigned int side = 100;
+    std::vector<std::pair<int,int>> vertex_selection;
+    std::pair<int,int> tmp;
+    tmp.first = 0;
+    tmp.second = 3;
+    vertex_selection.push_back(tmp);
+    paradevs::tests::boost_graph::Entiers weight_vertex;
+    weight_vertex.push_back(1);
+    const char *edge_weight;
+    edge_weight = "../../sortie_graphe/tests_grid.txt";
+    bool rec = false;
+
+    paradevs::tests::boost_graph::RandomGridGraphGenerator generator(
+        side, vertex_selection,  weight_vertex, edge_weight, rec);
+
+    paradevs::common::RootCoordinator <
+        DoubleTime, paradevs::pdevs::multithreading::Coordinator <
+            DoubleTime,
+            paradevs::tests::boost_graph::ParallelHeapHierarchicalGraphManager <
+                paradevs::tests::boost_graph::PartitioningGraphBuilder >,
+            paradevs::common::NoParameters,
+            paradevs::tests::boost_graph::PartitioningParameters >
+        > rc(0, 10, "root", paradevs::common::NoParameters(),
+             paradevs::tests::boost_graph::PartitioningParameters(
+                 cluster_number, "gggp", 20, false, generator));
+
+    steady_clock::time_point t1 = steady_clock::now();
+
+    rc.run();
+
+    steady_clock::time_point t2 = steady_clock::now();
+
+    duration < double > time_span = duration_cast <
+        duration < double > >(t2 - t1);
+
+    std::cout << "MULTI = " << time_span.count() << std::endl;
+}
+
+int main()
+{
+    monothreading();
+    for (int i = 2; i <= 8; ++i) {
+        multithreading(i);
+    }
+    return 0;
+}