Skip to content

Commit

Permalink
update: transportation problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rodion committed Apr 8, 2019
1 parent b1ffa7a commit cb2810c
Showing 1 changed file with 2 additions and 49 deletions.
51 changes: 2 additions & 49 deletions transportation_problem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
" supply_copy[i] -= v\n",
" demand_copy[j] -= v\n",
" bfs.append(((i, j), v))\n",
" if supply_copy[i] == 0 and i < len(supply_copy) - 1:\n",
" if supply_copy[i] == 0 and i < len(supply) - 1:\n",
" i += 1\n",
" elif demand_copy[j] == 0 and j < len(demand_copy) - 1:\n",
" elif demand_copy[j] == 0 and j < len(demand) - 1:\n",
" j += 1\n",
" return bfs"
]
Expand All @@ -155,13 +155,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1 0\n",
"1 1\n",
"1 2\n",
"2 2\n",
"2 3\n",
"2 3\n",
"[((0, 0), 30), ((1, 0), 10), ((1, 1), 30), ((1, 2), 30), ((2, 2), 10), ((2, 3), 40)]\n",
"[((0, 0), 30), ((1, 0), 10), ((1, 1), 30), ((1, 2), 30), ((2, 2), 10), ((2, 3), 40)]\n"
]
}
Expand Down Expand Up @@ -362,13 +355,6 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1 0\n",
"1 1\n",
"1 2\n",
"2 2\n",
"2 3\n",
"2 3\n",
"[((0, 0), 30), ((1, 0), 10), ((1, 1), 30), ((1, 2), 30), ((2, 2), 10), ((2, 3), 40)]\n",
"[[30. 0. 0. 0.]\n",
" [ 0. 0. 30. 40.]\n",
" [10. 30. 10. 0.]]\n",
Expand All @@ -394,19 +380,6 @@
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 0\n",
"1 1\n",
"2 1\n",
"2 2\n",
"3 2\n",
"3 2\n",
"[((0, 0), 10), ((1, 0), 65), ((1, 1), 15), ((2, 1), 5), ((2, 2), 10), ((3, 2), 40)]\n"
]
},
{
"data": {
"text/plain": [
Expand Down Expand Up @@ -439,19 +412,6 @@
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1 0\n",
"2 0\n",
"3 0\n",
"3 1\n",
"3 2\n",
"3 2\n",
"[((0, 0), 0), ((1, 0), 0), ((2, 0), 0), ((3, 0), 0), ((3, 1), 0), ((3, 2), 0)]\n"
]
},
{
"data": {
"text/plain": [
Expand All @@ -478,13 +438,6 @@
" ]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit cb2810c

Please sign in to comment.