本文整理汇总了C++中vle::devs::InitEventList类的典型用法代码示例。如果您正苦于以下问题:C++ InitEventList类的具体用法?C++ InitEventList怎么用?C++ InitEventList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InitEventList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: use_erdosrenyi_graph_generator
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"));
}
示例2: use_1d_regular_graph_generator
void use_1d_regular_graph_generator(const vle::devs::InitEventList& events)
{
vle::translator::regular_graph_generator::parameter param{
std::bind(&Builder::regular_graph_generator_make_model,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3),
regular_graph_generator_connectivity()
};
vle::translator::regular_graph_generator rgg(param);
const auto& v = events.getSet("mask").value();
std::vector<std::string> mask;
std::transform(v.begin(),
v.end(),
std::back_inserter(mask),
[](const auto& v) { return v->toString().value(); });
rgg.make_1d(*this,
events.getInt("lenght"),
events.getBoolean("graph-wrap"),
mask,
events.getInt("x-mask"));
}
示例3: ModellingError
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()));
}
}
}
示例4: ModellingError
Generator(const vd::DynamicsInit& init, const vd::InitEventList& events)
: vd::Dynamics(init, events)
{
vg::ConnectionList my_list;
// m_duration = vv::toDouble(events.get("duration"));
m_duration = 0.1;
if (events.end() != events.find("source_init_level")) {
m_val = vv::toDouble(events.get("source_init_level"));
} else {
m_val = 1;
Trace(6,
"Warning : Model %s got no init"
" output level (source_init_level) : assuming 1\n",
getModelName().c_str());
}
if (events.end() != events.find("source_trend")) {
m_trend = vv::toDouble(events.get("source_trend"));
if (events.end() != events.find("source_quantum")) {
m_quantum = vv::toDouble(events.get("source_quantum"));
} else {
m_quantum = 0.01;
Trace(6,
"Warning : Model %s got no output"
" quantum (source_quantum) : assuming 0.01\n",
getModelName().c_str());
}
} else {
m_trend = 0;
Trace(6,
"%s got no output trend (source_trend)"
" : assuming 0\n",
getModelName().c_str());
// no trend => quantum is useless but..
m_quantum = 0.01;
}
if (0 == m_quantum) {
throw vu::ModellingError("Model %s has null output quantum.",
getModelName().c_str());
}
m_has_output_port = false;
my_list = getModel().getOutputPortList();
if (my_list.size() > 0) {
m_output_port_label = (my_list.begin())->first;
m_has_output_port = true;
}
if (my_list.size() > 1) {
Trace(6,
"Warning: multiple output ports."
" Will use only port %s\n",
m_output_port_label.c_str());
}
}
示例5: Rm
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);
}
示例6: LotkaVolterraY
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);
}
示例7: LotkaVolterraY
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");
}
示例8: Sm
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");
}
示例9: ExBohachevsky
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;
}
示例10: use_defined_graph_generator
void use_defined_graph_generator(const vle::devs::InitEventList& events)
{
vle::utils::Array<bool> userdefined(model_number, model_number);
{
const auto& v = events.getTuple("user-defined");
if (v.size() != vle::utils::numeric_cast<std::size_t>(
model_number * model_number))
throw vle::utils::ModellingError(
"User defined model size error");
int pos = 0;
for (int i = 0; i != model_number; ++i)
for (int j = 0; j != model_number; ++j, ++pos)
userdefined(i, j) = (v.get(pos) != 0.0);
}
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_graph(*this, model_number, userdefined);
}
示例11: M
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");
}
示例12: Seir
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();
}
示例13:
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.;
}
示例14: Im
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");
}
示例15: Im
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);
}