0


数学建模美赛模拟题----蜜蜂种群模型、各种因素影响,以及所需活动范围

这是英文版的原题

这其实是2022年美国高中生数学建模竞赛的A题,这次是我们学校选拔赛的测试题。

这是汉化版的题目

首先,我们提取一下题目的参考文献中的关键信息:

一些养蜂人损失了30%到90%的蜂箱,提出了多种可能的原因:新烟碱或新农药,害虫,如寄生螨瓦氏螨,真菌和细菌或病毒感染,环境压力,营养不良,低遗传多样性,栖息地破坏或气候变化的影响,等等。
蜜蜂通常在1到6公里的范围内飞行,但有时会飞到13.5公里。事实上,有些蜜蜂会飞到离蜂巢20公里远的地方。
所有蜜蜂只有在天气理想的时候才会移动到更远的范围。它们在华氏65度(18℃)左右就能完成觅食活动——蜜蜂也是如此。
在冬天,它们需要至少55华氏度(13℃)的温度来保持觅食的活跃。随着花朵的减少,蜜蜂会为了节省能量而成为家门口的觅食者。
蜜蜂可以飞到8公里远的地方去寻找合适的水源,它们每天带着几乎一加仑的水回到蜂巢。
在炎热的日子里,蜜蜂更专注于获取水分,而不是花粉和花蜜,直到天气适合授粉。
使用含有新烟碱的杀虫剂往往会抑制蜜蜂的自然行为和飞行模式。这也极大地影响了它们觅食花粉、花蜜和水的能力。
磁场和辐射会对蜜蜂造成伤害。它们干扰了蜜蜂的自然罗盘,使它们难以精确和安全地飞行。
当条件不太有利时,它们的飞行距离就会缩短。这可能是因为天气、食物的可获得性和人类活动,比如电磁脉冲和辐射

