diff --git a/Data/Simulations/Sample/LifeSpanImazu2022.tsv b/Data/Simulations/Sample/LifeSpanImazu2022.tsv new file mode 100644 index 000000000..4fa2c82dc --- /dev/null +++ b/Data/Simulations/Sample/LifeSpanImazu2022.tsv @@ -0,0 +1,102 @@ +age hunter_gatherer_male_ndx hunter_gatherer_female_ndx agricultural_male_ndx agricultural_female_ndx +0 30 30 25 25 +1 1.771 1.771 1.8975 1.8975 +2 1.7466624 1.7466624 1.871424 1.871424 +3 1.71524431 1.71524431 1.837761761 1.837761761 +4 1.690421135 1.690421135 1.811165502 1.811165502 +5 1.658916478 1.658916478 1.777410512 1.777410512 +6 1.633712301 1.633712301 1.750406037 1.750406037 +7 1.602212362 1.602212362 1.716656103 1.716656103 +8 1.57672762 1.57672762 1.689351022 1.689351022 +9 1.550979833 1.550979833 1.661764107 1.661764107 +10 1.524999223 1.524999223 1.633927739 1.633927739 +11 1.493462569 1.493462569 1.600138467 1.600138467 +12 1.467405662 1.467405662 1.572220352 1.572220352 +13 1.441195299 1.441195299 1.54413782 1.54413782 +14 1.419772057 1.419772057 1.521184347 1.521184347 +15 1.393052832 1.393052832 1.492556605 1.492556605 +16 1.36626996 1.36626996 1.463860671 1.463860671 +17 1.339449386 1.339449386 1.435124342 1.435124342 +18 1.316977201 1.316977201 1.411047001 1.411047001 +19 1.289891951 1.289891951 1.38202709 1.38202709 +20 1.266950905 1.266950905 1.357447399 1.357447399 +21 1.239722531 1.239722531 1.328274141 1.328274141 +22 1.216441178 1.216441178 1.303329834 1.303329834 +23 1.19291305 1.19291305 1.278121125 1.278121125 +24 1.16917408 1.16917408 1.252686514 1.252686514 +25 1.145259418 1.145259418 1.227063662 1.227063662 +26 1.121203384 1.121203384 1.20128934 1.20128934 +27 1.100304423 1.100304423 1.178897596 1.178897596 +28 1.075844035 1.075844035 1.152690038 1.152690038 +29 1.054394671 1.054394671 1.129708576 1.129708576 +30 1.029680391 1.029680391 1.103228991 1.103228991 +31 1.007836457 1.007836457 1.079824775 1.079824775 +32 0.9857492243 0.9857492243 1.056159883 1.056159883 +33 0.9634603391 0.9634603391 1.032278935 1.032278935 +34 0.9435536647 0.9435536647 1.010950355 1.010950355 +35 0.9207924036 0.9207924036 0.9865632896 0.9865632896 +36 0.9003116296 0.9003116296 0.9646196031 0.9646196031 +37 0.8795205587 0.8795205587 0.9423434558 0.9423434558 +38 0.8584682821 0.8584682821 0.9197874451 0.9197874451 +39 0.8372026719 0.8372026719 0.8970028627 0.8970028627 +40 0.8157702835 0.8157702835 0.8740395894 0.8740395894 +41 0.7961439756 0.7961439756 0.8530114025 0.8530114025 +42 0.7761998943 0.7761998943 0.8316427439 0.8316427439 +43 0.7577632988 0.7577632988 0.8118892487 0.8118892487 +44 0.7371939202 0.7371939202 0.7898506288 0.7898506288 +45 0.7180938189 0.7180938189 0.7693862345 0.7693862345 +46 0.6986756219 0.6986756219 0.7485810234 0.7485810234 +47 0.6804790723 0.6804790723 0.7290847203 0.7290847203 +48 0.6618783248 0.6618783248 0.709155348 0.709155348 +49 0.6429418307 0.6429418307 0.6888662472 0.6888662472 +50 0.6250169353 0.6250169353 0.6696610021 0.6696610021 +51 0.5920795674 0.5920795674 0.6343709651 0.6343709651 +52 0.5737360652 0.5737360652 0.6147172128 0.6147172128 +53 0.5563530215 0.5563530215 0.5960925231 0.5960925231 +54 0.5387177324 0.5387177324 0.5771975705 0.5771975705 +55 0.52089559 0.52089559 0.5581024178 0.5581024178 +56 0.5038895892 0.5038895892 0.5398817027 0.5398817027 +57 0.4866678464 0.4866678464 0.5214298354 0.5214298354 +58 0.4701395564 0.4701395564 0.5037209533 0.5037209533 +59 0.4533870291 0.4533870291 0.4857718168 0.4857718168 +60 0.4372315232 0.4372315232 0.4684623463 0.4684623463 +61 0.4215666557 0.4215666557 0.4516785597 0.4516785597 +62 0.4056362299 0.4056362299 0.4346102463 0.4346102463 +63 0.3901449027 0.3901449027 0.4180123958 0.4180123958 +64 0.3744312101 0.3744312101 0.4011762965 0.4011762965 +65 0.3596710384 0.3596710384 0.3853618269 0.3853618269 +66 0.3446355883 0.3446355883 0.3692524161 0.3692524161 +67 0.3298945658 0.3298945658 0.3534584633 0.3534584633 +68 0.3154047788 0.3154047788 0.3379336916 0.3379336916 +69 0.3007220449 0.3007220449 0.322202191 0.322202191 +70 0.2867049467 0.2867049467 0.3071838715 0.3071838715 +71 0.2728618191 0.2728618191 0.292351949 0.292351949 +72 0.2591852806 0.2591852806 0.2776985149 0.2776985149 +73 0.2459741716 0.2459741716 0.2635437553 0.2635437553 +74 0.2325874383 0.2325874383 0.2492008267 0.2492008267 +75 0.2196415337 0.2196415337 0.2353302147 0.2353302147 +76 0.2068364323 0.2068364323 0.2216104631 0.2216104631 +77 0.1942018643 0.1942018643 0.208073426 0.208073426 +78 0.1819597288 0.1819597288 0.1949568523 0.1949568523 +79 0.1697304101 0.1697304101 0.1818540108 0.1818540108 +80 0.1577802281 0.1577802281 0.1690502444 0.1690502444 +81 0.1461461046 0.1461461046 0.1565851121 0.1565851121 +82 0.1346176886 0.1346176886 0.1442332378 0.1442332378 +83 0.1233386512 0.1233386512 0.1321485548 0.1321485548 +84 0.1122326762 0.1122326762 0.1202492959 0.1202492959 +85 0.1013988072 0.1013988072 0.1086415791 0.1086415791 +86 0.09079050542 0.09079050542 0.09727554152 0.09727554152 +87 0.08038026482 0.08038026482 0.0861217123 0.0861217123 +88 0.07075874712 0.07075874712 0.07581294334 0.07581294334 +89 0.06228892509 0.06228892509 0.06673813402 0.06673813402 +90 0.05483294076 0.05483294076 0.05874957938 0.05874957938 +91 0.04826943775 0.04826943775 0.05171725473 0.05171725473 +92 0.04249158605 0.04249158605 0.04552669934 0.04552669934 +93 0.0374053432 0.0374053432 0.04007715343 0.04007715343 +94 0.03292792362 0.03292792362 0.03527991816 0.03527991816 +95 0.02898645116 0.02898645116 0.03105691196 0.03105691196 +96 0.02551677296 0.02551677296 0.0273393996 0.0273393996 +97 0.02246241523 0.02246241523 0.02406687346 0.02406687346 +98 0.01977366413 0.01977366413 0.02118606871 0.02118606871 +99 0.01740675653 0.01740675653 0.01865009629 0.01865009629 +100 0.1280130976 0.1280130976 0.1371568902 0.1371568902 \ No newline at end of file diff --git a/Library/PAX_SAPIENTICA/Simulation/JapanProvinces.hpp b/Library/PAX_SAPIENTICA/Simulation/JapanProvinces.hpp index 4302fca64..22d9a94a0 100644 --- a/Library/PAX_SAPIENTICA/Simulation/JapanProvinces.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/JapanProvinces.hpp @@ -117,6 +117,7 @@ namespace paxs { sub_menu_v.size() <= getMenuIndex(menu, MurMur3::calcHash("mtdna")) ) { PAXS_WARNING("Failed to read Japan MtDNA_List TSV file: " + path + " at line " + std::to_string(i)); + ++i; continue; } mtdna_list.emplace_back(sub_menu_v[menu[MurMur3::calcHash("mtdna")]]); @@ -142,7 +143,7 @@ namespace paxs { life_span_tsv.deleteBOM(); // 1 行目を分割する std::unordered_map menu = life_span_tsv.splitHashMapMurMur3('\t'); - + std::size_t i = 1; // 1 行ずつ読み込み(区切りはタブ) while (life_span_tsv.getLine()) { std::vector sub_menu_v = life_span_tsv.split('\t'); @@ -158,6 +159,7 @@ namespace paxs { life_span.weight_farming_male.emplace_back(0.0); life_span.weight_hunter_gatherer_female.emplace_back(0.0); life_span.weight_hunter_gatherer_male.emplace_back(0.0); + ++i; continue; } life_span.weight_farming_female.emplace_back(std::stod(sub_menu_v[menu[MurMur3::calcHash("agricultural_female_ndx")]])); @@ -169,6 +171,7 @@ namespace paxs { life_span.dist_farming_male = std::discrete_distribution<>(life_span.weight_farming_male.begin(), life_span.weight_farming_male.end()); life_span.dist_hunter_gatherer_female = std::discrete_distribution<>(life_span.weight_hunter_gatherer_female.begin(), life_span.weight_hunter_gatherer_female.end()); life_span.dist_hunter_gatherer_male = std::discrete_distribution<>(life_span.weight_hunter_gatherer_male.begin(), life_span.weight_hunter_gatherer_male.end()); + ++i; } } diff --git a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp index 0e6773b24..068f0d231 100644 --- a/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp +++ b/Library/PAX_SAPIENTICA/Simulation/SimulationConst.hpp @@ -257,6 +257,7 @@ namespace paxs { std::unordered_map menu = probability_tsv.splitHashMapMurMur3('\t'); marriage_probability.agricultural.clear(); marriage_probability.hunter_gatherer.clear(); + std::size_t i = 1; // 1 行ずつ読み込み(区切りはタブ) while (probability_tsv.getLine()) { std::vector sub_menu_v = probability_tsv.split('\t'); @@ -267,10 +268,12 @@ namespace paxs { PAXS_WARNING("Failed to read Japan Marriage TSV file: " + path + " at line " + std::to_string(i)); marriage_probability.agricultural.emplace_back(0.0); marriage_probability.hunter_gatherer.emplace_back(0.0); + ++i; continue; } marriage_probability.agricultural.emplace_back(std::stod(sub_menu_v[menu[MurMur3::calcHash("agricultural")]])); marriage_probability.hunter_gatherer.emplace_back(std::stod(sub_menu_v[menu[MurMur3::calcHash("hunter_gatherer")]])); + ++i; } } void inputChildbearing() noexcept { @@ -294,6 +297,7 @@ namespace paxs { std::unordered_map menu = probability_tsv.splitHashMapMurMur3('\t'); childbearing_probability.agricultural.clear(); childbearing_probability.hunter_gatherer.clear(); + std::size_t i = 1; // 1 行ずつ読み込み(区切りはタブ) while (probability_tsv.getLine()) { std::vector sub_menu_v = probability_tsv.split('\t'); @@ -304,10 +308,12 @@ namespace paxs { PAXS_WARNING("Failed to read Japan Childbearing TSV file: " + path + " at line " + std::to_string(i)); childbearing_probability.agricultural.emplace_back(0.0); childbearing_probability.hunter_gatherer.emplace_back(0.0); + ++i; continue; } childbearing_probability.agricultural.emplace_back(std::stod(sub_menu_v[menu[MurMur3::calcHash("agricultural")]])); childbearing_probability.hunter_gatherer.emplace_back(std::stod(sub_menu_v[menu[MurMur3::calcHash("hunter_gatherer")]])); + ++i; } }