Bladeren bron

Add simple model

Eric Ramat 9 jaren geleden
bovenliggende
commit
ea92360d76

+ 1 - 0
src/tests/boost_graph/partitioning/utils.hpp

@@ -2346,6 +2346,7 @@ OrientedGraphs Graph_Partition(const EntiersEntiers& Partition,
             vertex_to v = add_vertex(graph);
 
             tab_vertex_to.push_back(v);
+
             graph[v] = VertexProperties((*go)[Partition.at(i)->at(j)]);
         }
         neigh_community.push_back(community);

+ 6 - 0
src/tests/pdevs/CMakeLists.txt

@@ -12,5 +12,11 @@ LINK_DIRECTORIES(
 ADD_EXECUTABLE(pdevs-tests graph_manager.hpp models.hpp tests.cpp)
 
 TARGET_LINK_LIBRARIES(pdevs-tests
+  ${Boost_SYSTEM_LIBRARY}
+  ${Boost_TIMER_LIBRARY})
+
+ADD_EXECUTABLE(pdevs-main graph_manager.hpp models.hpp main.cpp)
+
+TARGET_LINK_LIBRARIES(pdevs-main
   ${Boost_SYSTEM_LIBRARY}
   ${Boost_TIMER_LIBRARY})

+ 4 - 3
src/tests/pdevs/graph_manager.hpp

@@ -127,6 +127,7 @@ private:
         S2GraphManager > S2;
 };
 
+template < typename M >
 class OnlyOneGraphManager :
         public paradevs::pdevs::GraphManager < common::DoubleTime >
 {
@@ -135,16 +136,16 @@ public:
                         const paradevs::common::NoParameters& parameters) :
         paradevs::pdevs::GraphManager < common::DoubleTime >(coordinator,
                                                           parameters),
-        a("a", common::NoParameters())
+        model("m", common::NoParameters())
     {
-        add_child(&a);
+        add_child(&model);
     }
 
     virtual ~OnlyOneGraphManager()
     { }
 
 private:
-    paradevs::pdevs::Simulator < common::DoubleTime, A > a;
+    paradevs::pdevs::Simulator < common::DoubleTime, M > model;
 };
 
 class FlatGraphManager :

+ 48 - 0
src/tests/pdevs/main.cpp

