带迁移的掠食者猎物方程

在这一节中,我们将再次重温掠食者猎物模型。目的是了解在前面关于可重用组件模型的工作基础上,这个模型有什么变化。现在,我们将采取下一步行动,去创建各个地理区域的可重用(一般种群动力学)模型。然后,我们再用迁移模型将这些地域连接在一起。

双种群的地区

所有在本节中的模型都会使用以下包括兔、狐狸种群的模型。而模型使用通常的掠食者猎物人口动态。其Modelica源代码为:

within ModelicaByExample.Subsystems.LotkaVolterra.Components;
model TwoSpecies "Lotka-Volterra two species configuration"
  // Import several component models from ModelicaByExample.Components.LotkaVolterra
  import ModelicaByExample.Components.LotkaVolterra.Components.RegionalPopulation;
  import ModelicaByExample.Components.LotkaVolterra.Components.Reproduction;
  import ModelicaByExample.Components.LotkaVolterra.Components.Starvation;
  import ModelicaByExample.Components.LotkaVolterra.Components.Predation;

  parameter Real alpha=0.1 "Birth rate";
  parameter Real gamma=0.4 "Starvation coefficient";
  parameter Real initial_rabbit_population=10 "Initial rabbit population";
  parameter Real initial_fox_population=10 "Initial fox population";
  parameter Real beta=0.02 "Prey (rabbits) consumed";
  parameter Real delta=0.02 "Predators (foxes) fed";

  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species rabbits
    "Population of rabbits in this region"
    annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species foxes
    "Population of foxes in this region"
    annotation (Placement(transformation(extent={{90,-10},{110,10}})));
protected
  RegionalPopulation rabbit_population(
      initial_population=initial_rabbit_population,
      init=RegionalPopulation.InitializationOptions.FixedPopulation) "Rabbit population"
    annotation (Placement(transformation(extent={{-50,-60},{-30,-40}})));
  Reproduction reproduction(alpha=alpha) "Reproduction of rabbits"
    annotation (Placement(transformation(
        extent={{-10,-10},{10,10}},
        origin={-80,-50})));
  RegionalPopulation fox_population(
      init=RegionalPopulation.InitializationOptions.FixedPopulation,
      initial_population=initial_fox_population)
    annotation (Placement(transformation(extent={{30,-60},{50,-40}})));
  Starvation fox_starvation(gamma=gamma) "Starvation of foxes"
    annotation (Placement(transformation(extent={{70,-60},{90,-40}})));
  Predation fox_predation(beta=beta, delta=delta)
    "Foxes eating rabbits"
    annotation (Placement(transformation(extent={{-10,-30},{10,-10}})));
