v - 大同大學

Hopfield Neural Networks
for Optimization
虞台文
大同大學資工所
智慧型多媒體研究室
Content




Introduction
A Simple Example  Race Traffic Problem
Example  A/D Converter
Example  Traveling Salesperson Problem
Hopfield Neural Networks
for Optimization
Introduction
大同大學資工所
智慧型多媒體研究室
wii  0
wij  w ji
Energy Function of a Hopfield NN
n
n
n
E   12  wij vi v j   Ii vi  K
i 1 j 1
Interaction btw neurons
i 1
Interaction
constant
to the external
Running a Hopfield NN asynchronously, its energy is
monotonically non-increasing.
n
n
n
E   12  wij vi v j   Ii vi  K
i 1 j 1
i 1
Solving Optimization Problems Using
Hopfield NNs




Reformulating the cost of a problem in the
form of energy function of a Hopfield NN.
Build a Hopfield NN based on such an
energy function.
Running the NN asynchronously until the
NN settles down.
Read the answer reported by the NN.
Hopfield Neural Networks
for Optimization
A Simple Example
Race Traffic Problem
大同大學資工所
智慧型多媒體研究室
n
n
n
E   12  wij vi v j   Ii vi  K
i 1 j 1
i 1
A Simple Hopfield NN
I2
I1
1
w12  w21
2
E  v1w12v2  I1v1  I 2v2  K
E  v1w12v2  I1v1  I 2v2  K
The Race Traffic Problem
+1
1
+1
1
v1
E  (v1  v2 )
1
2
2
 v  v1v2  v
1
2
2
1
 v1v2  1
1
2
2
2
w12  w21  1
I1  I 2  0
v2
+1
1
v1
+1
1
The Race Traffic Problem
0
0
1
1
E  (v1  v2 )
1
2
2
 v  v1v2  v
1
2
2
1
 v1v2  1
2
1
2
2
2
w12  w21  1
I1  I 2  0
v2
+1
1
v1
+1
1
The Race Traffic Problem
0
0
1
1
1
2
1
1
Stable State
v2
+1
1
v1
+1
1
The Race Traffic Problem
0
0
1
1
1
2
1
1
Stable State
v2
+1
1
v1
+1
1
The Race Traffic Problem
0
0
1
1
1
2
1
v2
Hopfield Neural Networks
for Optimization
Example
A/D Converter
大同大學資工所
智慧型多媒體研究室
Reference
Tank, D.W., and Hopfield, J.J., “Simple "neural" optimization
networks: An A/D converter, signal decision circuit and a linear
programming circuit,” IEEE Transactions on Circuits and
Systems, Vol. CAS-33 (1986) 533-541.
A/D Converter
I
Analog
Using Unipolar
Neurons
A/D
v0
v1
v2
v3
20
21
22
23
1

i
E   I   2 vi 
2
i 0

3
2
A/D Converter
3
1 3 i 2 1 3 3 i
j
E   (2 vi )   (2 vi )(2 v j )   I (2i vi )
2 i 0
2 i 0 j 0
i 0
j i
3
1 3 2i
1 3 3
i j
  2 vi   vi 2 v j   (2i I )vi
2 i 0
2 i 0 j 0
i 0
j i
3
1 3 3
i j
  vi 2 v j   (22i 1  2i I )vi
2 i 0 j 0
i 0
j i
Using Unipolar
Neurons
1

i
E   I   2 vi 
2
i 0

3
2
3
3
3
E   12  wij vi v j   I i vi  K
i 0 j 0
j i
i 0
A/D Converter
3
1 3 i 2 1 3 3 i
j
E   (2 vi )   (2 vi )(2 v j )   I (2i vi )
2 i 0
2 i 0 j 0
i 0
j i
3
1 3 2i
1 3 3
i j
  2 vi   vi 2 v j   (2i I )vi
2 i 0
2 i 0 j 0
i 0
j i
3
1 3 3
i j
  vi 2 v j   (22i 1  2i I )vi
2 i 0 j 0
i 0
j i
wij  2i  j
I i  22i 1  2i I
0
I0
1
I1
2
I2
3
ji
v0
v1
v2
v3
I3
Hopfield Neural Networks
for Optimization
Example
Traveling Salesperson
Problem
大同大學資工所
智慧型多媒體研究室
Reference
J. J. Hopfield and D. W. Tank, “Neural” computation of
decisions in optimization problems, ”
Biological Cybernetics, Vol. 52, pp.141-152, 1985.
Traveling Salesperson Problem
Traveling Salesperson Problem
Given n cities with
distances dij, what is
the shortest tour?
Traveling Salesperson Problem
2
3
4
1
5
9
11
10
6
8
7
Traveling Salesperson Problem
2
Distance Matrix
3
4
1
5
9
11
10
6
8
7
Find a minimum cost
Hamiltonian Cycle.
1
2
1   d12
2 d 21 
3  d 31 d 32


 
n d n1 d n 2
3

