diff --git a/heldAndKarp_fluff.ipynb b/heldAndKarp_fluff.ipynb index 974f593dbc0a0aa7db8fd6ccf648774efd7a3919..39a8b8c31c66c44f8fa8f8efc1babf4267005a79 100644 --- a/heldAndKarp_fluff.ipynb +++ b/heldAndKarp_fluff.ipynb @@ -9,7 +9,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -32,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -41,7 +41,7 @@ "connect_v1! (generic function with 1 method)" ] }, - "execution_count": 29, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -74,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -83,7 +83,7 @@ "adj_to_graph (generic function with 1 method)" ] }, - "execution_count": 31, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -107,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -116,7 +116,7 @@ "hk2 (generic function with 1 method)" ] }, - "execution_count": 32, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -143,7 +143,7 @@ " \n", " converge = false\n", "\n", - " while !converge && k < 10 # While not a tour\n", + " while !converge && k < 100 # While not a tour\n", " k+=1\n", " print(z, \" \")\n", " \n", @@ -177,7 +177,7 @@ " end\n", " connect_v1!(X, W1, n)\n", " \n", - " one_tree = adj_to_graph(X)\n", + " one_tree = adj_to_graph(X, n)\n", " \n", " z = 2*sum(λ[2:n]) + sum((W[u,v] - λ[u] - λ[v])*X[u,v] for u ∈ 1:n for v ∈ 1:u)\n", " \n", @@ -201,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -216,7 +216,7 @@ " 3 15 15 3 4 0" ] }, - "execution_count": 33, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -234,7 +234,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 12, "metadata": { "tags": [] }, @@ -243,21 +243,19 @@ "name": "stdout", "output_type": "stream", "text": [ - "-1 LightGraphs.SimpleGraphs.SimpleEdge{Int64}[Edge 1 => 4, Edge 3 => 5, Edge 4 => 5, Edge 1 => 2]\n" + "-1 LightGraphs.SimpleGraphs.SimpleEdge{Int64}[Edge 1 => 4, Edge 3 => 5, Edge 4 => 5, Edge 1 => 2]\n", + "sommes des poids des arêtes :25.0\n" ] }, { - "ename": "LoadError", - "evalue": "MethodError: no method matching adj_to_graph(::BitArray{2})\nClosest candidates are:\n adj_to_graph(::Any, !Matched::Any) at In[31]:1", - "output_type": "error", - "traceback": [ - "MethodError: no method matching adj_to_graph(::BitArray{2})\nClosest candidates are:\n adj_to_graph(::Any, !Matched::Any) at In[31]:1", - "", - "Stacktrace:", - " [1] hk2(::Array{Int64,2}) at ./In[32]:56", - " [2] top-level scope at In[34]:1", - " [3] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091" - ] + "data": { + "text/plain": [ + "(Bool[0 1 … 0 1; 1 0 … 1 0; … ; 0 1 … 0 1; 1 0 … 1 0], [0.0, -2.0, 2.0, 2.0, 0.0, -2.0])" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ @@ -266,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -281,7 +279,7 @@ " 1 0 0 1 1 0" ] }, - "execution_count": 27, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -292,22 +290,22 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "6-element Array{Float64,1}:\n", - " 0.0\n", - " 0.0\n", - " 0.0\n", - " 0.0\n", - " 0.0\n", - " 0.0" + " 0.0\n", + " -2.0\n", + " 2.0\n", + " 2.0\n", + " 0.0\n", + " -2.0" ] }, - "execution_count": 28, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" }