@@ -0,0 +1,48 @@
+/**
+ * @file pdevs/tests.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 <tests/pdevs/graph_manager.hpp>
+#include <tests/pdevs/models.hpp>
+
+#include <paradevs/common/RootCoordinator.hpp>
+
+using namespace paradevs::tests::pdevs;
+using namespace paradevs::common;
+
+int main()
+{
+    paradevs::common::RootCoordinator <
+        DoubleTime, paradevs::pdevs::Coordinator <
+            DoubleTime,
+            OnlyOneGraphManager < ThreeStateModel > >
+        > rc(0, 500, "root", paradevs::common::NoParameters(),
+             paradevs::common::NoParameters());
+
+    rc.run();
+
+    return 0;
+
+}

+ 195 - 0
src/tests/pdevs/models.hpp

@@ -354,6 +354,201 @@ private:
     double _value;
 };
 
+class TwoStateModel :
+        public paradevs::pdevs::Dynamics < common::DoubleTime >
+{
+public:
+    TwoStateModel(const std::string& name,
+                  const common::NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < common::DoubleTime >(name, parameters)
+    { }
+    virtual ~TwoStateModel()
+    { }
+
+    void dint(typename common::DoubleTime::type t)
+    {
+        if (_phase == S1) {
+            _phase = S2;
+        } else if (_phase == S2) {
+            _phase = S1;
+        }
+        _last_time = t;
+    }
+
+    typename common::DoubleTime::type start(
+        typename common::DoubleTime::type t)
+    {
+        _phase = S1;
+        _last_time = t;
+        return ta(t);
+    }
+
+    typename common::DoubleTime::type ta(
+        typename common::DoubleTime::type /* t */) const
+    {
+        if (_phase == S1) {
+            return 5;
+        } else {
+            return 6;
+        }
+    }
+
+    common::Bag < common::DoubleTime > lambda(
+        typename common::DoubleTime::type t) const
+    {
+
+        std::cout << (t - _last_time) << std::endl;
+
+        return common::Bag < common::DoubleTime >();
+    }
+
+private:
+    enum Phase { S1, S2 };
+
+    Phase _phase;
+    typename common::DoubleTime::type _last_time;
+};
+
+class ThreeStateModel :
+        public paradevs::pdevs::Dynamics < common::DoubleTime >
+{
+public:
+    ThreeStateModel(const std::string& name,
+                    const common::NoParameters& parameters) :
+        paradevs::pdevs::Dynamics < common::DoubleTime >(name, parameters)
+    { }
+    virtual ~ThreeStateModel()
+    { }
+
+    bool full()
+    {
+        unsigned int n = 0;
+
+        if (S1 == -1) ++n;
+        if (S2 == -1) ++n;
+        if (S3 == -1) ++n;
+        if (S4 == -1) ++n;
+        if (S5 == -1) ++n;
+        return n >= 4;
+    }
+
+    void dint(typename common::DoubleTime::type t)
+    {
+        if (S1 > 10 or S2 > 10 or S3 > 10 or S4 > 10 or S5 > 10) {
+            if (S1 > 10) {
+                S1 = -1;
+            }
+            if (S2 > 10) {
+                S2 = -1;
+            }
+            if (S3 > 10) {
+                S3 = -1;
+            }
+            if (S4 > 10) {
+                S4 = -1;
+            }
+            if (S5 > 10) {
+                S5 = -1;
+            }
+            _last_time = t;
+        }
+        if (full()) {
+            if (S1 == -1) {
+                S1 = 0;
+                // speed1 = speed1 == 1 ? 5 : 1;
+            }
+            if (S2 == -1) {
+                S2 = 0;
+                // speed2 = speed2 == 3 ? 1 : 3;
+            }
+            if (S3 == -1) {
+                S3 = 0;
+                // speed3 = speed3 == 2 ? 1 : 2;
+            }
+            if (S4 == -1) {
+                S4 = 0;
+                // speed4 = speed4 == 1 ? 3 : 1;
+            }
+            if (S5 == -1) {
+                S5 = 0;
+                // speed5 = speed5 == 2 ? 1 : 2;
+            }
+        }
+        if (S1 != -1 and S1 <= 10) {
+            S1 += 0.21 * speed1;
+        }
+        if (S2 != -1 and S2 <= 10) {
+            S2 += 0.3 * speed2;
+        }
+        if (S3 != -1 and S3 <= 10) {
+            S3 += 0.7 * speed3;
+        }
+        if (S4 != -1 and S4 <= 10) {
+            S4 += 0.56 * speed4;
+        }
+        if (S5 != -1 and S5 <= 10) {
+            S5 += 0.14 * speed5;
+        }
+
+        // std::cout << S1 << " " << S2 << " "
+        //           << S3 << " " << S4 << " "
+        //           << S5 << " " << std::endl;
+
+    }
+
+    typename common::DoubleTime::type start(
+        typename common::DoubleTime::type t)
+    {
+        S1 = S2 = S3 = S4 = S5 = 0;
+        speed1 = speed2 = speed3 = speed4 = speed5 = 1;
+
+        // speed1 = 1;
+        // speed2 = 3;
+        // speed3 = 2;
+        // speed4 = 1;
+        // speed5 = 2;
+        _last_time = t;
+        return 0;
+    }
+
+    typename common::DoubleTime::type ta(
+        typename common::DoubleTime::type /* t */) const
+    { return 1; }
+
+    common::Bag < common::DoubleTime > lambda(
+        typename common::DoubleTime::type t) const
+    {
+
+        if (S1 > 10 or S2 > 10 or S3 > 10 or S4 > 10 or S5 > 10) {
+            std::cout << (t - _last_time) << " ";
+            if (S1 > 10) {
+                std::cout << "S1";
+            }
+            if (S2 > 10) {
+                std::cout << "S2";
+            }
+            if (S3 > 10) {
+                std::cout << "S3";
+            }
+            if (S4 > 10) {
+                std::cout << "S4";
+            }
+            if (S5 > 10) {
+                std::cout << "S5";
+            }
+            std::cout << std::endl;
+        }
+
+        return common::Bag < common::DoubleTime >();
+    }
+
+private:
+    double S1, S2, S3, S4, S5;
+    double speed1, speed2, speed3, speed4, speed5;
+
+    typename common::DoubleTime::type _last_time;
+};
+
 } } } // namespace paradevs tests pdevs
 
 #endif

