Пример #1
0
    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()));
            }
        }

    }
Пример #2
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);
        }
Пример #3
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");
        }
Пример #4
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");
        }
Пример #5
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"));
    }
Пример #6
0
    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");

    }
Пример #7
0
Файл: M.cpp Проект: 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");

    }
Пример #8
0
 XRay::XRay(const vd::DynamicsInit& init, const vd::InitEventList& events)
     : vd::Dynamics(init, events)
 {
   mProbabilityRightSR = vv::toDouble(events.get("probabilityRightSR"));
   mProbabilityRightI = vv::toDouble(events.get("probabilityRightI"));
   mObservationTimeStep =  vv::toDouble(events.get("timeStep"));
   if (events.exist("R_INIT") and 
       (vv::toBoolean(events.get("R_INIT")))) {
       mNbModel =vv::toInteger(events.get("graphInfo_number"));
       mPrefix =vv::toString(events.get("graphInfo_prefix"));
   } else {
       mNbModel = events.getMap("graphInfo").getInt("number");
       mPrefix = events.getMap("graphInfo").getString("prefix");
   }
   mSampleSize = /*boost::lexical_cast<int>*/ (vv::toDouble(events.get("echProp")) * mNbModel);
   //std::cout<<"smplesize= "<<mSampleSize<<"\n";
   mPrevalence=0.; mIncidence=0.;
     }
Пример #9
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());
    }