Esempio n. 1
0
        Rm(const vle::devs::DynamicsInit& model,
           const vle::devs::InitEventList& events) :
               DifferentialEquation(model,events)
        {
            gamma = events.getDouble("gamma"); //= 0.2
            nu  = events.getDouble("nu");// = 0.0

            R.init(this, "R", events);
            S.init(this, "S", events);
            I.init(this, "I", events);
        }
Esempio n. 2
0
        Rm(const vle::devs::DynamicsInit& model,
           const vle::devs::InitEventList& events) :
            ved::DifferentialEquation(model,events)
        {
            gamma = events.getDouble("gamma"); //= 0.2
            nu  = events.getDouble("nu");// = 0.0

            R = createVar("R");
            S = createExt("S");
            I = createExt("I");
        }
Esempio n. 3
0
        LotkaVolterraY(const vle::devs::DynamicsInit& model,
                       const vle::devs::InitEventList& events) :
            DifferentialEquation(model,events)
        {
            gamma = (events.exist("gamma"))
                ? events.getDouble("gamma") : 0.5;
            delta = (events.exist("delta"))
                ? events.getDouble("delta") : 0.5;

            Y.init(this, "Y", events);
            X.init(this, "X", events);
        }
Esempio n. 4
0
File: Sm.cpp Progetto: GG31/packages
        Sm(const vle::devs::DynamicsInit& model,
           const vle::devs::InitEventList& events) :
            ved::DifferentialEquation(model,events)
        {
            beta = events.getDouble("beta");// = 0.9
            nu  = events.getDouble("nu");// = 0.0

            S = createVar("S");                  
            E = createExt("E");
            I = createExt("I");
            R = createExt("R");

        }
Esempio n. 5
0
        LotkaVolterraX(const vle::devs::DynamicsInit& model,
                       const vle::devs::InitEventList& events) :
            ved::DifferentialEquation(model,events)
        {

            alpha = (events.exist("alpha"))
                ? events.getDouble("alpha") : 0.5;
            beta = (events.exist("beta"))
                ? events.getDouble("beta") : 0.5;

            X = createVar("X");
            Y = createExt("Y");
        }
Esempio n. 6
0
        LotkaVolterraY(const vle::devs::DynamicsInit& model,
                       const vle::devs::InitEventList& events) :
            ved::DifferentialEquation(model,events)
        {
            gamma = (events.exist("gamma"))
                ? events.getDouble("gamma") : 0.5;
            delta = (events.exist("delta"))
                ? events.getDouble("delta") : 0.5;


            Y = createVar("Y");
            X = createExt("X");
        }
    TimeSlicingMethod(DifferentialEquation& eq,
            const vd::InitEventList& events) :
            DifferentialEquationImpl(eq, events), devs_state(INIT),
            devs_options(), devs_guards(), devs_internal(),
            int_method(*this, events)
    {
        if (events.exist("output_period")) {
            const value::Value& v = *(events.get("output_period"));
            devs_options.output_period = 0;
            if (v.isInteger()) {
                devs_options.output_period = v.toInteger().value();
            }
            if (devs_options.output_period < 1) {
                throw utils::ModellingError(vle::utils::format(
                        "[%s] Parameter 'output_period' should be an int > 0",
                        getModelName().c_str()));
            }
        }
        if (events.exist("time_step")) {
            devs_options.dt = events.getDouble("time_step");
            if (devs_options.dt <= 0) {
                throw utils::ModellingError(vle::utils::format(
                        "[%s] Parameter 'time_step' should be > 0",
                        getModelName().c_str()));
            }
        }

    }
Esempio n. 8
0
    void use_erdosrenyi_graph_generator(const vle::devs::InitEventList& events)
    {
        vle::translator::graph_generator::parameter param{
            std::bind(&Builder::graph_generator_make_model,
                      this,
                      std::placeholders::_1,
                      std::placeholders::_2,
                      std::placeholders::_3),
            graph_generator_connectivity(),
            directed
        };

        vle::translator::graph_generator gg(param);

        if (events.exist("fraction"))
            gg.make_erdos_renyi(*this,
                                generator,
                                model_number,
                                events.getDouble("fraction"),
                                events.getBoolean("allow-self-loops"));
        else
            gg.make_erdos_renyi(*this,
                                generator,
                                model_number,
                                events.getInt("edges_number"),
                                events.getBoolean("allow-self-loops"));
    }
Esempio n. 9
0
        Seir(const vle::devs::DynamicsInit& model,
             const vle::devs::InitEventList& events) :
                 DifferentialEquation(model,events)
        {

            beta = events.getDouble("beta");// = 0.9
            gamma = events.getDouble("gamma"); //= 0.2
            sigma = events.getDouble("sigma"); // = 0.5
            nu  = events.getDouble("nu");// = 0.0

            S.init(this, "S", events);
            E.init(this, "E", events);
            I.init(this, "I", events);
            R.init(this, "R", events);

            n = S()+E()+I()+R();

        }