equation
  connect(reproduction.species, rabbit_population.species)
    annotation (Line(
      points={{-80,-40},{-80,-20},{-40,-20},{-40,-40}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(fox_predation.a, rabbit_population.species)
    annotation (Line(
      points={{-10,-20},{-40,-20},{-40,-40}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(fox_starvation.species, fox_population.species)
    annotation (Line(
      points={{80,-40},{80,-20},{40,-20},{40,-40}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(fox_population.species, fox_predation.b)
    annotation (Line(
      points={{40,-40},{40,-20},{10,-20}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(rabbit_population.species, rabbits)
    annotation (Line(
      points={{-40,-40},{-40,0},{-100,0}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(fox_population.species, foxes)
    annotation (Line(
      points={{40,-40},{40,0},{100,0}},
      color={0,127,0},
      smooth=Smooth.None));
end TwoSpecies;

图表此组件呈现为:

Region containing rabbits and foxes

此模型将作为本节随后区域人口动态模型的基础。

未连接区域

我们先会建立一个模型。模型由四个不相连的地域组成。对这样的模型其Modelica源代码很简单:

within ModelicaByExample.Subsystems.LotkaVolterra.Examples;
model UnconnectedPopulations "Several unconnected regional populations"
  Components.TwoSpecies A "Region A"
    annotation (Placement(transformation(extent={{-10,80},{10,100}})));
  Components.TwoSpecies B "Region B"
    annotation (Placement(transformation(extent={{-10,20},{10,40}})));
  Components.TwoSpecies C "Region C"
    annotation (Placement(transformation(extent={{-10,-40},{10,-20}})));
  Components.TwoSpecies D "Region D"
    annotation (Placement(transformation(extent={{-10,-100},{10,-80}})));
  annotation (experiment(StopTime=40, Intervals=0.008));
end UnconnectedPopulations;

此模型的简图也同样简单

Four unconnected regional populations

如果我们对该模型进行仿真,每个种群应遵循同一轨迹。因为各个种群的初始条件均是相同的。下面的图显示了这确实如此:

../../../_images/Uncon.png

稍后我们将观察迁移的影响。但为了完全鉴别迁移的效果,我们需要对不同地域的发展趋势引进一定差异。所以,让我们修改UnconnectedPopulations模型的初始条件以期引进一些区域性的差异:

within ModelicaByExample.Subsystems.LotkaVolterra.Examples;
model InitiallyDifferent "Multiple regions with different initial populations"
  extends UnconnectedPopulations(
    B(initial_rabbit_population=5, initial_fox_population=12),
    C(initial_rabbit_population=12, initial_fox_population=5),
    D(initial_rabbit_population=7, initial_fox_population=7));
end InitiallyDifferent;

如果我们对该模型进行仿真,会看到各区域的种群动态有些许的差异。

../../../_images/ID.png

迁移

现在我们已经模拟非相连区域里种群动态。下一步要研究的是迁移对这些动态可能造成的影响。

请考虑以下的Modelica迁移模型

within ModelicaByExample.Subsystems.LotkaVolterra.Components;
model Migration "Simple 'diffusion' based model of migration"
  parameter Real rabbit_migration=0.001 "Rabbit migration rate";
  parameter Real fox_migration=0.005 "Fox migration rate";
  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species rabbit_a
    "Rabbit population in Region A"
    annotation (Placement(transformation(extent={{-70,90},{-50,110}})));
  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species rabbit_b
    "Rabbit population in Region B"
    annotation (Placement(transformation(extent={{-70,-110},{-50,-90}})));
  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species fox_a
    "Fox population in Region A"
    annotation (Placement(transformation(extent={{50,90},{70,110}})));
  ModelicaByExample.Components.LotkaVolterra.Interfaces.Species fox_b
    "Fox population in Region B"
    annotation (Placement(transformation(extent={{50,-110},{70,-90}})));
equation
  rabbit_a.rate = (rabbit_a.population-rabbit_b.population)*rabbit_migration;
  rabbit_a.rate + rabbit_b.rate = 0 "Conservation of rabbits";
  fox_a.rate = (fox_a.population-fox_b.population)*fox_migration;
  fox_a.rate + fox_b.rate = 0 "Conservation of foxes";
  annotation ( Icon(graphics={
        Rectangle(
          extent={{-100,100},{100,-100}},
          lineColor={0,127,0},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid),
        Text(
          extent={{-100,20},{100,-20}},
          lineColor={0,127,0},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid,
          textString="%name",
          origin={-120,0},
          rotation=90),
        Bitmap(extent={{-84,82},{-36,-82}}, fileName=
              "modelica://ModelicaByExample/Resources/Images/rabbit.png"),
        Bitmap(extent={{18,80},{94,-84}}, fileName=
              "modelica://ModelicaByExample/Resources/Images/fox.png")}));
end Migration;

此模型利用两个连接区域内兔子和狐狸各自种群大小的区域差去求解迁移的速率。迁移的速率与各自种群大小在区域间之差成正比。换句话说,如果某区域内兔子数比另一区的多,兔子将从人口较多的区域移动到人口较少的区。这实际上是一个“扩散”迁移模型,不一定有生态学上的基础。引入模型的目的是提供一个例子去说明,要如何在各区域现有动态的基础上引入新的效应,以影响区域间的种群动态。

如果我们将先前未连接地区用迁移路径连接起来,如:

within ModelicaByExample.Subsystems.LotkaVolterra.Examples;
model WithMigration "Connect populations by migration"
  extends InitiallyDifferent;
  Components.Migration migrate_AB "Migration from region A to region B"
    annotation (Placement(transformation(extent={{-10,50},{10,70}})));
  Components.Migration migrate_BC "Migration from region B to region C"
    annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
  Components.Migration migrate_CD "Migration from region C to region D"
    annotation (Placement(transformation(extent={{-10,-70},{10,-50}})));
equation
  connect(migrate_CD.rabbit_b, D.rabbits) annotation (Line(
      points={{-6,-70},{-6,-76},{-20,-76},{-20,-90},{-10,-90}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_CD.rabbit_a, C.rabbits) annotation (Line(
      points={{-6,-50},{-6,-44},{-20,-44},{-20,-30},{-10,-30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_BC.rabbit_b, C.rabbits) annotation (Line(
      points={{-6,-10},{-6,-16},{-20,-16},{-20,-30},{-10,-30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_CD.fox_b, D.foxes) annotation (Line(
      points={{6,-70},{6,-76},{20,-76},{20,-90},{10,-90}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_BC.fox_b, C.foxes) annotation (Line(
      points={{6,-10},{6,-16},{20,-16},{20,-30},{10,-30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_CD.fox_a, C.foxes) annotation (Line(
      points={{6,-50},{6,-44},{20,-44},{20,-30},{10,-30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_BC.fox_a, B.foxes) annotation (Line(
      points={{6,10},{6,16},{20,16},{20,30},{10,30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_BC.rabbit_a, B.rabbits) annotation (Line(
      points={{-6,10},{-6,16},{-20,16},{-20,30},{-10,30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_AB.fox_b, B.foxes) annotation (Line(
      points={{6,50},{6,50},{6,44},{20,44},{20,30},{10,30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_AB.rabbit_b, B.rabbits) annotation (Line(
      points={{-6,50},{-6,44},{-20,44},{-20,30},{-10,30}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_AB.fox_a, A.foxes) annotation (Line(
      points={{6,70},{6,76},{20,76},{20,90},{10,90}},
      color={0,127,0},
      smooth=Smooth.None));
  connect(migrate_AB.rabbit_a, A.rabbits) annotation (Line(
      points={{-6,70},{-6,76},{-20,76},{-20,90},{-10,90}},
      color={0,127,0},
      smooth=Smooth.None));
end WithMigration;

系统简图变为:

Four regional populations with migration paths

模拟这个系统后,我们可以看到不同区域内的人口动态在开始时并不同步。但是,最终不同的区域都会稳定成重复的行为模式:

../../../_images/WM.png

结论

此前,我们把掠食者猎物方程化为代表捕食、饥饿和繁殖的组件。在本节中,我们能使用这些组件模型建立子系统模型,以表示在特定区域内的种群动态。在此基础上,我们将这些子系统连接为带层级的系统模型,以描述这些不同区域之间迁移的影响。