From 98c22e17cf4a37e5e2f307852c971c3e9075a807 Mon Sep 17 00:00:00 2001 From: wanotaitei Date: Thu, 31 Oct 2024 18:50:00 +0900 Subject: [PATCH] upd: simulation rename --- Data/Simulations/Settings.tsv | 18 +++---- .../PAX_SAPIENTICA/Simulation/Settlement.hpp | 52 ++++++++++--------- .../Simulation/SettlementAgent.hpp | 4 +- .../Simulation/SettlementGrid.hpp | 8 +-- .../Simulation/SettlementSimulator.hpp | 18 ++++--- .../Simulation/SimulationConst.hpp | 47 +++++++++-------- 6 files changed, 76 insertions(+), 71 deletions(-) diff --git a/Data/Simulations/Settings.tsv b/Data/Simulations/Settings.tsv index 1c8c91309..12c75510d 100644 --- a/Data/Simulations/Settings.tsv +++ b/Data/Simulations/Settings.tsv @@ -5,10 +5,10 @@ steps_per_year 12 1年あたりのStepの数(step/年) output_step_frequency 120 何Stepおきに出力するか?(step) immigration_start_steps 1801 渡来開始Step数目(step) immigration_end_steps 21600 渡来終了Step数目(step) -init_lifespan_min 180 初期化時の寿命までの最低Step間隔(step) +init_lifespan_grace_period 180 初期化時の寿命までの最低Step間隔(step) #Space -------------------- #空間 -------------------------------------------------- area honsyu シミュレーションの対象範囲 -grid_length 256 集落をグループ分けする際の1グリッド辺の長さ(cell) +cell_group_length 256 集落をグループ分けする際の1グリッド辺の長さ(cell) immigration_district_id 73 渡来地区ID land_key district 陸地データのKey district_key district 地区データのKey @@ -25,16 +25,16 @@ marriageable_age_all_weight 101.8 婚姻可能年齢重み #Childbirth -------------------- #出産 -------------------------------------------------- birth_interval 10 妊娠から出産までのStep間隔(step) hunter_gatherer_stillbirth_rate 0 狩猟採集死産率 (no effect) -farming_stillbirth_rate 0 水田稲作死産率 (no effect) +agricultural_stillbirth_rate 0 水田稲作死産率 (no effect) child_agriculture_priority 0.5 片親が農耕文化を持ち、もう一方の片親が農耕文化を持たない時の農耕文化継承の優先度 -birthable_age_min 15 出産の最小可能年齢(歳) -birthable_age_max 50 出産の最大可能年齢(歳) -birthable_age_constant 8.5 出産可能年齢定数 -birthable_age_threshold 16 出産可能年齢閾値 -birthable_age_all_weight 101.8 出産可能年齢重み +childbearing_age_min 15 出産の最小可能年齢(歳) +childbearing_age_max 50 出産の最大可能年齢(歳) +childbearing_age_constant 8.5 出産可能年齢定数 +childbearing_age_threshold 16 出産可能年齢閾値 +childbearing_age_all_weight 101.8 出産可能年齢重み #Movement -------------------- #移動 -------------------------------------------------- max_hunter_gatherer_settlement_population 25 狩猟採集集落の最大人数(人) -max_farming_settlement_population 80 水田稲作集落の最大人数(人) +max_agricultural_settlement_population 80 水田稲作集落の最大人数(人) min_move_distance 1 最小移動距離(cell) max_move_distance 1600 最大移動距離(cell) move_probability 0.01 移動確率 diff --git a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp index 13c572064..78862db43 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp @@ -413,8 +413,6 @@ namespace paxs { } // シミュレーションの設定で母方に移住するか父方に移住するかを決める - // 母方の場合 - // if (isMatrilocality()) { for (std::size_t i = 0; i < marriageable_agents_index_pair.size(); ++i) { std::pair index_pair = marriageable_agents_index_pair[i]; std::uint_least32_t male_id = male_settlement_pair[index_pair.second].first; @@ -434,6 +432,7 @@ namespace paxs { continue; } male_settlement_position = close_settlements[j]->getPosition(); + // 母方の場合 if (is_matrilocality) { Agent male_ = close_settlements[j]->getAgentCopy(male_id); Agent& female_ = agents[marriageable_female_index[index_pair.first]]; @@ -444,6 +443,7 @@ namespace paxs { male_.marry(female_id, female_.cgetGenome(), female_.cgetFarming(), female_.cgetHunterGatherer(), female_.cgetLanguage()); agents.emplace_back(male_); } + // 父方の場合 else { Agent& male_ = close_settlements[j]->getAgent(male_id); Agent female_ = agents[marriageable_female_index[index_pair.first]]; @@ -453,7 +453,7 @@ namespace paxs { male_.marry(female_id, female_.cgetGenome(), female_.cgetFarming(), female_.cgetHunterGatherer(), female_.cgetLanguage()); - male_settlement_position /= SimulationConstants::getInstance()->grid_length; + male_settlement_position /= SimulationConstants::getInstance()->cell_group_length; add_agent(female_, male_settlement_id, male_settlement_position); } is_found = true; @@ -467,7 +467,7 @@ namespace paxs { } if (is_matrilocality) { - male_settlement_position /= SimulationConstants::getInstance()->grid_length; + male_settlement_position /= SimulationConstants::getInstance()->cell_group_length; delete_agent(male_id, male_settlement_id, male_settlement_position); } else { @@ -485,7 +485,6 @@ namespace paxs { /// @brief 事前更新 void preUpdate(KanakumaLifeSpan& kanakuma_life_span) noexcept { birth(kanakuma_life_span); - //emigration(kanakuma_life_span); } /// @brief On update. @@ -631,8 +630,8 @@ namespace paxs { ++loop_count; } } - current_key = current_position / SimulationConstants::getInstance()->grid_length; - target_key = target_position / SimulationConstants::getInstance()->grid_length; + current_key = current_position / SimulationConstants::getInstance()->cell_group_length; + target_key = target_position / SimulationConstants::getInstance()->cell_group_length; if (current_key == target_key) return { 0, Vector2(), Vector2() }; @@ -652,15 +651,14 @@ namespace paxs { /// @brief Get the weight population. /// @brief 重み人口を取得 double getPopulationWeight() const noexcept { - double population_weight = 0; + // 農耕文化の重み + const double ac_weight = SimulationConstants::getInstance()->max_agricultural_settlement_weight; + // 狩猟採集文化の重み + const double hg_weight = SimulationConstants::getInstance()->max_hunter_gatherer_settlement_weight; + double population_weight = 0; for (std::size_t i = 0; i < agents.size(); ++i) { - if (agents[i].cgetFarming() > 0) { // 農耕 - population_weight += SimulationConstants::getInstance()->max_farming_settlement_weight; - } - else { // 狩猟採集 - population_weight += SimulationConstants::getInstance()->max_hunter_gatherer_settlement_weight; - } + population_weight += (agents[i].cgetFarming() > 0) ? ac_weight : hg_weight; } return population_weight; } @@ -789,7 +787,7 @@ namespace paxs { if (count == 0) { // 生業文化別の死産率を格納 const double stillbirth_rate = (agent.cgetFarming() > 0) ? - SimulationConstants::getInstance()->farming_stillbirth_rate : + SimulationConstants::getInstance()->agricultural_stillbirth_rate : SimulationConstants::getInstance()->hunter_gatherer_stillbirth_rate; // 死産率 100 %の場合は出産しない @@ -798,21 +796,25 @@ namespace paxs { // 死産 if (SimulationConstants::getInstance()->random_dist_f32(*gen) < stillbirth_rate) continue; } - // TODO: 直す - //if (!agent.isMarried()) continue; - std::uint_least8_t farming = (agent.cgetFarming() > 0 && agent.cgetPartnerFarming() > 0) ? 255 : ( - (agent.cgetFarming() == 0 && agent.cgetPartnerFarming() == 0) ? 0 : ( - (SimulationConstants::getInstance()->random_dist_f32(*gen) < SimulationConstants::getInstance()->child_agriculture_priority) ? 255 : 0 + const std::uint_least8_t farming = + // 両親が農耕文化であれば両親の半分の値を引き継ぐ + (agent.cgetFarming() > 0 && agent.cgetPartnerFarming() > 0) ? + static_cast((int(agent.cgetFarming()) + int(agent.cgetPartnerFarming())) / 2) + // 両親が共に農耕文化を持たない場合は 0 + : ((agent.cgetFarming() == 0 && agent.cgetPartnerFarming() == 0) ? 0 + // 片親が農耕文化を持つ場合は乱数 + : ((SimulationConstants::getInstance()->random_dist_f32(*gen) < SimulationConstants::getInstance()->child_agriculture_priority) ? + // 農耕文化を持つ親から値を引き継ぐ + ((agent.cgetFarming() == 0) ? agent.cgetPartnerFarming() : agent.cgetFarming()) : + 0 )); - Genome genome = Genome::generateFromParents(*gen, agent.cgetGenome(), agent.cgetPartnerGenome()); + const Genome genome = Genome::generateFromParents(*gen, agent.cgetGenome(), agent.cgetPartnerGenome()); children.emplace_back(Agent( UniqueIdentification::generate(), - //0, // TODO: 名前ID 0, kanakuma_life_span.setLifeSpan(farming > 0, genome.isMale(), *gen), genome, farming, - //(((*gen)() % 2) == 0) ? agent.cgetFarming() : agent.cgetPartnerFarming(), (((*gen)() % 2) == 0) ? agent.cgetHunterGatherer() : agent.cgetPartnerHunterGatherer(), (((*gen)() % 2) == 0) ? agent.cgetLanguage() : agent.cgetPartnerLanguage() )); @@ -910,12 +912,12 @@ namespace paxs { /// @brief Is able to give birth? /// @brief 確率で出産するかどうかを返す bool isAbleToGiveBirth(const double age) noexcept { - auto x = [](double age) { return (age - SimulationConstants::getInstance()->pregnant_age_min_f64) / SimulationConstants::getInstance()->birthable_age_constant; }; + auto x = [](double age) { return (age - SimulationConstants::getInstance()->pregnant_age_min_f64) / SimulationConstants::getInstance()->childbearing_age_constant; }; auto weight = [=](double age) { return std::exp(-std::pow(std::log(x(age)), 2.0) / settlement::sigma_p_2_x_2) / (x(age) * settlement::sigma_x_sqrt_2_x_pi); }; - const double threshold = static_cast(weight(age)) * (SimulationConstants::getInstance()->birthable_age_threshold / SimulationConstants::getInstance()->birthable_age_all_weight); // (16 / 101.8); + const double threshold = static_cast(weight(age)) * (SimulationConstants::getInstance()->childbearing_age_threshold / SimulationConstants::getInstance()->childbearing_age_all_weight); // (16 / 101.8); return SimulationConstants::getInstance()->random_dist(*gen) < threshold; } diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementAgent.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementAgent.hpp index e6a43261d..a332b6547 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementAgent.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementAgent.hpp @@ -144,8 +144,8 @@ namespace paxs { /// @brief 出産可能かどうか bool isAbleToGiveBirth() const noexcept { const float age_f = static_cast(age) / SimulationConstants::getInstance()->steps_per_year; - return age_f > SimulationConstants::getInstance()->birthable_age_min - && age_f < SimulationConstants::getInstance()->birthable_age_max && is_married; + return age_f > SimulationConstants::getInstance()->childbearing_age_min + && age_f < SimulationConstants::getInstance()->childbearing_age_max && is_married; } /// @brief Get the partner's ID. diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp index 51d50b49d..f5048f9e6 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp @@ -56,11 +56,11 @@ namespace paxs { #endif // ランダムな位置を探す - std::uniform_int_distribution<> dis_x(grid_position.x, grid_position.x + paxs::SimulationConstants::getInstance()->grid_length - 1); - std::uniform_int_distribution<> dis_y(grid_position.y, grid_position.y + paxs::SimulationConstants::getInstance()->grid_length - 1); + std::uniform_int_distribution<> dis_x(grid_position.x, grid_position.x + paxs::SimulationConstants::getInstance()->cell_group_length - 1); + std::uniform_int_distribution<> dis_y(grid_position.y, grid_position.y + paxs::SimulationConstants::getInstance()->cell_group_length - 1); Vector2 position; - while (black_list.size() < SimulationConstants::getInstance()->grid_length * SimulationConstants::getInstance()->grid_length) { + while (black_list.size() < SimulationConstants::getInstance()->cell_group_length * SimulationConstants::getInstance()->cell_group_length) { position.x = dis_x(*gen); position.y = dis_y(*gen); if (std::find(black_list.begin(), black_list.end(), position) == black_list.end()) { @@ -75,7 +75,7 @@ namespace paxs { } // 集落を移動 - if (black_list.size() == SimulationConstants::getInstance()->grid_length * SimulationConstants::getInstance()->grid_length) { + if (black_list.size() == SimulationConstants::getInstance()->cell_group_length * SimulationConstants::getInstance()->cell_group_length) { // 居住可能な場所がない PAXS_WARNING("No place to live."); } diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp index af95f88d8..cc307d94a 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp @@ -183,7 +183,7 @@ namespace paxs { } else { // 登録されていない場合は新しく地域を作成 - SettlementGrid settlement_grid = SettlementGrid(target_key * SimulationConstants::getInstance()->grid_length, environment, gen); + SettlementGrid settlement_grid = SettlementGrid(target_key * SimulationConstants::getInstance()->cell_group_length, environment, gen); settlement_grid.moveSettlementToThis(settlement_grids[current_index].getSettlement(id)); settlement_grids[target_index] = settlement_grid; } @@ -315,7 +315,7 @@ namespace paxs { // 近隣8グリッドの集落を取得 std::vector close_settlements; Vector2 grid_position = settlement_grid.second.getGridPosition(); - grid_position /= SimulationConstants::getInstance()->grid_length; + grid_position /= SimulationConstants::getInstance()->cell_group_length; for (int i = -1; i <= 1; ++i) { for (int j = -1; j <= 1; ++j) { auto it = settlement_grids.find((grid_position + Vector2(i, j)).to(SettlementGridsType{})); @@ -542,11 +542,11 @@ namespace paxs { settlement_population = (std::min)(settlement_population, static_cast(district_population_it->second)); // 集落をグリッドに配置 - Vector2 grid_position = live_position / SimulationConstants::getInstance()->grid_length; + Vector2 grid_position = live_position / SimulationConstants::getInstance()->cell_group_length; SettlementGridsType key = grid_position.to(SettlementGridsType{}); // グリッドが存在しない場合は作成 if (settlement_grids.find(key) == settlement_grids.end()) { - settlement_grids[key] = SettlementGrid(grid_position * SimulationConstants::getInstance()->grid_length, environment, gen); + settlement_grids[key] = SettlementGrid(grid_position * SimulationConstants::getInstance()->cell_group_length, environment, gen); } // 集落を作成 Settlement settlement = Settlement( @@ -564,8 +564,9 @@ namespace paxs { const AgeType set_lifespan = kanakuma_life_span.setLifeSpan((is_farming), genome.isMale(), gen); AgeType age_value = 0; - if (set_lifespan > SimulationConstants::getInstance()->init_lifespan_min) { - std::uniform_int_distribution<> lifespan_dist{ 0, static_cast(set_lifespan - SimulationConstants::getInstance()->init_lifespan_min) }; // 寿命の乱数分布 + if (set_lifespan > SimulationConstants::getInstance()->init_lifespan_grace_period) { + // 寿命の乱数分布 + std::uniform_int_distribution<> lifespan_dist{ 0, static_cast(set_lifespan - SimulationConstants::getInstance()->init_lifespan_grace_period) }; age_value = static_cast(lifespan_dist(gen)); } @@ -626,8 +627,9 @@ namespace paxs { const AgeType set_lifespan = kanakuma_life_span.setLifeSpan(is_farming, genome.isMale(), gen); AgeType age_value = 0; - if (set_lifespan > SimulationConstants::getInstance()->init_lifespan_min) { - std::uniform_int_distribution<> lifespan_dist{ 0, static_cast(set_lifespan - SimulationConstants::getInstance()->init_lifespan_min) }; // 寿命の乱数分布 + if (set_lifespan > SimulationConstants::getInstance()->init_lifespan_grace_period) { + // 寿命の乱数分布 + std::uniform_int_distribution<> lifespan_dist{ 0, static_cast(set_lifespan - SimulationConstants::getInstance()->init_lifespan_grace_period) }; age_value = static_cast(lifespan_dist(gen)); } diff --git a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp index d6506cded..d02b0ec87 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp @@ -89,28 +89,28 @@ namespace paxs { std::uint_least32_t female_marriageable_age_max = 60; std::uint_least32_t male_marriageable_age_max = 70; // 出産可能:15歳以上50歳未満 - std::uint_least32_t birthable_age_min = 15; - double birthable_age_min_f64 = 15.0; - std::uint_least32_t birthable_age_max = 50; + std::uint_least32_t childbearing_age_min = 15; + double childbearing_age_min_f64 = 15.0; + std::uint_least32_t childbearing_age_max = 50; // 出産の間隔:10ヶ月 std::uint_least8_t birth_interval = 10; // 妊娠可能 - double pregnant_age_min_f64 = birthable_age_min_f64 - static_cast(birth_interval) / static_cast(steps_per_year); + double pregnant_age_min_f64 = childbearing_age_min_f64 - static_cast(birth_interval) / static_cast(steps_per_year); // 婚姻可能年齢定数 double marriageable_age_constant = 8.5; double marriageable_age_threshold = 0.98; double marriageable_age_all_weight = 101.8; // 出産可能年齢定数 - double birthable_age_constant = 8.5; - double birthable_age_threshold = 16.0; - double birthable_age_all_weight = 101.8; + double childbearing_age_constant = 8.5; + double childbearing_age_threshold = 16.0; + double childbearing_age_all_weight = 101.8; // 結婚時に近くの集落からエージェントを探す際の探索範囲 std::uint_least32_t marriage_search_range = 60; std::uint_least32_t marriage_search_range_pow2 = marriage_search_range * marriage_search_range; // 集落をグループ分けする際の1グリッド辺の長さ - std::uint_least32_t grid_length = 64; + std::uint_least32_t cell_group_length = 64; // 渡来開始ステップ数 std::uint_least64_t immigration_start_steps = 2401; @@ -120,10 +120,10 @@ namespace paxs { std::uint_least8_t immigration_district_id = 73; // 初期化時の寿命までの最低年数 - AgeType init_lifespan_min = 180; + AgeType init_lifespan_grace_period = 180; // 農耕集落の最大人数 - double max_farming_settlement_weight = 1.0 / 80.0; + double max_agricultural_settlement_weight = 1.0 / 80.0; // 狩猟採集集落の最大人数 double max_hunter_gatherer_settlement_weight = 1.0 / 25.0; @@ -145,9 +145,10 @@ namespace paxs { // 片親が農耕文化を持ち、もう一方の片親が農耕文化を持たない時の農耕文化継承の優先度 double child_agriculture_priority = 0.7; - // 死産率 + // 狩猟採集文化の死産率 double hunter_gatherer_stillbirth_rate = 0.1; - double farming_stillbirth_rate = 0.1; + // 農耕文化の死産率 + double agricultural_stillbirth_rate = 0.1; // 母方居住婚の確率 double maternal_residence_probability = 0.5; @@ -223,9 +224,9 @@ namespace paxs { stoiFunc(kvt, MurMur3::calcHash("male_marriageable_age_min"), [&](const std::string& str_) {male_marriageable_age_min = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("female_marriageable_age_max"), [&](const std::string& str_) {female_marriageable_age_max = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("male_marriageable_age_max"), [&](const std::string& str_) {male_marriageable_age_max = static_cast(std::stoul(str_)); }); - stoiFunc(kvt, MurMur3::calcHash("birthable_age_min"), [&](const std::string& str_) {birthable_age_min = static_cast(std::stoul(str_)); }); - birthable_age_min_f64 = static_cast(birthable_age_min); - stoiFunc(kvt, MurMur3::calcHash("birthable_age_max"), [&](const std::string& str_) {birthable_age_max = static_cast(std::stoul(str_)); }); + stoiFunc(kvt, MurMur3::calcHash("childbearing_age_min"), [&](const std::string& str_) {childbearing_age_min = static_cast(std::stoul(str_)); }); + childbearing_age_min_f64 = static_cast(childbearing_age_min); + stoiFunc(kvt, MurMur3::calcHash("childbearing_age_max"), [&](const std::string& str_) {childbearing_age_max = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("birth_interval"), [&](const std::string& str_) {birth_interval = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("marriage_search_range"), [&](const std::string& str_) {marriage_search_range = static_cast(std::stoul(str_)); }); @@ -234,16 +235,16 @@ namespace paxs { stoiFunc(kvt, MurMur3::calcHash("marriageable_age_constant"), [&](const std::string& str_) {marriageable_age_constant = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("marriageable_age_threshold"), [&](const std::string& str_) {marriageable_age_threshold = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("marriageable_age_all_weight"), [&](const std::string& str_) {marriageable_age_all_weight = std::stod(str_); }); - stoiFunc(kvt, MurMur3::calcHash("birthable_age_constant"), [&](const std::string& str_) {birthable_age_constant = std::stod(str_); }); - stoiFunc(kvt, MurMur3::calcHash("birthable_age_threshold"), [&](const std::string& str_) {birthable_age_threshold = std::stod(str_); }); - stoiFunc(kvt, MurMur3::calcHash("birthable_age_all_weight"), [&](const std::string& str_) {birthable_age_all_weight = std::stod(str_); }); + stoiFunc(kvt, MurMur3::calcHash("childbearing_age_constant"), [&](const std::string& str_) {childbearing_age_constant = std::stod(str_); }); + stoiFunc(kvt, MurMur3::calcHash("childbearing_age_threshold"), [&](const std::string& str_) {childbearing_age_threshold = std::stod(str_); }); + stoiFunc(kvt, MurMur3::calcHash("childbearing_age_all_weight"), [&](const std::string& str_) {childbearing_age_all_weight = std::stod(str_); }); - stoiFunc(kvt, MurMur3::calcHash("grid_length"), [&](const std::string& str_) {grid_length = static_cast(std::stoul(str_)); }); + stoiFunc(kvt, MurMur3::calcHash("cell_group_length"), [&](const std::string& str_) {cell_group_length = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("immigration_start_steps"), [&](const std::string& str_) {immigration_start_steps = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("immigration_end_steps"), [&](const std::string& str_) {immigration_end_steps = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("immigration_district_id"), [&](const std::string& str_) {immigration_district_id = static_cast(std::stoul(str_)); }); - stoiFunc(kvt, MurMur3::calcHash("init_lifespan_min"), [&](const std::string& str_) {init_lifespan_min = static_cast(std::stoul(str_)); }); - stoiFunc(kvt, MurMur3::calcHash("max_farming_settlement_population"), [&](const std::string& str_) {max_farming_settlement_weight = 1.0 / static_cast(std::stoul(str_)); }); + stoiFunc(kvt, MurMur3::calcHash("init_lifespan_grace_period"), [&](const std::string& str_) {init_lifespan_grace_period = static_cast(std::stoul(str_)); }); + stoiFunc(kvt, MurMur3::calcHash("max_agricultural_settlement_population"), [&](const std::string& str_) {max_agricultural_settlement_weight = 1.0 / static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("max_hunter_gatherer_settlement_population"), [&](const std::string& str_) {max_hunter_gatherer_settlement_weight = 1.0 / static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("min_move_distance"), [&](const std::string& str_) {min_move_distance = static_cast(std::stoul(str_)); }); stoiFunc(kvt, MurMur3::calcHash("max_move_distance"), [&](const std::string& str_) {max_move_distance = static_cast(std::stoul(str_)); }); @@ -256,14 +257,14 @@ namespace paxs { stoiFunc(kvt, MurMur3::calcHash("move_probability"), [&](const std::string& str_) {move_probability = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("child_agriculture_priority"), [&](const std::string& str_) {child_agriculture_priority = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("hunter_gatherer_stillbirth_rate"), [&](const std::string& str_) {hunter_gatherer_stillbirth_rate = std::stod(str_); }); - stoiFunc(kvt, MurMur3::calcHash("farming_stillbirth_rate"), [&](const std::string& str_) {farming_stillbirth_rate = std::stod(str_); }); + stoiFunc(kvt, MurMur3::calcHash("agricultural_stillbirth_rate"), [&](const std::string& str_) {agricultural_stillbirth_rate = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("maternal_residence_probability"), [&](const std::string& str_) {maternal_residence_probability = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("coast_cost"), [&](const std::string& str_) {coast_cost = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("ocean_cost"), [&](const std::string& str_) {ocean_cost = std::stod(str_); }); stoiFunc(kvt, MurMur3::calcHash("land_cost"), [&](const std::string& str_) {land_cost = std::stod(str_); }); - pregnant_age_min_f64 = birthable_age_min_f64 - static_cast(birth_interval) / static_cast(steps_per_year); + pregnant_age_min_f64 = childbearing_age_min_f64 - static_cast(birth_interval) / static_cast(steps_per_year); } };