Ejemplo n.º 1
0
    Builder(const vle::devs::ExecutiveInit& init,
            const vle::devs::InitEventList& events)
      : vle::devs::Executive(init, events)
    {
        model_prefix = events.getString("model-prefix");
        model_classname = events.getString("model-class");
        condition_name = events.getString("node-condition");
        graph_type = events.getString("graph-type");
        graph_connectivity = events.getString("graph-connectiviy");
        directed = events.getBoolean("graph-directed");

        if (graph_type == "graph")
            use_graph_generator(events);
        else if (graph_type == "regular")
            use_regular_graph_generator(events);
        else
            throw vle::utils::ModellingError("Unknown graph type %s",
                                             graph_type.c_str());
    }
Ejemplo n.º 2
0
    CompareDateAI(const vle::devs::ExecutiveInit &init,
                  const vle::devs::InitEventList &evts)
        : vle::devs::Executive(init, evts)
    {
        vle::utils::Package package("safihr.cropmodel");

        initialize_date(package.getDataFile(evts.getString("filename")));

        std::sort(date.begin(), date.end(),
                  [] (const data& lhs,
                      const data& rhs)
                  {
                      return lhs.dmin < rhs.dmin;
                  });

        DTraceModel(vle::fmt("AI need to build: %1% models") % date.size());
        DTraceModel(vle::fmt("Table: %1%") % date);
    }
Ejemplo n.º 3
0
    void use_graph_generator(const vle::devs::InitEventList& events)
    {
        model_number = events.getInt("model-number");
        std::string generator_name = events.getString("graph-generator");

        if (events.exist("graph-seed"))
            generator.seed(events.getInt("graph-seed"));

        if (generator_name == "defined")
            use_defined_graph_generator(events);
        else if (generator_name == "small-world")
            use_smallworld_graph_generator(events);
        else if (generator_name == "scale-free")
            use_scalefree_graph_generator(events);
        else if (generator_name == "sorted-erdos-renyi")
            use_sortederdesrenyi_graph_generator(events);
        else if (generator_name == "erdos_renyi")
            use_erdosrenyi_graph_generator(events);
        else
            throw vle::utils::ModellingError("Unknown graph gererator: %s",
                                             generator_name.c_str());
    }