本文整理汇总了C++中Population::form_riskGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ Population::form_riskGroup方法的具体用法?C++ Population::form_riskGroup怎么用?C++ Population::form_riskGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Population
的用法示例。
在下文中一共展示了Population::form_riskGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CODECHECK_partnerships
void CODECHECK_partnerships(Population &P)
{
// --- Formation: age
vector<double> age = vector_seq(9.0, 80.0, 200);
vector<double> fage(age.size());
for (int i=0; i<age.size(); i++) {
fage[i] = P.form_age(age[i]);
}
dcMatrix Mfage(age);
Mfage.addColVector(fage);
Mfage.WriteToFileCSV(_DIR_VIZINPUT + "viz_input_prtnr_form_age.out");
// --- Formation: age gap
vector<double> gap = vector_seq(-30, 50, 200);
vector<double> fagegap(gap.size());
for (int i=0; i<gap.size(); i++) {
fagegap[i] = P.form_ageGap(gap[i]);
}
dcMatrix Mgap(gap);
Mgap.addColVector(fagegap);
Mgap.WriteToFileCSV(_DIR_VIZINPUT + "viz_input_prtnr_form_agegap.out");
// --- Formation: risk group
int rmx = P.get_maxRiskGroup();
vector<double> r1;
vector<double> r2;
vector<double> frisk;
for (int i=0; i<=rmx; i++)
{
for (int j=0; j<=rmx; j++)
{
r1.push_back(i);
r2.push_back(j);
frisk.push_back(P.form_riskGroup(i, j));
}
}
dcMatrix Mfrisk(r1);
Mfrisk.addColVector(r2);
Mfrisk.addColVector(frisk);
Mfrisk.WriteToFileCSV(_DIR_VIZINPUT + "viz_input_prtnr_form_risk.out");
// --- Formation: deficit
vector<double> x1 = vector_seq(0.0, 1.0, 10);
vector<double> x2 = vector_seq(0.0, 1.0, 10);
vector<double> fdeficit;
vector<double> xx1;
vector<double> xx2;
for (int i=0; i<x1.size(); i++)
{
for (int j=0; j<x2.size(); j++)
{
xx1.push_back(x1[i]);
xx2.push_back(x2[j]);
fdeficit.push_back(P.form_deficit(x1[i], x2[j]));
}
}
dcMatrix Mfdeficit(xx1);
Mfdeficit.addColVector(xx2);
Mfdeficit.addColVector(fdeficit);
Mfdeficit.WriteToFileCSV(_DIR_VIZINPUT + "viz_input_prtnr_form_deficit.out");
// --- Spousal progress: age and age gap
vector<double> agef = vector_seq(10.0, 80.0, 50);
vector<double> agegap = vector_seq(-30, 50, 50);
vector<double> sp_age;
vector<double> agef_;
vector<double> agegap_;
for (int i=0; i<agef.size(); i++)
{
for (int j=0; j<agegap.size(); j++)
{
agef_.push_back(agef[i]);
agegap_.push_back(agegap[j]);
double s = expGauss(agef[i],P.get_spousalProgress_meanAge_f(), P.get_spousalProgress_varAge_f())
*expGauss(agegap_[j],P.get_spousalProgress_meanGap(), P.get_spousalProgress_varGap());
sp_age.push_back(s);
//.........这里部分代码省略.........