diff --git a/Data/Simulations/Settings.tsv b/Data/Simulations/Settings.tsv index 9722c4ad5..7a93e7c3f 100644 --- a/Data/Simulations/Settings.tsv +++ b/Data/Simulations/Settings.tsv @@ -16,12 +16,14 @@ birthable_age_min 15 出産の最小可能年齢(歳) birthable_age_max 50 出産の最大可能年齢(歳) #Childbirth -------------------- #出産 -------------------------------------------------- birth_interval 10 出産の間隔:10ヶ月(Step) -stillbirth_rate 0.16 死産率 +hunter_gatherer_stillbirth_rate 0.18 狩猟採集死産率 +farming_stillbirth_rate 0.16 水田稲作死産率 child_agriculture_priority 0.7 片親が農耕文化を持ち、もう一方の片親が農耕文化を持たない時の農耕文化継承の優先度 #Movement -------------------- #移動 -------------------------------------------------- -max_settlement_population 80 集落の最大人数(人) +max_hunter_gatherer_settlement_population 25 狩猟採集集落の最大人数(人) +max_farming_settlement_population 80 水田稲作集落の最大人数(人) min_move_distance 10 最小移動距離 max_move_distance 800 最大移動距離 min_move_probability 1 移動確率下限 -max_move_probability 10 移動確率上限 +max_move_probability 1 移動確率上限 move_probability_normalization_coefficient 1000 移動確率の正規化係数 diff --git a/Library/PAX_MAHOROBA/LocationPoint.hpp b/Library/PAX_MAHOROBA/LocationPoint.hpp index 44fc7fcf2..091921744 100644 --- a/Library/PAX_MAHOROBA/LocationPoint.hpp +++ b/Library/PAX_MAHOROBA/LocationPoint.hpp @@ -678,8 +678,8 @@ namespace paxs { // if (lli.lpe == MurMur3::calcHash("agent1")) { // const std::size_t pop_original = settlement.getFarmingPopulation(); // settlement.getPopulation(); - //const float pop_original = settlement.getFarmingPopulation() / float(settlement.getPopulation()) * 75.0f; // settlement.getPopulation(); - const float pop_original = settlement.getMostMtDNA() / 27.0f * 75.0f; // settlement.getPopulation(); + const float pop_original = settlement.getFarmingPopulation() / float(settlement.getPopulation()) * 75.0f; // settlement.getPopulation(); + //const float pop_original = settlement.getMostMtDNA() / 27.0f * 75.0f; // settlement.getPopulation(); const std::uint_least8_t pop = (pop_original >= 75) ? 75 : static_cast(pop_original); paxg::Circle(draw_pos, diff --git a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp index 1723f2e37..d856d01f3 100644 --- a/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/Settlement.hpp @@ -236,7 +236,7 @@ namespace paxs { } // 選択居住婚 else { - is_matrilocality = random_dist(*gen); + is_matrilocality = (SimulationConstants::getInstance()->maternal_residence_probability >= random_dist(*gen)); } // シミュレーションの設定で母方に移住するか父方に移住するかを決める @@ -367,6 +367,22 @@ namespace paxs { /// @brief 人口を取得 std::size_t getPopulation() const noexcept { return agents.size(); } + /// @brief Get the weight population. + /// @brief 重み人口を取得 + double getPopulationWeight() const noexcept { + 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; + } + } + return population_weight; + } + /// @brief Get the population. /// @brief 渡来人口を取得 std::size_t getFarmingPopulation() const noexcept { @@ -455,11 +471,16 @@ namespace paxs { if (agent.getBirthIntervalCount() > 0) { std::uint_least8_t count = agent.decrementBirthIntervalCount(); if (count == 0) { + // 生業文化別の死産率を格納 + const float stillbirth_rate = (agent.cgetFarming() > 0) ? + SimulationConstants::getInstance()->farming_stillbirth_rate : + SimulationConstants::getInstance()->hunter_gatherer_stillbirth_rate; + // 死産率 100 %の場合は出産しない - if (SimulationConstants::getInstance()->stillbirth_rate >= 1.0f) continue; - else if (SimulationConstants::getInstance()->stillbirth_rate > 0.0f) { + if (stillbirth_rate >= 1.0f) continue; + else if (stillbirth_rate > 0.0f) { // 死産 - if (random_dist(*gen) < SimulationConstants::getInstance()->stillbirth_rate) continue; + if (random_dist(*gen) < stillbirth_rate) continue; } // TODO: 直す //if (!agent.isMarried()) continue; diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp index cefb315da..51d50b49d 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementGrid.hpp @@ -177,7 +177,7 @@ namespace paxs { void divideSettlements() noexcept { // 人口が最大人口を超えている集落を複数探し、分割する for (auto& settlement : settlements) { - if (settlement.getPopulation() > SimulationConstants::getInstance()->max_settlement_population) { + if (settlement.getPopulationWeight() >= 1.0) { // 分割 Settlement divided_settlement = settlement.divide(); moveSettlementToThis(divided_settlement); diff --git a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp index 3b7176437..c5a76726f 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SettlementSimulator.hpp @@ -190,8 +190,10 @@ namespace paxs { settlement.preUpdate(kanakuma_life_span, emigration_count); } } - - randomizeSettlements(1, 255, 0); + // 前901年から稲作文化開始 + if (step_count > SimulationConstants::getInstance()->steps_per_year * 200) { + randomizeSettlements(1, 255, 0); + } m_start_time = std::chrono::system_clock::now(); // 婚姻計測開始 diff --git a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp index 754f67a23..cc44895fc 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp @@ -73,8 +73,10 @@ namespace paxs { // 集落をグループ分けする際の1グリッド辺の長さ std::uint_least32_t grid_length = 64; - // 集落の最大人数 - std::uint_least8_t max_settlement_population = 80; + // 農耕集落の最大人数 + double max_farming_settlement_weight = 1.0 / 80.0; + // 狩猟採集集落の最大人数 + double max_hunter_gatherer_settlement_weight = 1.0 / 25.0; // 最小移動距離 std::uint_least32_t min_move_distance = 10; @@ -91,7 +93,8 @@ namespace paxs { float child_agriculture_priority = 0.7f; // 死産率 - float stillbirth_rate = 0.1f; + float hunter_gatherer_stillbirth_rate = 0.1f; + float farming_stillbirth_rate = 0.1f; // 母方居住婚の確率 float maternal_residence_probability = 0.5f; @@ -148,7 +151,8 @@ namespace paxs { 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_)); }); stoiFunc(kvt, MurMur3::calcHash("grid_length"), [&](const std::string& str_) {grid_length = static_cast(std::stoul(str_)); }); - stoiFunc(kvt, MurMur3::calcHash("max_settlement_population"), [&](const std::string& str_) {max_settlement_population = 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("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_)); }); @@ -156,7 +160,8 @@ namespace paxs { stoiFunc(kvt, MurMur3::calcHash("max_move_probability"), [&](const std::string& str_) {max_move_probability = std::stoi(str_); }); stoiFunc(kvt, MurMur3::calcHash("move_probability_normalization_coefficient"), [&](const std::string& str_) {move_probability_normalization_coefficient = std::stoi(str_); }); stoiFunc(kvt, MurMur3::calcHash("child_agriculture_priority"), [&](const std::string& str_) {child_agriculture_priority = std::stof(str_); }); - stoiFunc(kvt, MurMur3::calcHash("stillbirth_rate"), [&](const std::string& str_) {stillbirth_rate = std::stof(str_); }); + stoiFunc(kvt, MurMur3::calcHash("hunter_gatherer_stillbirth_rate"), [&](const std::string& str_) {hunter_gatherer_stillbirth_rate = std::stof(str_); }); + stoiFunc(kvt, MurMur3::calcHash("farming_stillbirth_rate"), [&](const std::string& str_) {farming_stillbirth_rate = std::stof(str_); }); stoiFunc(kvt, MurMur3::calcHash("maternal_residence_probability"), [&](const std::string& str_) {maternal_residence_probability = std::stof(str_); }); }