Improve explanations ASP and LEQ notebooks

This commit is contained in:
Gelieza K
2023-11-14 11:16:37 +01:00
parent 123053b9c7
commit 685d3db6a5
3 changed files with 130 additions and 81 deletions

View File

@@ -212,10 +212,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "a50706bc",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"sort_neighbors (generic function with 1 method)"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"function sort_neighbors(C)\n",
" n = size(C,1)\n",
@@ -230,10 +241,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "2eeecdd6",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"4×4 Matrix{Int64}:\n",
" 0 2 3 2\n",
" 2 0 4 1\n",
" 3 4 0 3\n",
" 2 1 3 0"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C = [\n",
" 0 2 3 2\n",
@@ -253,10 +279,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "6dd0288e",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"4-element Vector{Vector{Tuple{Int64, Int64}}}:\n",
" [(1, 0), (2, 2), (4, 2), (3, 3)]\n",
" [(2, 0), (4, 1), (1, 2), (3, 4)]\n",
" [(3, 0), (1, 3), (4, 3), (2, 4)]\n",
" [(4, 0), (2, 1), (1, 2), (3, 3)]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"C_sorted = sort_neighbors(C)"
]
@@ -271,12 +312,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "00608e1d",
"metadata": {
"scrolled": true
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"4-element Vector{Tuple{Int64, Int64}}:\n",
" (3, 0)\n",
" (1, 3)\n",
" (4, 3)\n",
" (2, 4)"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"city = 3\n",
"C_sorted[city]"