An electronic algorithm to find the optimal solution for the travelling salesman problem

Similar documents
Smart Bolometer: Toward Monolithic Bolometer with Smart Functions

A new simple recursive algorithm for finding prime numbers using Rosser s theorem

Easter bracelets for years

approximation results for the Traveling Salesman and related Problems

Methylation-associated PHOX2B gene silencing is a rare event in human neuroblastoma.

On size, radius and minimum degree

A Simple Proof of P versus NP

Can we reduce health inequalities? An analysis of the English strategy ( )

Case report on the article Water nanoelectrolysis: A simple model, Journal of Applied Physics (2017) 122,

Dispersion relation results for VCS at JLab

On the longest path in a recursively partitionable graph

Evolution of the cooperation and consequences of a decrease in plant diversity on the root symbiont diversity

Vibro-acoustic simulation of a car window

A new approach of the concept of prime number

L institution sportive : rêve et illusion

Passerelle entre les arts : la sculpture sonore

On path partitions of the divisor graph

b-chromatic number of cacti

A Context free language associated with interval maps

Thomas Lugand. To cite this version: HAL Id: tel

From Unstructured 3D Point Clouds to Structured Knowledge - A Semantics Approach

Completeness of the Tree System for Propositional Classical Logic

Towards an active anechoic room

Hook lengths and shifted parts of partitions

Numerical Exploration of the Compacted Associated Stirling Numbers

Trajectory Optimization for Differential Flat Systems

The sound power output of a monopole source in a cylindrical pipe containing area discontinuities

Differential approximation results for the Steiner tree problem

Climbing discrepancy search for flowshop and jobshop scheduling with time-lags

Analysis of Boyer and Moore s MJRTY algorithm

Soundness of the System of Semantic Trees for Classical Logic based on Fitting and Smullyan

Multiple sensor fault detection in heat exchanger system

Full-order observers for linear systems with unknown inputs

Exact Comparison of Quadratic Irrationals

On Symmetric Norm Inequalities And Hermitian Block-Matrices

Antipodal radiation pattern of a patch antenna combined with superstrate using transformation electromagnetics

A note on the acyclic 3-choosability of some planar graphs

The FLRW cosmological model revisited: relation of the local time with th e local curvature and consequences on the Heisenberg uncertainty principle

The Accelerated Euclidean Algorithm

All Associated Stirling Numbers are Arithmetical Triangles

Tropical Graph Signal Processing

STATISTICAL ENERGY ANALYSIS: CORRELATION BETWEEN DIFFUSE FIELD AND ENERGY EQUIPARTITION

A Slice Based 3-D Schur-Cohn Stability Criterion

A non-commutative algorithm for multiplying (7 7) matrices using 250 multiplications

On The Exact Solution of Newell-Whitehead-Segel Equation Using the Homotopy Perturbation Method

The Mahler measure of trinomials of height 1

MODal ENergy Analysis

RENORMALISATION ON THE PENROSE LATTICE

Unfolding the Skorohod reflection of a semimartingale

The Riemann Hypothesis Proof And The Quadrivium Theory

There are infinitely many twin primes 30n+11 and 30n+13, 30n+17 and 30n+19, 30n+29 and 30n+31

The Windy Postman Problem on Series-Parallel Graphs

Some explanations about the IWLS algorithm to fit generalized linear models

On Symmetric Norm Inequalities And Hermitian Block-Matrices

A proximal approach to the inversion of ill-conditioned matrices

Stickelberger s congruences for absolute norms of relative discriminants

Electromagnetic characterization of magnetic steel alloys with respect to the temperature

A non-linear simulator written in C for orbital spacecraft rendezvous applications.

Impulse response measurement of ultrasonic transducers

Solving the neutron slowing down equation

Simulation and measurement of loudspeaker nonlinearity with a broad-band noise excitation

The Learner s Dictionary and the Sciences:

ON THE UNIQUENESS IN THE 3D NAVIER-STOKES EQUATIONS

Checking for optimal solutions in some N P -complete problems

Basic concepts and models in continuum damage mechanics

On the link between finite differences and derivatives of polynomials

Cutwidth and degeneracy of graphs

A remark on a theorem of A. E. Ingham.

Water Vapour Effects in Mass Measurement

FORMAL TREATMENT OF RADIATION FIELD FLUCTUATIONS IN VACUUM

Optically Selected GRB Afterglows, a Real Time Analysis System at the CFHT

Fast Computation of Moore-Penrose Inverse Matrices

Theoretical calculation of the power of wind turbine or tidal turbine

Parallel Repetition of entangled games on the uniform distribution

Axiom of infinity and construction of N

Optical component modelling and circuit simulation using SERENADE suite

Lorentz force velocimetry using small-size permanent magnet systems and a multi-degree-of-freedom force/torque sensor

Exogenous input estimation in Electronic Power Steering (EPS) systems

Finite volume method for nonlinear transmission problems

Influence of network metrics in urban simulation: introducing accessibility in graph-cellular automata.

Near-Earth Asteroids Orbit Propagation with Gaia Observations

On a series of Ramanujan

Sparse multivariate factorization by mean of a few bivariate factorizations

Numerical Modeling of Eddy Current Nondestructive Evaluation of Ferromagnetic Tubes via an Integral. Equation Approach

Trench IGBT failure mechanisms evolution with temperature and gate resistance under various short-circuit conditions

Widely Linear Estimation with Complex Data

Particle-in-cell simulations of high energy electron production by intense laser pulses in underdense plasmas

Comment on: Sadi Carnot on Carnot s theorem.

Nonlocal computational methods applied to composites structures

DYNAMICAL PROPERTIES OF MONOTONE DENDRITE MAPS

Nel s category theory based differential and integral Calculus, or Did Newton know category theory?

Quasi-periodic solutions of the 2D Euler equation

Factorisation of RSA-704 with CADO-NFS

Quantum efficiency and metastable lifetime measurements in ruby ( Cr 3+ : Al2O3) via lock-in rate-window photothermal radiometry

Eddy-Current Effects in Circuit Breakers During Arc Displacement Phase

Thermodynamic form of the equation of motion for perfect fluids of grade n

The Zenith Passage of the Sun in the Plan of Brasilia

A note on the computation of the fraction of smallest denominator in between two irreducible fractions

The magnetic field diffusion equation including dynamic, hysteresis: A linear formulation of the problem

Predicting the risk of non-compliance to EMC requirements during the life-cycle

Transcription:

An electronic algorithm to find the optimal solution for the travelling salesman problem M Sghiar To cite this version: M Sghiar. An electronic algorithm to find the optimal solution for the travelling salesman problem. 2016. HAL Id: hal-01348442 https://hal.archives-ouvertes.fr/hal-01348442 Submitted on 23 Jul 2016 HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers. L archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

An electronic algorithm to find the optimal solution for the travelling salesman problem July 23, 2016 M.Sghiar msghiar21@gmail.com 9 Allée capitaine J.B. Bossu, 21240, Talant, France Tel : (France) 0033669753590 Abstract: I give here an electronic algorithm of the order O(n 3 ) which is a generalization of the atomic algorithm found in [6] and allows us to find the optimal hamiltonian cycles. If the atomic algorithm (see [6] and [5] ) was inspired by the movement of the particles in the atom, the electronic algorithm is inspired by the resistor in the electrical circuit. Keywords : Graph, Hamilton cycles, P=NP, the travelling salesman problem, TSP 1

Introduction The travelling salesman problem (TSP), which is an NP-hard problem in combinatorial optimization (see [1], [2], [3] and [4] ), important in operations research and theoretical computer science, asks the following question: Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city? In the articles [5] and [6], I was interested to find the Hamiltonian cycles in a graph - not necessarily optimal-. And inspired by the movement of the particles in the atom, I demonstrated (in [5] and [6]) the exsitence of a ploynomial algorithm of the order O(n 3 ) for finding Hamiltonian cycles in a graph. This algorithm I called Atomic algorithm (See [6]), joins other several methods to find the Hamiltonian cycles like the Monte Carlo method, Dynamic programming, or DNA computing. And to prevent memory overflow and the slow execution of the program, I suggested in [6] the use of servers: Each point x i in the graph will be considered as a server, and each server x i will communicate with each other server x j with which it is connected. And finally the server x 0 will receive and display the Hamiltonian cycles if they exist. But I found that the full of memory is caused by the fact that each server send all the list he received, hence the idea to limit the amount that will send each server, and delete as and as the list that do not serve for anything. This idea was great, since I no longer have the problem of memory overflow and the program runs faster : thus only in ten minutes, with a non- powerful computer, I was able to find a Hamiltonian cycle for thousand cities: You can test it with the below improved Feynman code. 2

And to find an optimal solution to the TSP problem, the solution to find all Hamiltonian cycles and choose the cycle that have the shortest distance would take time hugely although servers operate simultaneously. Hence the need to seek other way to find the optimal solutions. Thinking of the servers, we immediately think of antennas, microwave, frequencies... in short, we think to the field of electronics. Hence the idea: If we saw servers or nodes of the graph as a node in an electrical circuit, and the "distances" between vertices as a resistor values in a circuit, then more the resistor s value is low and more the current passes quickly, so the particle or its energy will move faster by taking the shortest route. Improved of the Feynman code that gives a Hamiltonian cycles 1 2 from scipy import * 3 import numpy as np 4 import random 5 import time 6 start = time. time () 7 8 # The Feynman code in Python: 9 # Written by sghiar July 21, 2016 at 21:25 p. m.. 10 # This code allows you to find the Hamilton cycle if it exists. 11 12 # Skip Code 13 14 # We define the Feynman function F. 15 16 def F(j, T): 17 18 l= len(t) 3

19 U=[l+1] 20 U =[0]*(l+1) 21 U[0]= T[0] -1 22 for i in range(1,l): 23 U[i+1]= T[i] 24 U[1]= j 25 return U 26 27 28 29 30 31 # We define the function R. 32 33 def R(T): 34 l= len(t) 35 U=[] 36 for i in range(l -1): 37 U.append (T[i+1]) 38 return U 39 40 41 42 # We define the distance function in a Hamiltonian cycle. 43 44 def D(T): 45 D=0.0 46 l= len(t) 47 48 for i in range(0,l -1): 49 D=D+(G[T[i]][T[i +1]]) 50 return D 51 52 53 54 # We construct the graph G : 55 56 57 58 print (" number of cities =") 4

59 60 n=input () 61 62 G=np.eye(n,n) # 63 64 65 66 for i in range(n): 67 for j in range(n): 68 G[i][j]=1 69 #G[i][j]= input () 70 #print "G[",i,"][",j,"]" 71 #G[i][j]= input () 72 #if i<=j : 73 #G[i][j]= random.randint (0,1) 74 #else : G[i][j]=G[j][i] 75 #print "G[",i,"][",j,"]=",G[i][j] 76 77 78 79 80 d={} 81 82 d [0]=[[n,0]] 83 84 85 for j in range(n): 86 if G[0][ j]!=0 and 0!=j : 87 d[j]=[[n-1,j,0]] 88 d[0]=[] 89 #print d[j] 90 else : 91 d[j]=[[0,j]] 92 #print d[j] 93 94 95 L=[] 96 H=[] 97 98 for k in range(0,n**2) : 99 5

100 if len(h)!= 0 : 101 102 print H 103 print("time :", time.time () - start) 104 break 105 106 print(k, "Time :", time.time () - start) 107 print " The program is looking for the Hamiltonien cycles..." 108 109 if k%n ==0: 110 111 for T in d[k%n] : 112 if T[0] == 0 : 113 H. append(t) 114 115 else : 116 pass 117 118 del d[0] 119 d[0]=[] 120 121 122 elif k%n!=0 and len(d[k%n]) >0: 123 l=len(d[k%n]) 124 T=d[k%n][l -1] 125 for j in range(0,n): 126 127 if T[0] <=0 or (j in R( T) and j!=0) : 128 pass 129 else : 130 if G[k%n][j]!=0 and (k%n)!=j : 131 d[j]+=[ F(j,T)] 132 else : 133 pass 134 d[k%n]. remove(t) 135 136 137 138 139 # Hamiltonians Cycles : 6