+ 1 - 1
src/tests/pdevs/tests.cpp

@@ -40,7 +40,7 @@ TEST_CASE("pdevs/only_one", "run")
     paradevs::common::RootCoordinator <
         DoubleTime, paradevs::pdevs::Coordinator <
             DoubleTime,
-            OnlyOneGraphManager >
+            OnlyOneGraphManager < A > >
         > rc(0, 10, "root", paradevs::common::NoParameters(),
              paradevs::common::NoParameters());
 

+ 13 - 24
src/tests/plot/dispersion.hpp

@@ -29,10 +29,10 @@
 
 #include <cmath>
 
-namespace paradevs { namespace tests { namespace plot {
-
 #define SCALE 4
 
+namespace paradevs { namespace tests { namespace plot {
+
 class KleinDispersionFunction
 {
 public:
@@ -87,28 +87,21 @@ public:
         double wind_speed,
         double wind_direction) const
     {
-        paradevs::tests::boost_graph::Point destination1, destination2;
+        paradevs::tests::boost_graph::Point destination1(destination);
+        paradevs::tests::boost_graph::Point destination2;
 
-        double delta_x = destination._x - source._x;
+        //Changement de repère centré en (source._x, source._y)
+        destination1._x -= source._x;
+        destination1._y -= source._y;
 
-        // TODO:
-        if (delta_x > 0) {
-            double delta_y = destination._y - source._y;
-            double distance = std::sqrt(delta_x * delta_x + delta_y * delta_y) *
-                SCALE;
+        //Rotation des axes d'angle wind_direction
+        destination2._x = destination1._x * std::cos(wind_direction) +
+            destination1._y * std::sin(wind_direction);
+        destination2._y = -destination1._x * std::sin(wind_direction) +
+            destination1._y * std::cos(wind_direction);
 
-            destination1  = destination;
-
-            //Changement de repère centré en (source._x, source._y)
-            destination1._x -= source._x;
-            destination1._y -= source._y;
-
-            //Rotation des axes d'angle wind_direction
-            destination2._x = destination1._x * std::cos(wind_direction) +
-                destination1._y * std::sin(wind_direction);
-            destination2._y = -destination1._x * std::sin(wind_direction) +
-                destination1._y * std::cos(wind_direction);
 
+        if (destination2._x > 0) {
             // double sigma_y = 0.0787*x/(std::pow(1+x/707,0.135));
             // double sigma_z = 0.0475*x/(std::pow(1+x/707, 0.465));
 
@@ -122,10 +115,6 @@ public:
                 std::exp(-0.5 * std::pow(h / sigma_z, 2)) *
                 std::exp(-0.5 * std::pow(destination2._y * SCALE / sigma_y, 2));
 
-            // std::cout << (destination2._x * SCALE) << " "
-            //           << (destination2._y * SCALE) << " "
-            //           << (disp * 3600 * 24) << std::endl;
-
             return disp * 3600 * 24 * 1e4;
         } else {
             return 0.0;

+ 125 - 54
src/tests/plot/graph_builder.hpp

@@ -51,7 +51,9 @@ using namespace geos::geom;
 using namespace geos::simplify;
 using namespace paradevs::tests::boost_graph;
 
-#define DELTA 10.
+#define DISTANCE 1000.
+#define SCALE 4.
+#define DELTA 20 // 2.5
 
 namespace paradevs { namespace tests { namespace plot {
 
@@ -104,6 +106,81 @@ public:
     }
 
 private:
+    void build_neighbourhood(
+        OrientedGraph& g,
+        std::map < int, OrientedGraph::vertex_descriptor >& vertices,
+        const std::map < int, std::pair < Polygon*, Points > >& polygons,
+        const std::map < int, bool >& select)
+    {
+        // build vertices
+        std::map < int, std::pair < Polygon*, Points > >::const_iterator it =
+            polygons.begin();
+
+        while (it != polygons.end()) {
+            vertices[it->first] = boost::add_vertex(g);
+            if (select.find(it->first)->second) {
+                g[vertices[it->first]] = VertexProperties(it->first, 1.,
+                                                      it->second.second, 0);
+            } else {
+                g[vertices[it->first]] = VertexProperties(it->first, 1.,
+                                                          Points(), 0);
+            }
+            ++it;
+        }
+
+        // build edges
+        it = polygons.begin();
+        while (it != polygons.end()) {
+            if (select.find(it->first)->second) {
+                std::map < int,
+                           std::pair < Polygon*,
+                                       Points > >::const_iterator it2 =
+                    polygons.begin();
+
+                while (it2 != polygons.end()) {
+                    if (select.find(it2->first)->second) {
+                        if (it->first != it2->first) {
+                            if (it->second.first->distance(
+                                    it2->second.first) < DISTANCE) {
+                                boost::add_edge(vertices[it->first],
+                                                vertices[it2->first], 1., g);
+                                g[vertices[it2->first]]._neighbour_number++;
+                            }
+                        }
+                    }
+                    ++it2;
+                }
+            }
+            ++it;
+        }
+
+            // compute neighbour
+        // int buffer = 10;
+        // std::map < int, Polygon* >::const_iterator it = polygons.begin();
+
+        // while (it != polygons.end()) {
+        //     Geometry* bufferedPolygon = it->second->buffer(buffer);
+        //     std::map < int, Polygon* >::const_iterator it2 = polygons.begin();
+
+        //     while (it2 != polygons.end()) {
+        //         if (it->first != it2->first) {
+        //             if (bufferedPolygon->intersects(it2->second)) {
+        //                 boost::add_edge(vertices[it->first],
+        //                                 vertices[it2->first], 1., g);
+
+        //                 g[vertices[it2->first]]._neighbour_centroids.push_back(
+        //                     paradevs::tests::boost_graph::Point(
+        //                         g[vertices[it->first]]._centroid));
+        //             }
+        //         }
+        //         ++it2;
+        //     }
+        //     delete bufferedPolygon;
+        //     ++it;
+        // }
+
+    }
+
     void generate(OrientedGraph& g)
     {
         SHPHandle hSHP;
@@ -120,8 +197,8 @@ private:
         const CoordinateSequenceFactory* seqFactory =
             CoordinateArraySequenceFactory::instance();
         std::vector < Geometry* > holes;
-        std::map < int, Polygon* > polygons;
-        std::vector < OrientedGraph::vertex_descriptor > vertices;
+        std::map < int, std::pair < Polygon*, Points > > polygons;
+        std::map < int, OrientedGraph::vertex_descriptor > vertices;
 
         // read shapefile file and build polygons
         for (int i = 0; i < nEntities; i++) {
@@ -168,6 +245,7 @@ private:
                          y < (*object->getEnvelope()->getCoordinates())[2].y;
                          y += DELTA) {
                         Coordinate c;
+
                         c.x = x;
                         c.y = y;
 
@@ -181,66 +259,23 @@ private:
                 }
             }
 
-            polygons[i] = dynamic_cast < Polygon* >(object->clone());
-
-            geos::algorithm::CentroidArea centroid;
-
-            centroid.add(object.get());
-
-            vertices.push_back(boost::add_vertex(g));
-            g[vertices.back()] = VertexProperties(i, 1., list, 0);
+            polygons[i] = std::make_pair(
+                dynamic_cast < Polygon* >(object->clone()), list);
 
             delete ring;
             SHPDestroyObject(psShape);
         }
 
-        // compute neighbour
-        // int buffer = 10;
-        // std::map < int, Polygon* >::const_iterator it = polygons.begin();
-
-        // while (it != polygons.end()) {
-        //     Geometry* bufferedPolygon = it->second->buffer(buffer);
-        //     std::map < int, Polygon* >::const_iterator it2 = polygons.begin();
+        std::map < int, bool > select;
 
-        //     while (it2 != polygons.end()) {
-        //         if (it->first != it2->first) {
-        //             if (bufferedPolygon->intersects(it2->second)) {
-        //                 boost::add_edge(vertices[it->first],
-        //                                 vertices[it2->first], 1., g);
+        select_polygons(polygons, select);
+        build_neighbourhood(g, vertices, polygons, select);
 
-        //                 g[vertices[it2->first]]._neighbour_centroids.push_back(
-        //                     paradevs::tests::boost_graph::Point(
-        //                         g[vertices[it->first]]._centroid));
-        //             }
-        //         }
-        //         ++it2;
-        //     }
-        //     delete bufferedPolygon;
-        //     ++it;
-        // }
-
-        // compute neighbour
-        std::map < int, Polygon* >::const_iterator it = polygons.begin();
-
-        while (it != polygons.end()) {
-            std::map < int, Polygon* >::const_iterator it2 = polygons.begin();
-
-            while (it2 != polygons.end()) {
-                if (it->first != it2->first) {
-                    if (it->second->distance(it2->second) < 10) {
-                        boost::add_edge(vertices[it->first],
-                                        vertices[it2->first], 1., g);
-                        g[vertices[it2->first]]._neighbour_number++;
-                    }
-                }
-                ++it2;
-            }
-            ++it;
-        }
+        std::map < int, std::pair < Polygon*, Points > >::const_iterator it =
+            polygons.begin();
 
-        it = polygons.begin();
         while (it != polygons.end()) {
-            delete it->second;
+            delete it->second.first;
             ++it;
         }
 
@@ -263,6 +298,42 @@ private:
 
     }
 
+    void select_polygons(const std::map < int, std::pair < Polygon*, Points > >&
+                         polygons, std::map < int, bool >& select)
+    {
+        double sum = 0;
+
+        std::map < int, std::pair < Polygon*, Points > >::const_iterator it =
+            polygons.begin();
+
+        while (it != polygons.end()) {
+            sum += it->second.first->getArea() * SCALE * SCALE / 1e4;
+            select[it->first] = false;
+            ++it;
+        }
+
+        std::cout << "Total area = " << sum << " Ha" << std::endl;
+
+        int n = 0;
+
+        sum = 0;
+        while (sum < 150) {
+            int index = rand() % polygons.size();
+
+            if (not select[index] and
+                polygons.find(index)->second.first->getArea() *
+                SCALE * SCALE  > 10 * 1e4) {
+                select[index] = true;
+                sum += polygons.find(index)->second.first->getArea() *
+                    SCALE * SCALE / 1e4;
+                ++n;
+            }
+        }
+
+        std::cout << "Select number = " << n << " for " << sum << std::endl;
+
+    }
+
     int _cluster_number;
     std::string _file_name;
 };

+ 10 - 0
src/tests/plot/graph_manager.hpp

@@ -84,6 +84,10 @@ public:
                                       g[*vertexIt]._neighbour_number);
 
             ss << "" << g[*vertexIt]._index;
+
+            // std::cout << "CREATE SIMULATOR: " << g[*vertexIt]._index
+            //           << std::endl;
+
             _simulators[g[*vertexIt]._index] = new Simulator(ss.str(),
                                                              parameters);
             _simulators[g[*vertexIt]._index]->add_out_port("out");
@@ -142,9 +146,15 @@ public:
             if (not coordinator->exist_in_port(ss_in.str())) {
                 coordinator->add_in_port(ss_in.str());
             }
+
+            // std::cout << "CREATE LINK TO => " << it->second << " "
+            //           << std::endl;
+
             BuiltFlatGraphManager::add_link(
                 coordinator, ss_in.str(),
                 BuiltFlatGraphManager::_simulators[it->second], "in");
+                // BuiltFlatGraphManager::_simulators[
+                //     parameters._graph[it->second]._index], "in");
         }
 
         // output

+ 1 - 1
src/tests/plot/main.cpp

@@ -44,7 +44,7 @@ double plot_monothreading(const std::string& shapefile)
             HierarchicalGraphManager,
             paradevs::common::NoParameters,
             GraphManagerParameters >
-        > rc(0, 100, "root", paradevs::common::NoParameters(),
+        > rc(0, 500, "root", paradevs::common::NoParameters(),
              GraphManagerParameters(shapefile, 4));
 
     steady_clock::time_point t1 = steady_clock::now();

+ 29 - 50
src/tests/plot/models.hpp

@@ -39,8 +39,8 @@
 #include <cmath>
 
 #define WIND_SPEED 6
-#define WIND_DIRECTION 0
-#define PLOT_ID 297
+#define WIND_DIRECTION 1.57 // 0 (ouest) 3.1415 (est)
+#define PLOT_ID 153 // 240 // (est) 50 (sud) 159 (centre) 126 (ouest)
 
 namespace paradevs { namespace tests { namespace plot {
 
@@ -57,7 +57,7 @@ struct PlotParameters
     int _neighbour_number;
 };
 
-typedef std::vector < double > Doubles;
+typedef std::vector < long double > Doubles;
 
 struct PlotData
 {
@@ -93,18 +93,6 @@ public:
             _data.ready_spore_numbers.push_back(0.);
         }
 
-        // std::cout << "(" << _centroid._x << "," << _centroid._y << "): ";
-        // for (Points::const_iterator it = _neighbour_centroids.begin();
-        //      it != _neighbour_centroids.end(); ++it) {
-        //     double distance = std::sqrt(
-        //         (_centroid._x - it->_x) * (_centroid._x - it->_x) +
-        //         (_centroid._y - it->_y) * (_centroid._y - it->_y));
-
-        //     std::cout << "(" << it->_x << "," << it->_y << ") -> " << distance
-        //               << " ";
-        // }
-        // std::cout << std::endl;
-
         _handle = DBFOpen("/home/eric/tmp/parcelle/test/parcellaire.dbf",
                           "rb+");
 
@@ -115,15 +103,10 @@ public:
     }
 
     virtual ~Plot()
-    {
-        DBFClose(_handle);
-    }
+    { DBFClose(_handle); }
 
     void dint(typename common::DoubleTime::type t)
     {
-        // std::cout << _index << " " << t << ": dint - BEFORE - "
-        //           << _phase << std::endl;
-
         if (_phase == SEND) {
             if (_neighbour_number > 0) {
                 _phase = WAIT;
@@ -185,12 +168,8 @@ public:
                 }
             }
 
-            // sum += _dispersion_function(
-            //     t, _centroid,
-            //     paradevs::tests::boost_graph::Point(_centroid._x + 10,
-            //                                         _centroid._y), 6., 0.) *
-            //     _data.ready_spore_number;
-
+            // affect new spores to milsol model
+            // and compute mean
             {
                 double sum = 0;
                 double p = 0;
@@ -206,13 +185,7 @@ public:
                     }
                 }
 
-            // std::cout << t << "\t" << _index << "\t"
-            //           << _data.ready_spore_number << "\t"
-            //           << _milsol.get_zoospore_number() << "\t"
-            //           << sum << "\t"
-            //           << p << std::endl;
-
-                DBFWriteDoubleAttribute(_handle, _index, 0, p);
+                DBFWriteDoubleAttribute(_handle, _index, (int)t, p);
             }
 
             _phase  = SEND;
@@ -220,10 +193,6 @@ public:
             _received = 0;
             _neighbour_data.clear();
         }
-
-        // std::cout << _index << " " << t << ": dint - AFTER - "
-        //           << _phase << std::endl;
-
     }
 
     void dext(typename common::DoubleTime::type t,
@@ -232,7 +201,19 @@ public:
     {
         for (common::Bag < common::DoubleTime >::const_iterator it =
                  bag.begin(); it != bag.end(); ++it) {
-            _neighbour_data.push_back(*(PlotData*)(it->get_content()));
+            PlotData data = *(PlotData*)(it->get_content());
+
+            _neighbour_data.push_back(data);
+
+            std::cout << _index << " " << t << ": dext - "
+                      << data.index << " [ ";
+
+            for (int k = 0; k < data.ready_spore_numbers.size(); ++k) {
+                std::cout << data.ready_spore_numbers[k] << " ";
+            }
+
+            std::cout << "]" << std::endl;
+
             ++_received;
         }
 
@@ -243,11 +224,6 @@ public:
             _phase = WAIT;
             _sigma = common::DoubleTime::infinity;
         }
-
-        // std::cout << _index << " " << t << ": dext - "
-        //           << _received << "/"
-        //           << _neighbour_centroids.size()
-        //           << " " << _phase << std::endl;
     }
 
     void dconf(typename common::DoubleTime::type t,
@@ -263,13 +239,16 @@ public:
     typename common::DoubleTime::type start(
         typename common::DoubleTime::type /* t */)
     {
-        for (std::vector < Milsol >::iterator it = _milsol.begin();
-             it != _milsol.end(); ++it) {
-            it->set_inoculum_primaire_number(0);
-        }
-
         if (_index == PLOT_ID) {
-            _milsol[0].set_inoculum_primaire_number(1e6);
+            for (std::vector < Milsol >::iterator it = _milsol.begin();
+                 it != _milsol.end(); ++it) {
+                it->set_inoculum_primaire_number(1e6);
+            }
+        } else {
+            for (std::vector < Milsol >::iterator it = _milsol.begin();
+                 it != _milsol.end(); ++it) {
+                it->set_inoculum_primaire_number(0);
+            }
         }
 
         _phase = SEND;