2020年“深圳杯”数学建模挑战赛C题-无线可充电传感器网络充电路线规划

深圳杯2020——数学建模模拟赛——C题

文章目录

  • 深圳杯2020——数学建模模拟赛——C题
    • Github链接:[www.github.com/lifuguan/szcup2020_simulation]
    • 依赖库
    • 计算公式
    • 第一题
        • 使用first solution strategy获得计算近似解
        • 使用guided local search获得最优解
    • 第二问:数值解法(numerical)
      • 参数定义
      • 等式
      • 约束条件
      • 根据约束条件得出线性方程组
      • 参数设置
      • 数值解结果
    • 第二问:符号解法(symbolic)

Github链接:[www.github.com/lifuguan/szcup2020_simulation]

依赖库

  • Google or-tools
  • xlrd
  • matplotlib
  • sys
  • numpy
  • math
  • sympy (符号计算)

计算公式

  • 经度(东西方向)1M实际度:31544206M*cos(纬度)/360°=

    31544206 ⋅ cos ⁡ ( l a t i t u d e = 36 ) / 360 = 708883.29 m / l o n g t i t u d e 31544206\cdot\cos(latitude=36)/360 = 708883.29m/longtitude 31544206cos(latitude=36)/360=708883.29m/longtitude

  • 纬度(南北方向)1M实际度:40030173M360°=

    40030173 / 360 = 111194.92 m / l a t i t u d e 40030173/360 = 111194.92m/latitude 40030173/360=111194.92m/latitude

第一题

使用first solution strategy获得计算近似解

求得结果
2020年“深圳杯”数学建模挑战赛C题-无线可充电传感器网络充电路线规划_第1张图片

Route:
Route:
 0 -> 10 -> 16 -> 27 -> 12 -> 8 -> 9 -> 15 -> 7 -> 11 -> 6 -> 14 -> 25 -> 18 -> 26 -> 19 -> 20 -> 1 -> 2 -> 17 -> 29 -> 21 -> 23 -> 24 -> 28 -> 22 -> 3 -> 4 -> 5 -> 13 -> 0
Distance: 39410m

使用guided local search获得最优解

求得结果
2020年“深圳杯”数学建模挑战赛C题-无线可充电传感器网络充电路线规划_第2张图片

Route:
 0 -> 29 -> 17 -> 2 -> 1 -> 20 -> 19 -> 26 -> 18 -> 25 -> 14 -> 6 -> 11 -> 7 -> 15 -> 9 -> 8 -> 12 -> 27 -> 16 -> 10 -> 13 -> 5 -> 4 -> 3 -> 22 -> 28 -> 24 -> 23 -> 21 -> 0
Distance: 39305m

第二问:数值解法(numerical)

要使传感器一直工作的最低要求:在移动电源走完一整个回路后,电池容量刚好达到最低要求为最优

假设初始条件:当到达该节点时,剩余电池容量刚好为最低要求

参数定义

  • x 1 , x 2 , ⋯   , x 30 x_1,x_2,\cdots,x_{30} x1,x2,,x30:假设每个节点的电池容量
  • c 1 , c 2 , ⋯   , c 30 c_1,c_2,\cdots,c_{30} c1,c2,,c30:每个节点的电池消耗速度
  • r ( m A / s ) r(mA/s) r(mA/s):电池充电速度
  • f f f:最低工作电量
  • v ( m / s ) v(m/s) v(m/s):移动充电器移动速度
  • d s t dst dst:总路程

等式

  • 时间总花费 t t o t = d s t / v + ∑ i = 1 30 ( x i − f ) / r i t_{tot}=dst/v+\sum_{i=1}^{30}{(x_i - f)/r_i} ttot=dst/v+i=130(xif)/ri
  • 电池容量推导 x i = t t o t ⋅ c i + f x_i=t_{tot}\cdot c_i+f xi=ttotci+f

约束条件

去掉数据中心节点的充电计算

x i = [ d s t / v + ∑ i = 2 30 ( x i − f ) / r i ] ⋅ c i + f x_{i} = [dst/v+\sum_{i=2}^{30}{(x_{i} - f)/r_i}]\cdot c_i+f xi=[dst/v+i=230(xif)/ri]ci+f

根据约束条件得出线性方程组

组合结果为一个29*29的矩阵:

[ x 2 ⋮ x 30 ] = [ d s t ⋅ c 2 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ⋮ d s t ⋅ c 30 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ] + [ x 2 ⋅ c 2 r + ⋯ + x 30 ⋅ c 30 r ⋮ x 2 ⋅ c 2 r + ⋯ + x 30 ⋅ c 30 r ] \left[ \begin{array}{l} \boldsymbol{x}_2\\ \vdots\\ \boldsymbol{x}_{30}\\ \end{array} \right] =\left[ \begin{array}{c} \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_2}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots\\ \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_{30}}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \end{array} \right] +\left[ \begin{array}{c} \frac{\boldsymbol{x}_2\cdot \boldsymbol{c}_2}{\boldsymbol{r}}+\cdots +\frac{\boldsymbol{x}_{30}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots\\ \frac{\boldsymbol{x}_2\cdot \boldsymbol{c}_2}{\boldsymbol{r}}+\cdots +\frac{\boldsymbol{x}_{30}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \end{array} \right] x2x30=vdstc2+frfc2rfc30vdstc30+frfc2rfc30+rx2c2++rx30c30rx2c2++rx30c30

化简:

[ x 2 ⋮ x 30 ] = [ d s t ⋅ c 2 v + f − f ⋅ c 2 r 2 − ⋯ − f ⋅ c 30 r 30 ⋮ d s t ⋅ c 30 v + f − f ⋅ c 2 r 2 − ⋯ − f ⋅ c 30 r 30 ] + [ x 2 ⋅ c 2 r 2 + ⋯ + x 30 ⋅ c 30 r 30 ⋮ x 2 ⋅ c 2 r 2 + ⋯ + x 30 ⋅ c 30 r 30 ] \left[ \begin{array}{l} \boldsymbol{x}_2\\ \vdots\\ \boldsymbol{x}_{30}\\ \end{array} \right] =\left[ \begin{array}{c} \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_2}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}_2}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}_{30}}\\ \vdots\\ \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_{30}}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}_2}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}_{30}}\\ \end{array} \right] +\left[ \begin{array}{c} \frac{\boldsymbol{x}_2\cdot \boldsymbol{c}_2}{\boldsymbol{r}_2}+\cdots +\frac{\boldsymbol{x}_{30}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}_{30}}\\ \vdots\\ \frac{\boldsymbol{x}_2\cdot \boldsymbol{c}_2}{\boldsymbol{r}_2}+\cdots +\frac{\boldsymbol{x}_{30}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}_{30}}\\ \end{array} \right] x2x30=vdstc2+fr2fc2r30fc30vdstc30+fr2fc2r30fc30+r2x2c2++r30x30c30r2x2c2++r30x30c30

转化成 A ⋅ X = b A\cdot X = b AX=b形式:

[ c 2 r − 1 ⋯ c 30 r ⋮ ⋱ ⋮ c 2 r ⋯ c 30 r − 1 ] ⋅ [ x 2 ⋮ x 30 ] = − [ d s t ⋅ c 2 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ⋮ d s t ⋅ c 30 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ] \left[ \begin{matrix} \frac{\boldsymbol{c}_2}{\boldsymbol{r}}-1& \cdots& \frac{\boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots& \ddots& \vdots\\ \frac{\boldsymbol{c}_2}{\boldsymbol{r}}& \cdots& \frac{\boldsymbol{c}_{30}}{\boldsymbol{r}}-1\\ \end{matrix} \right] \cdot \left[ \begin{array}{l} \boldsymbol{x}_2\\ \vdots\\ \boldsymbol{x}_{30}\\ \end{array} \right] =-\left[ \begin{array}{c} \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_2}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots\\ \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_{30}}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \end{array} \right] rc21rc2rc30rc301x2x30=vdstc2+frfc2rfc30vdstc30+frfc2rfc30

其中

A = [ c 2 r − 1 ⋯ c 30 r ⋮ ⋱ ⋮ c 2 r ⋯ c 30 r − 1 ] , b = − [ d s t ⋅ c 2 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ⋮ d s t ⋅ c 30 v + f − f ⋅ c 2 r − ⋯ − f ⋅ c 30 r ] \boldsymbol{A}=\left[ \begin{matrix} \frac{\boldsymbol{c}_2}{\boldsymbol{r}}-1& \cdots& \frac{\boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots& \ddots& \vdots\\ \frac{\boldsymbol{c}_2}{\boldsymbol{r}}& \cdots& \frac{\boldsymbol{c}_{30}}{\boldsymbol{r}}-1\\ \end{matrix} \right] , \boldsymbol{b}=-\left[ \begin{array}{c} \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_2}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \vdots\\ \frac{\boldsymbol{dst}\cdot \boldsymbol{c}_{30}}{\boldsymbol{v}}+\boldsymbol{f}-\frac{\boldsymbol{f}\cdot \boldsymbol{c}_2}{\boldsymbol{r}}-\cdots -\frac{\boldsymbol{f}\cdot \boldsymbol{c}_{30}}{\boldsymbol{r}}\\ \end{array} \right] A=rc21rc2rc30rc301,b=vdstc2+frfc2rfc30vdstc30+frfc2rfc30

参数设置

  1. 速度 v = 100 m / s v=100m/s v=100m/s
  2. 充电速度 r = 2000 m A / s r = 2000mA/s r=2000mA/s
  3. 最低工作值 f = 4 m A f=4mA f=4mA

数值解结果

nodes battery capacity
0 2298.415
1 3241.665
2 1944.696
3 2337.717
4 1590.977
5 1944.696
6 2691.436
7 1983.998
8 1944.696
9 2337.717
10 1944.696
11 3084.457
12 2730.738
13 1944.696
14 1669.581
15 1944.696
16 2337.717
17 3123.759
18 2337.717
19 1944.696
20 1551.675
21 2337.717
22 3123.759
23 1551.675
24 2337.717
25 1866.092
26 1590.977
27 2691.436
28 2298.415

第二问:符号解法(symbolic)

代码已经实现,但是矩阵渲染太大导致计算机崩溃,故此可以得出利用符号解求解该问题并没有意义。

你可能感兴趣的:(数学建模)