第一问:

  1. 我们需要建立一个模型来确定蜜蜂的种群随时间的变化趋势;
  2. 由于该种群是一个单种群,所以我们优先考虑Logistic模型来对其进行分析:
  3. ![](https://img-blog.csdnimg.cn/4dcd3108a2664f6d8b79b0fb383ff2dc.png)

  1. 那么我们就需要定义出生率:
  2. 根据相关论文我们可以了解到,蜜蜂种群的出生率就是他的产卵率,我们从相关论文得到的数据为种群数量为10000左右的蜜蜂种群得到的产卵量,产卵率随温度变化比较大。所以我们寻找了产卵率随温度变化的模型,并将其量化为具体的数值。这样我们就可以根据温度得到每天的产卵率,再根据具体的种群数量得到每天具体的产卵量。我们通过拟合数据得到一下函数,通过时间t得到对应的产卵量:
  1. int eag(int t)
  2. {
  3. double e = -0.0135 * pow(t, 4) + 1.2839 * pow(t, 3) - 45.909 * pow(t, 2) + 736.75 * t - 4316.3;
  4. if (e < 0)return 0;
  5. return e;
  6. }
  1. 我们还需要定义死亡率:
  2. 由于蜜蜂在花季工作强度较大,工蜂的寿命会得到大幅度减少,其寿命只有20-30天,在花粉较少的季节,工蜂的工作强度大大减少,其寿命可达2-3个月。因此我们需要定义一个工作强度和死亡之间的关系,工作强度是与花粉量和飞行的距离相关的。我们从相关论文得到花粉的量随月份的变化,以及气温对蜜蜂飞行距离的影响,并将其量化出来,以最大值为100,将其对应值进行折算得到对应的值。

花粉浓度随季节变化:

蜜蜂飞行距离随温度变化:

  1. 得到的结果为(0℃,40℃):

{0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 6 , 9 , 14 , 21 , 31 , 46 , 68 , 100 , 74 , 57 , 45 , 36 , 28 , 23 , 18 , 15 , 12 , 10 , 8 , 7 , 6 , 5 , 4 }

  1. 则蜜蜂的工作强度为:花粉浓度×飞行距离
  2. 在这里我们为了保证数据的合理性,我们认为蜜蜂一天的工作强度不超过5,所以我们在其前面乘上一个系数A(随当地气候和环境变化)。
  3. 随后我们判定蜜蜂的死亡条件为:蜜蜂的生存时间+他的工作强度>=120
  4. 其中死亡还分为“工作死亡”和“夭折”,蜜蜂一生一共有四个阶段,分别为:卵,幼虫,蛹和成蜂。
  5. 这个“工作死亡”发生在成蜂阶段,“夭折”发生在卵这个阶段。
  6. 所谓“夭折”,其实就是卵没有成功孵化为幼虫。这样我们需要得到的就是孵化率,通过相关论文我们得到了其孵化率随温度的变化趋势。
  7. 由于孵化率在后续计算过程中十分不便,所以我们是通过未孵化率(也就是1-孵化率)得到的结果,并把其量化为(其中t的转化为外界温度转化为蜂巢温度):
  1. double dead_rate(int t)
  2. {
  3. int t1 = (t - 14) / 3 + 31;
  4. if (t1 == 31)return 51.5;
  5. else if (t1 == 32)return 2.5;
  6. else if (t1 == 33)return 2.1;
  7. else if (t1 == 34)return 0;
  8. else if (t1 == 35)return 0;
  9. else if (t1 == 36)return 6.8;
  10. else if (t1 == 37)return 5.7;
  11. else if (t1 == 38)return 12.5;
  12. else return 100;
  13. }
  1. 于是,我们得到了死亡率的模型。
  2. 最后,我们选取了福建地区比较适合养蜂的地方的气温进行测试:

  1. 我们通过一个结构体来实现(数据有些许改变):
  1. struct month_wearher
  2. {
  3. int low = 0;
  4. int high = 0;
  5. int max = 0;
  6. int min = 0;
  7. };
  1. month_wearher wea[13];
  2. wea[1].low = 12, wea[1].high = 20, wea[1].max = 25, wea[1].min = 3;
  3. wea[2].low = 13, wea[2].high = 20, wea[2].max = 25, wea[2].min = 1;
  4. wea[3].low = 16, wea[3].high = 21, wea[3].max = 27, wea[3].min = 6;
  5. wea[4].low = 22, wea[4].high = 22, wea[4].max = 32, wea[4].min = 9;
  6. wea[5].low = 24, wea[5].high = 28, wea[5].max = 37, wea[5].min = 16;
  7. wea[6].low = 28, wea[6].high = 29, wea[6].max = 38, wea[6].min = 19;
  8. wea[7].low = 30, wea[7].high = 32, wea[7].max = 39, wea[7].min = 24;
  9. wea[8].low = 30, wea[8].high = 36, wea[8].max = 37, wea[8].min = 22;
  10. wea[9].low = 28, wea[9].high = 30, wea[9].max = 38, wea[9].min = 19;
  11. wea[10].low = 23, wea[10].high = 25, wea[10].max = 36, wea[10].min = 0;
  12. wea[11].low = 15, wea[11].high = 25, wea[11].max = 30, wea[11].min = 10;
  13. wea[12].low = 10, wea[12].high = 25, wea[12].max = 28, wea[12].min = 5;
  1. 对于每天的温度我们通过随机数来实现,首先产生一个随机数判断是否产生极端天气,我们认为正常天气产生的概率为95%,机断天气发生的概率为5%。我们让这个随机数与39取模,若模为0则产生极端低温,若为39则产生极端高温,其他则在平均最高温和平均最低温里生成一个随机数实现产生当天的温度。

于是我们的代码就实现了:

  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4. #include <ctime>
  5. #include <cmath>
  6. using namespace std;
  7. struct Bee
  8. {
  9. float workforce = 0;//工作总强度;
  10. short type = -1;//蜜蜂类型,0-卵,1-幼虫,2-蛹,3-成蜂
  11. short days = 0;//蜜蜂生存时间
  12. };
  13. int tem[366];//每天对应的温度
  14. void changetype(Bee &x)
  15. {
  16. if (x.type == -1)return;
  17. if (x.workforce + x.days >= 120)
  18. {
  19. x.days = 0;
  20. x.type = -1;
  21. x.workforce = 0;
  22. return;
  23. }
  24. if (x.days > 20)x.type = 3;
  25. else if (x.days > 6 && x.days<=20)x.type = 2;
  26. else if (x.days > 3 && x.days <= 6) x.type = 1;
  27. else if (x.days >= 0 && x.days <= 3)x.type = 0;
  28. }
  29. double dead_rate(int t)
  30. {
  31. int t1 = (t - 14) / 3 + 31;
  32. if (t1 == 31)return 51.5;
  33. else if (t1 == 32)return 2.5;
  34. else if (t1 == 33)return 2.1;
  35. else if (t1 == 34)return 0;
  36. else if (t1 == 35)return 0;
  37. else if (t1 == 36)return 6.8;
  38. else if (t1 == 37)return 5.7;
  39. else if (t1 == 38)return 12.5;
  40. else return 100;
  41. }
  42. int eag(int t)
  43. {
  44. double e = -0.0135 * pow(t, 4) + 1.2839 * pow(t, 3) - 45.909 * pow(t, 2) + 736.75 * t - 4316.3;
  45. if (e < 0)return 0;
  46. return 4*e;
  47. }
  48. struct month_wearher
  49. {
  50. int low = 0;
  51. int high = 0;
  52. int max = 0;
  53. int min = 0;
  54. };
  55. void update(Bee mifeng[],int t,int huafen[],int round[],int month,int &s0,int &i0,int &i1,int &i2,int &i3)
  56. {
  57. i0 = 0, i1 = 0, i2 = 0, i3 = 0,s0 = 0;
  58. int a = eag(t);
  59. int l3 = 0;
  60. int add = 0;
  61. if (a > 0)
  62. {
  63. for (int i = 0; i < 100000; i++)
  64. {
  65. if (mifeng[i].type == -1)
  66. {
  67. mifeng[i].type = 0;
  68. mifeng[i].days = 0;
  69. mifeng[i].workforce = 0;
  70. add++;
  71. if (add >= a)break;
  72. }
  73. }
  74. }
  75. for (int i = 0; i < 100000; i++)
  76. {
  77. if (mifeng[i].type != -1)mifeng[i].days++;
  78. changetype(mifeng[i]);
  79. if (mifeng[i].days == 3)l3++;
  80. if (mifeng[i].type == 3)
  81. {
  82. mifeng[i].workforce += (float)(huafen[month]*round[t])/2000;
  83. }
  84. }
  85. int d = (l3 * dead_rate(t)) / 100,m =0;
  86. if (d > 0)
  87. {
  88. for (int i = 0; i < 100000; i++)
  89. {
  90. if (mifeng[i].days == 3)
  91. {
  92. mifeng[i].type = -1;
  93. mifeng[i].days = 0;
  94. mifeng[i].workforce = 0;
  95. m++;
  96. if (m >= d)break;
  97. }
  98. }
  99. }
  100. for (int i = 0; i < 100000; i++)
  101. {
  102. if (mifeng[i].type == 0)i0++;
  103. else if (mifeng[i].type == 1)i1++;
  104. else if (mifeng[i].type == 2)
  105. {
  106. i2++;
  107. }
  108. else if (mifeng[i].type == 3)i3++;
  109. }
  110. s0 = i0 + i1 + i2 + i3;
  111. cout << "剩余" << s0 << "只蜜蜂" << endl;
  112. cout << "其中:" << endl;
  113. cout << "剩余" << i0 << "个卵" << endl;
  114. cout << "剩余" << i1 << "只幼虫" << endl;
  115. cout << "剩余" << i2 << "只蛹" << endl;
  116. cout << "剩余" << i3 << "只成蜂" << endl;
  117. }
  118. int main()
  119. {
  120. srand((unsigned int)time(NULL));
  121. Bee mifeng[100000];
  122. int i0 , i1 , i2 , i3 ,s0;
  123. cout << "请分别输入4个各阶段蜜蜂(卵,幼虫,蛹,成峰)的数量(总数在50000以内):" << endl;
  124. cin >> i0 >> i1 >> i2 >> i3;
  125. s0 = i0 + i1 + i2 + i3;
  126. for (int i = 0; i < i0; i++) {
  127. mifeng[i].type = 0;
  128. mifeng[i].days = rand() % 4;
  129. mifeng[i].workforce = 0;
  130. }
  131. for (int i = i0; i < i0+i1; i++) {
  132. mifeng[i].type = 1;
  133. mifeng[i].days = rand() % 3 + 4;
  134. mifeng[i].workforce = 0;
  135. }
  136. for (int i = i0+i1; i < s0-i3; i++) {
  137. mifeng[i].type = 2;
  138. mifeng[i].days = rand() % 14 + 7;
  139. mifeng[i].workforce = 0;
  140. }
  141. for (int i = s0 - i3; i < s0; i++) {
  142. mifeng[i].type = 3;
  143. mifeng[i].days = rand() % 41 + 20;
  144. mifeng[i].workforce = rand()%100;
  145. }
  146. month_wearher wea[13];
  147. wea[1].low = 12, wea[1].high = 20, wea[1].max = 25, wea[1].min = 3;
  148. wea[2].low = 13, wea[2].high = 20, wea[2].max = 25, wea[2].min = 1;
  149. wea[3].low = 16, wea[3].high = 21, wea[3].max = 27, wea[3].min = 6;
  150. wea[4].low = 22, wea[4].high = 22, wea[4].max = 32, wea[4].min = 9;
  151. wea[5].low = 24, wea[5].high = 28, wea[5].max = 37, wea[5].min = 16;
  152. wea[6].low = 28, wea[6].high = 29, wea[6].max = 38, wea[6].min = 19;
  153. wea[7].low = 30, wea[7].high = 32, wea[7].max = 39, wea[7].min = 24;
  154. wea[8].low = 30, wea[8].high = 36, wea[8].max = 37, wea[8].min = 22;
  155. wea[9].low = 28, wea[9].high = 30, wea[9].max = 38, wea[9].min = 19;
  156. wea[10].low = 23, wea[10].high = 25, wea[10].max = 36, wea[10].min = 0;
  157. wea[11].low = 15, wea[11].high = 25, wea[11].max = 30, wea[11].min = 10;
  158. wea[12].low = 10, wea[12].high = 25, wea[12].max = 28, wea[12].min = 5;
  159. int mon_day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
  160. int huafen[13] = {0,4,5,21,76,100,74,57,31,35,25,23,11 };
  161. int round[40] = {0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,6,9,14,21,31,46,68,100,74,57,45,36,28,23,18,15,12,10,8,7,6,5,4};
  162. ofstream ouF("data new.txt", ios::out);
  163. int tian = 0;
  164. for (int month = 1; month <= 12; month++)
  165. {
  166. for (int day = 1; day <= mon_day[month]; day++)
  167. {
  168. tian++;
  169. int t;
  170. if (rand() % 40 == 0)t = rand() % (wea[month].low - wea[month].min + 1) + wea[month].min;
  171. else if (rand() % 40 == 39)t = rand() % (wea[month].max - wea[month].high + 1) + wea[month].high;
  172. else t = rand() % (wea[month].high - wea[month].low + 1) + wea[month].low;
  173. printf("今天是%d月%d日,当天气温为%d℃,当日产卵%d个\n",month,day,t,eag(t));
  174. update(mifeng,t,huafen,round,month,s0,i0,i1,i2,i3);
  175. ouF << tian << " " << t <<" " << s0 << " " << " " << i0 << " " << i1 << " " << i2 << " " << i3 << endl;
  176. }
  177. }
  178. ouF.close();
  179. return 0;
  180. }
  1. 将数据保存至文件中后,我们通过Python进行绘图:

  1. 其中温度变化为:

与相关论文得到的模型拟合度较高:

我们的蜜蜂种群模型就得到建立(虽然温度变化有些不合理的地方)!

第二问:

  1. 我们需要讨论相关的环境因素对蜜蜂种群变化的影响:
  2. 我们一共做了4种因素的对比,分别为:温度变化,产卵率变化,寿命变化,年龄结构变化

温度变化:

  1. 我们只需要将当地的温度进行适当变化即可,为了保证实验的公平性,我们只小幅度的改变温度(调高或调低均不超过5℃)。这里,我们测试的是调低5℃组(-5℃)、调低3℃组(-3℃)、正常组(0℃)、调高3℃组(+3℃)、调高5℃组(+5℃),其结果如下:

  1. 我们可以看到:温度对我们这个模型的影响是非常大的。
  2. 对于其解释:+5℃组,由于在冬季温度比之前高,产卵率大大提升,而冬季花粉浓度低,工作强度并不高,所以冬季种群数量会猛增。

产卵率变化:

  1. 我们只需要将产卵率进行适当变化即可,为了保证实验的公平性,我们只小幅度的改变产卵率(调高或调低均不超过20%)。这里,我们测试的是调低20%组(-20%)、调低10%组(-10%)、正常组(0)、调高10%组(+10%)、调高20%组(+20%),其结果如下:

  1. 我们可以看到:产卵率由于直接影响卵的产生,可以很大程度上影响蜜蜂种群数量的变化。

寿命变化:

  1. 我们只需要改变蜜蜂的死亡判断条件即可:我们分别测试了寿命为100110120130140对于的数据,并将其图像绘制处理进行对比。

  1. 我们可以看到:寿命可以让蜜蜂活的更久,干更多的活,在一定程度上能够影响蜜蜂的种群变化。

年龄结构变化:

  1. 年龄结构分为:增长型、稳定性和衰退型,在这里我们对2个极端的类型进行分析,也就是对增长型和衰退型进行分析,更能对比得到结论。我们将增长型的四个阶段的比值设置为721396,衰退型四个阶段的比值设置为691372。结果如下:

  1. 我们可以看到:年龄结构对蜜蜂的种群种群数量影响并不大,增长型在初期,能够快速增长,但由于环境因素的限制,最后与衰退型的变化趋势几乎一致。
  2. 结论:因素影响 温度>产卵率>寿命>年龄结构。

第三问:

  1. 我们需要分析出蜜蜂的种群分布趋势,并求解出该模型在20英亩(81000平方米)的养蜂厂需要多少个蜂群,能够使利益最大化。
  2. 那我们就需要对蜜蜂的飞行距离进行量化得到。
  3. 根据文中信息,蜜蜂的飞行距离一般在1-6KM,而我们第一问所建立的模型存在0-100的变化,那么我们就让蜜蜂的平均飞行距离与之线性对应,得到每一天 的平均飞行距离后。我们的模型认为95%的蜜蜂会在这个平均飞行距离的±15%内变化,5%的蜜蜂会超出15%,根据第一问的思想,我们得出了模型。
  4. 我们对一年365天,每天取100只蜜蜂的样本,将这36500只蜜蜂的样本的飞行距离进行排序。我们认为95%的蜜蜂的活动范围为该种群的绝对范围,于是 将第95*365只蜜蜂的飞行距离为该绝对范围的绝对半径。于是就得到了绝对范围,用81000平方米除以该绝对范围即可得到所需的蜜蜂的种群数量。

具体代码如下:

  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4. #include <ctime>
  5. #include <cmath>
  6. #include <algorithm>
  7. using namespace std;
  8. struct month_wearher
  9. {
  10. int low = 0;
  11. int high = 0;
  12. int max = 0;
  13. int min = 0;
  14. };
  15. int main()
  16. {
  17. srand((unsigned int)time(NULL));
  18. month_wearher wea[13];
  19. wea[1].low = 12, wea[1].high = 20, wea[1].max = 25, wea[1].min = 3;
  20. wea[2].low = 13, wea[2].high = 20, wea[2].max = 25, wea[2].min = 1;
  21. wea[3].low = 16, wea[3].high = 21, wea[3].max = 27, wea[3].min = 6;
  22. wea[4].low = 22, wea[4].high = 22, wea[4].max = 32, wea[4].min = 9;
  23. wea[5].low = 24, wea[5].high = 28, wea[5].max = 37, wea[5].min = 16;
  24. wea[6].low = 28, wea[6].high = 29, wea[6].max = 38, wea[6].min = 19;
  25. wea[7].low = 30, wea[7].high = 32, wea[7].max = 39, wea[7].min = 24;
  26. wea[8].low = 30, wea[8].high = 36, wea[8].max = 37, wea[8].min = 22;
  27. wea[9].low = 28, wea[9].high = 30, wea[9].max = 38, wea[9].min = 19;
  28. wea[10].low = 23, wea[10].high = 25, wea[10].max = 36, wea[10].min = 0;
  29. wea[11].low = 15, wea[11].high = 25, wea[11].max = 30, wea[11].min = 10;
  30. wea[12].low = 10, wea[12].high = 25, wea[12].max = 28, wea[12].min = 5;
  31. int mon_day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
  32. int huafen[13] = { 0,4,5,21,76,100,74,57,31,35,25,23,11 };
  33. int round[40] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,6,9,14,21,31,46,68,100,74,57,45,36,28,23,18,15,12,10,8,7,6,5,4 };
  34. int tian = 0,dex = 0;
  35. double r[36500] = { 0 };
  36. for (int month = 1; month <= 12; month++)
  37. {
  38. for (int day = 1; day <= mon_day[month]; day++)
  39. {
  40. tian++;
  41. int t;
  42. if (rand() % 40 == 0)t = rand() % (wea[month].low - wea[month].min + 1) + wea[month].min;
  43. else if (rand() % 40 == 39)t = rand() % (wea[month].max - wea[month].high + 1) + wea[month].high;
  44. else t = rand() % (wea[month].high - wea[month].low + 1) + wea[month].low;
  45. double r0 = round[t]*0.05 + 1;
  46. double r_min = r0 * 0.85;
  47. double r_max = r0 * 1.15;
  48. for (int i = 0; i < 100; i++)
  49. {
  50. int t = rand() % 20;
  51. if (t != 19)
  52. {
  53. double x = r_min + (rand() % 101) * (r_max - r_min) / 100;
  54. r[dex] = x;
  55. dex++;
  56. }
  57. else
  58. {
  59. double x = r_max + (rand() % 101) * (20 - r_max) / 100;
  60. r[dex] = x;
  61. dex++;
  62. }
  63. }
  64. }
  65. }
  66. sort(r,r+36500);
  67. double m = r[365 * 95];
  68. cout << "一个蜂巢所需的空间半径为:" << m << "KM" << endl;
  69. cout << "20英亩所需要的蜂群数为:"<<(int)(81000 / (3.14 * m * m))<<endl;
  70. return 0;
  71. }
  1. 经过多次模拟,我们得到的一共蜂巢所需的空间半径约为6.5KM20英亩所需的蜂巢数在500-600之间。

第四问:

  1. 撰写专属blog
  2. 这就是第四问的答案咯,这也是我第一次写blog,希望大家多多支撑!
  3. 也希望我的这篇blog能够给大家提供一些思路,还有许多不足的地方希望大家指正!
  4. 写到最后也希望一些C++大佬能够改进我的代码,大家一起共同进步!
  5. 祝看到这篇blog的各位,学习进步,工作顺利,天天开心!
标签: 算法 c++ 人工智能

本文转载自: https://blog.csdn.net/m0_74133913/article/details/128352233
版权归原作者 missing_cl 所有, 如有侵权,请联系我们删除。

“数学建模美赛模拟题----蜜蜂种群模型、各种因素影响,以及所需活动范围”的评论:

还没有评论