140 141 142 if len(h)!=0: 143 for elt in H: 144 145 print (" There exist the Hamiltonian cycles") 146 print( R( elt)," Is one Hamiltonien cycle, Its distance is :", D(elt) ) 147 148 else : 149 print(" No Hamiltonian cycles ") 150 151 print len( H) 152 print("time :", time.time () - start) 153 # End of code An electronic algorithm to find the optimal solution for the travelling salesman problem This algorithm is almost similar to the Feynaman algorithm (See [5] ) to a slight change near : Let G be a graph on E = {x 0,, x n 1 }, where G[x i ][x j ]= 1 or 0, and the "distance" between x i and x j is noted d ij. we can reduce to the case where d ij is a nonzero positive : d ij 0, i, j We note {d 1,, d l } = i,j{d ij }. with d i d j if i j. As we have seen in the introdution, thinking of the servers, we immediately think of antennas, microwave, frequencie... in short, we think to the field of electronics. Hence the idea: If we saw servers or nodes of the graph as a node in an electrical circuit, and the "distances" between vertices as a resistor 7

values in a circuit, then more the resistor s value is low and more the current passes quickly, so the particle or its energy will move faster by taking the shortest route. And there is a link between time and the "distance" : t ij = 1 υ ij d ij Where υ ij is the speed of the electons in the electrical circuit. Where ω ij is the frequency. ω ij = υ ij 1 d ij Otherwise seen :The server i communicate with the server j with the frequency ω ij. Time progresses, the server x 0 sends the energy to other servers, the other servers will send it in turn to others. But as the exchange between two servers x i and x j occurs at a frequency ω ij : To a factor, let υ ij = 1. We shall have : and t ij = d ij ω ij = 1 d ij We start with the high frequencies : in other words by the smallest resistor value. We first see the smallest resistor value d s0 between x 0 and x i such as G[x 0 ][x i ] = 8

1. In the step i=1 (mod l) : x 0 will give its energy to other points x i through the resistors d s0. And as in the Feynman algorithm, we construct the Feynman vector for the point x i : E xi x F(x i ) = i. x 0 And we construct the Feynman matrix for the point x i : E xi x M(F, x 0 ) = i. x 0 In this step, those points x i will have E xi = n 1 as energy value. In the step i=2 (mod l) : Among the points x i related to x 0 we choose the minimum resistor value d s1. such that d s1 d s0 if it exist, else we choose the minimum resistor value d s1. such that d s1 d s0 Each point x i linked to a resistor with value d s1 will give its energy to other points through the resistor d s1. In the step i+1 (mod l) : We continue this process and as the energy decreases; the algorithm, as the Feynaman algorithm, will stop, and will display the Hamiltonian cycle with a shorter distance (if the Hamiltonian cycles exist). Example : 9

We can check this technique for example for the Graph G on the basis E = {a, b, c, d} with : G(x, y)=1, x, y E, and with the distances : d(a,c)=3, d(a,b)=d(a, d)=d(b,d)=1, d(b, c)=2, d(c,d)=4. We check that acbda is the first hamiltonian cycle that we find and that it have a minimal distance 7. The other cycle with the distance 8 will be found after because it do not have a minimum distance, and the cycle with the distance 9 will not be found for the same reason. NOTE : 1- The above improved Feynman algorithm indicates whether the Hamiltonian cycles exist. 2- If the Hamiltonian cycles exist, the electronic algorithm allows us to find the optimals Hamiltonian cycles. 3- The electronic algorithm is also of the order O(n 3 ) like the Feynman algorithm. 4- The electronic algorithm is a generalization of the Atomic algotithm. 5- With this way I could find by hand the optimals Hamiltonian cycles for some graphs of a small size. : See the example above. References [1] Lizhi Du. A polynomial time algorithm for hamilton cycle. IMECS, I:17 19, March 2010. Hong Kong. [2] L.Lovasz. Combinatorial problems and exercises. Noth-Holland, Amsterdam, 1979. 10

[3] D.S.Johnson M.R.Garey. Computers and intractability:a guid to the theory of np-completeness. Freeman,San Francisco, 1979. [4] R.Diestel. Graph theory. Springer, New York, 2000. [5] M. Sghiar. Algorithmes quantiques, cycles hamiltoniens et la k-coloration des graphes. Pioneer Journal of Mathematics and Mathematical Sciences, 17-Issue 1:51 69, May 2016. [6] M. Sghiar. Atomic algorithm and the servers s use to find the hamiltonian cycles. International Journal of Engineering Research and Applications (IJERA), ISSN: 2248-9622, 6-Issue 6:23 30, jun 2016. M.Sghiar msghiar21@gmail.com 9 Allée capitaine J.B. Bossu, 21240, Talant, France Tel : (France) 0033669753590 11