Esempio n. 10
0
        Im(const vle::devs::DynamicsInit& model,
           const vle::devs::InitEventList& events) :
               DifferentialEquation(model,events)
        {
            gamma = events.getDouble("gamma"); //= 0.2
            sigma = events.getDouble("sigma"); // = 0.5

            I.init(this, "I", events);
            E.init(this, "E", events);
        }
Esempio n. 11
0
File: Im.cpp Progetto: GG31/packages
        Im(const vle::devs::DynamicsInit& model,
           const vle::devs::InitEventList& events) :
            ved::DifferentialEquation(model,events)
        {
            gamma = events.getDouble("gamma"); //= 0.2
            sigma = events.getDouble("sigma"); // = 0.5

            I = createVar("I");
            E = createExt("E");
        }
Esempio n. 12
0
    void use_scalefree_graph_generator(const vle::devs::InitEventList& events)
    {
        vle::translator::graph_generator::parameter param{
            std::bind(&Builder::graph_generator_make_model,
                      this,
                      std::placeholders::_1,
                      std::placeholders::_2,
                      std::placeholders::_3),
            graph_generator_connectivity(),
            directed
        };

        vle::translator::graph_generator gg(param);

        gg.make_scalefree(*this,
                          generator,
                          model_number,
                          events.getDouble("alpha"),
                          events.getDouble("beta"),
                          events.getBoolean("allow-self-loops"));
    }
Esempio n. 13
0
File: Y.cpp Progetto: Chabrier/ibm2
    Y(
       const vd::DynamicsInit& init,
       const vd::InitEventList& events)
    : ve::DifferentialEquation(init, events)
    {
        X = createVar("X");
        maturing = createVar("maturing");
        masse = createVar("masse");


        if (events.exist("KS"))
            KS = events.getDouble("KS");
        else
            throw vle::utils::ModellingError("Parameter KS not found");

        if (events.exist("KG"))
            KG = events.getDouble("KG");
        else
            throw vle::utils::ModellingError("Parameter KG not found");

    }
Esempio n. 14
0
    ExBohachevsky(const vd::DynamicsInit& init, const vd::InitEventList& events) :
        vd::Dynamics(init,events)
    {
        x1 = events.getDouble("x1");
        x2 = events.getDouble("x2");

        my = pow(x1,2) + 2 * pow(x2,2) - 0.3 * cos(3 * M_PI * x1)
                - 0.4 * cos(4 * M_PI * x2) + 0.7;

        mrand.seed(events.getInt("seed"));
        double noise = mrand.normal(0,0.1);
        my_noise = my + noise;
    }
Esempio n. 15
0
    Smartgardener(
        const vd::DynamicsInit& init,
        const vd::InitEventList& evts)
        : vmd::Agent(init, evts),
          plantlouse_population(0),
          ladybird_population(0),
          treatment_effect_on_plantlouse(0),
          treatment_effect_on_ladybird(0),
          plantlouse_max_population(1000),
          ladybird_min_population(-1000)
    {
        treatment_effect_on_plantlouse =
                evts.getDouble("treatment_effect_on_plantlouse");
        treatment_effect_on_ladybird =
                evts.getDouble("treatment_effect_on_ladybird");
        plantlouse_max_population =
                evts.getDouble("plantlouse_max_population");
        ladybird_min_population =
                evts.getDouble("ladybird_min_population");

        addPredicates(this) +=
                P("TwoManyPlantlouse", &Smartgardener::TwoManyPlantlouse),
                P("NotToSmallLadybirdPopulation",
                        &Smartgardener::NotToSmallLadybirdPopulation);

        addFacts(this) +=
                F("x", &Smartgardener::x),
                F("y", &Smartgardener::y);

        addOutputFunctions(this) +=
                O("treat", &Smartgardener::treat);

        vle::utils::Package pack(context(), "vle.examples");
        std::string filePath = pack.getDataFile("Smartgardener.txt");
        std::ifstream fileStream(filePath.c_str());
        KnowledgeBase::plan().fill(fileStream);

    }
Esempio n. 16
0
File: M.cpp Progetto: GG31/ibm
    M(
       const vd::DynamicsInit& init,
       const vd::InitEventList& events)
    : ve::DifferentialEquation(init, events)
    {
        C3 = createVar("C3");
        C1 = createVar("C1");
        DSAT = createVar("DSAT");
        C2 = createVar("C2");


        if (events.exist("p1"))
            p1 = events.getDouble("p1");
        else
            throw vle::utils::ModellingError("Parameter p1 not found");

    }