n
d13  d1n 
d 23  d 2 n 
  d 3n 

   
d n 3   
Search Space
2
3
4
1
5
9
11
10
6
Assume we are given a fully
connection graph with n
vertices and symmetric
costs (dij=dji).
The size of search space is
8
7
Find a minimum cost
Hamiltonian Cycle.
n!
2n
Problem Representation Using NNs
Time
1
1
2
1
2
City
4
3
5
3
4
5
2
3
4
5
Problem Representation Using NNs
The salesperson reaches
city 5 at time 3.
1
2
1
2
City
4
3
5
3
4
5
Time
1
2
3
4
5
Goal: Find a minimum cost
Hamiltonian Cycle.
Problem Representation Using NNs
Time
1
1
2
1
2
City
4
3
5
3
4
5
2
3
4
5
Goal: Find a minimum cost
Hamiltonian Cycle.
The Hamiltonian Constraint
Time
Each1 row and2 column
can have only one
neuron “on”.
4
 For3a n-city problem, n
neurons will be
on.
5
1
2
City

1
3
4
5
2
3
4
5
Goal: Find a minimum cost
Hamiltonian Cycle.
Cost Minimization
Time
2
The 1total distance
of
the valid tour have to
be very low.
4
The 3summation of
these dij’s is very low.
5
2
1
3
5
d35
d54
5
d25
d42
3
4
4
d51
2
City

1
Indices of Neurons
1
2
City
vxi
1
3
x
4
5
2
Time
i
3
4
5
Time
1
2
1
City
5
5
d25
d42
3
4
4
d51
2
Energy Function
3
d35
d54
ETSP  EH  Ed
Hamiltonian-Cycle
Satisfaction
Cost Minimization
Time
1
2
1
City
4
d51
2
Energy Function
3
d25
d42
3
d35
4
5
d54
5
ETSP  EH  Ed
λ3 
λ1
λ2

EH   vxi vxj   vxi v yi    vxi  n 
2 x 1 i 1 j 1
2 i 1 x 1 y 1
2  x 1 i 1

n
n
n
Each row
one or zero
neuron ‘on’
n
n
n
Each column
one or zero
neuron ‘on’
n
n
n neurons ‘on’
2
Time
1
2
1
City
4
d51
2
Energy Function
3
d25
d42
3
d35
4
5
d54
5
ETSP  EH  Ed
λ3 
λ1
λ2

EH   vxi vxj   vxi v yi    vxi  n 
2 x 1 i 1 j 1
2 i 1 x 1 y 1
2  x 1 i 1

λ4
Ed 
2
n
n
n
n
n
n
 v
i 1 x 1 y 1
y x
n
xi
n
n
d xy (v y ,i 1  v y ,i 1 )
Total distance of the tour
n
n
2
Time
1
2
1
City
5
5
d25
d42
3
4
4
d51
2
Energy Function
3
d35
d54
ETSP  EH  Ed
λ1 n n n
  vxi vxj
2 x 1 i 1 j 1
λ1  λ2  λ3  λ4  0
j i
λ2

2

n
n
n
 v
i 1 x 1 y 1
y x
v
xi yi
λ3 

v

n

xi


2  x 1 i 1

λ4

2
n
n
n
n
n
 v
i 1 x 1 y 1
y x
xi
2
d xy (v y ,i 1  v y ,i 1 )
Time
1
2
1
City
d35
4
E2 D
λ1
  vxi vxj
2 x 1 i 1 j 1
n
n
n
Mapping
j i
λ2

2
n
n
n
 v
i 1 x 1 y 1
y x
λ 

 3   vxi  n 
2  x 1 i 1

n
λ4

2
n
n
n
n
 v
i 1 x 1 y 1
y x
xi
d25
d54
1 n n n n
   vxi wxi , yj v yj
2 x 1 i 1 y 1 j 1
y  x j i
n
n
  I xi vxi
x 1 i 1
v
xi yi
wxi,yjEnergy
  λ1δfunction
xy (1  δij ) of a
2
d xy (v y ,i 1  v y ,i 1 )
5
d42
3
5
ETSP  EH  Ed
4
d51
2
Build NN for TSP
3
2-D neural
λ δ (1 network
δ )
2 ij
xy
 λ3 (1  δij )(1  δxy )
 λ4 d xy (δi , j 1  δi , j 1 )
I xi  λ3n
Analog Hopfield NN for 10-City TSP
Analog Hopfield NN for 10-City TSP
The shortest path
Analog Hopfield NN for 10-City TSP
The shortest path
Analog Hopfield NN for 30-City TSP
Analog Hopfield NN for 30-City TSP