-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"> 数据包络分析 (DEA) 被认为是评价具有多指标输入和多指标输出的系统的较为有效的方法\n", | ||
"---\n", | ||
"### 14.5.1 数据包络分析的 C<sup>2</sup>R 模型\n", | ||
"$\\boldsymbol \\alpha_i, \\boldsymbol\\beta_i$ 分别为评价对象 $i$ 的输入和输出向量,$\\boldsymbol u,\\boldsymbol v$ 分别表示输入和输出的权值向量,定义评价对象 $i$ 的效率评价指数为\n", | ||
"$$h_i=\\left(\\boldsymbol\\beta_{i}^{\\rm T}\\boldsymbol v\\right)/\\left(\\boldsymbol\\alpha_{i}^{\\rm T}\\boldsymbol u\\right)$$\n", | ||
"经过 Charnes-Cooper 变换,$\\boldsymbol\\omega=t\\boldsymbol u$,$\\boldsymbol\\mu=t\\boldsymbol v$,$t=\\dfrac{1}{\\boldsymbol\\alpha_{i_0}^{\\rm T}\\boldsymbol u}$,评价对象 $i_0$ 的数学规划模型为:\n", | ||
"$$\n", | ||
"\\begin{align*}\n", | ||
"&\\max V_{i_0}=\\boldsymbol\\beta_{i_0}^{\\rm T}\\boldsymbol\\mu\\\\[1ex]\n", | ||
"{\\rm s.t.}&\n", | ||
" \\begin{cases}\n", | ||
" \\boldsymbol\\alpha_{i}^{\\rm T}\\boldsymbol\\omega-\\boldsymbol\\beta_{i}^{\\rm T}\\boldsymbol\\mu\\geq 0,\\quad i=1,2,\\cdots,m\\\\[1ex]\n", | ||
" \\boldsymbol\\alpha_{i_0}^{\\rm T}\\boldsymbol\\omega = 1\\\\[1ex]\n", | ||
" \\boldsymbol\\omega \\geq 0,\\ \\boldsymbol\\mu\\geq 0\n", | ||
" \\end{cases}\n", | ||
"\\end{align*}\n", | ||
"$$" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### 14.5.2 数据包络分析案例\n", | ||
"可持续发展评价\n", | ||
"\n", | ||
"输入变量:政府财政收入占 GDP 的比重、环保投资占 GDP 的比重、每千人科技人员数\n", | ||
"\n", | ||
"输出变量:经济发展(用人均 GDP 表示)、环境发展(用城市环境质量指数表示)\n", | ||
"\n", | ||
"目的:评价哪几年的发展是相对有效的;通过观察一段时间内的发展情况,判断可持续发展程度" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"第 1 个决策单元最优值: 0.2902\n", | ||
"最优解: [0. 1.5385 0. ] [0.0001 0. ]\n", | ||
"\n", | ||
"第 2 个决策单元最优值: 0.2854\n", | ||
"最优解: [0. 0.8997 0.0109] [0.0001 0. ]\n", | ||
"\n", | ||
"第 3 个决策单元最优值: 0.2968\n", | ||
"最优解: [0. 0.9029 0.011 ] [0.0001 0. ]\n", | ||
"\n", | ||
"第 4 个决策单元最优值: 0.3425\n", | ||
"最优解: [0. 0.8682 0.0106] [0.0001 0. ]\n", | ||
"\n", | ||
"第 5 个决策单元最优值: 0.4595\n", | ||
"最优解: [0. 1.3158 0. ] [1.000e-04 1.914e-01]\n", | ||
"\n", | ||
"第 6 个决策单元最优值: 0.7183\n", | ||
"最优解: [0. 1.4493 0. ] [0. 1.2174]\n", | ||
"\n", | ||
"第 7 个决策单元最优值: 0.9069\n", | ||
"最优解: [0. 1.6393 0. ] [1.000e-04 2.385e-01]\n", | ||
"\n", | ||
"第 8 个决策单元最优值: 1.0\n", | ||
"最优解: [0. 1.0279 0.0125] [0.0001 0. ]\n", | ||
"\n", | ||
"第 9 个决策单元最优值: 1.0\n", | ||
"最优解: [0.0281 0.8306 0. ] [0.0001 0. ]\n", | ||
"\n", | ||
"第 10 个决策单元最优值: 1.0\n", | ||
"最优解: [0. 1.1905 0. ] [0. 1.]\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import cvxpy as cp\n", | ||
"\n", | ||
"data = np.loadtxt('../../14第14章 综合评价方法/data14_5.txt')\n", | ||
"a = data[:, :3]\n", | ||
"b = data[:, 3:]\n", | ||
"n = len(a[0])\n", | ||
"m = len(b[0])\n", | ||
"omg = cp.Variable(n, nonneg=True) # omg = tu\n", | ||
"mu = cp.Variable(m, nonneg=True) # mu = tv\n", | ||
"unit_num = 10\n", | ||
"for i in range(unit_num):\n", | ||
" obj = cp.Maximize(b[i] @ mu)\n", | ||
" cons = [\n", | ||
" a @ omg - b @ mu >= 0,\n", | ||
" a[i] @ omg == 1,\n", | ||
" ]\n", | ||
" prob = cp.Problem(obj, cons)\n", | ||
" prob.solve(solver='GUROBI')\n", | ||
" print(f\"第 {i+1} 个决策单元最优值:\", np.round(prob.value, 4))\n", | ||
" print(\"最优解:\", np.round(omg.value, 4), np.round(mu.value, 4))\n", | ||
" print()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.9.12 ('mamo')", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.12" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "bc4866e053c759d6a7b6c75a6ee7f30413af3cb1408278924a32b7c27fdde7d0" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters