Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Distributed Genetic
Algorithms
Prof: Paul Schragger
Abdo Achkar
Fall 2005
Villanova University
Problem Definition
Distributed genetic algorithms to simulate the
evolution of an animal.
General use case:
Approximation problems that have no algorithmic
solution
We might want to use [distributed] genetic
algorithms if
The problem needs a lot of computation
We want to avoid local minima/maxima
Genetic Algorithms
Program that optimizes a set of bit Strings
that we name “Chromosome” according to a
function that we call “fitness function”.
The bit Strings will
Reproduce
Be mutilated
Be selected: the fittest will remain for the following
generation
Object Oriented Design
Has-a
Has-a
IpList
NetNode
Has-a
Population
Extends Thread
Chromosome
Has-a
Has-a
Has-a
DatagramListener
Has-a
ChromosomeLeg
DgramListenerWorker
Extends Thread
Has-a
PacketHandler
DatagramBroadcaster
The Work Flow
Solve Instance
Start
BroadCast
Anybody here
a
n
d
Wait for reply
(DgramListener)
DgramListenerWorker
Received
Packets
PacketHandler
MsgParser
Associated
event with
the packet
Note: this event can be a
broadcast or a new listen
Inside the
DgramPacketHandler
private void doCommand(int command,DatagramPacket p)
{
switch(command) {
case MsgClass.WAIT_FOR_DATA:
…
case MsgClass.MSG_ANYBODY_HERE:
…
case MsgClass.MSG_SERVER_CONNECT_TIMEOUT:
…
case MsgClass.MSG_SERVER_IS_DOWN:
…
case MsgClass.MSG_YOU_ARE_THE_SERVER:
…
}
}
The Voting Algorithm
2
1
event
Client detects server’s
time out
Wait for Server’s Data
3
3
Broadcasts the server failed
Listen for votes
4
End of Vote
Vote Received
Msg:vote
5
Vote
7
Wait for votes
result
6
5
Add to IP list
8
Act Accordingly
Send “you are the server”
To the highest IP
Anybody here
The Program Flow
Listen
Timeout
Data
Received
We Serve
Update Population
Listen
We are Clients
Anybody here
Vote call received
Listen
Data
Send Data
Timeout
Received
Data
Received
Vote
Broadcast: vote
Vote
Received
Add IP to list
Vote call received
Listen
Listen
Msg:You are the server
Timeout
Tell the server
We are servers
Broadcast
We are server
References
Artificial Intelligence, Negnevitsky.
Distributed Computing, Attiya and Welch
Distributed Application Programming in C++,
Maddox
The Essential Guide to Networking, Keogh
Network Management, Subramanian
Java How to Program, Deitel and Deitel
Distributed Systems, Tanenbaum and Van Steen
C++ In Action, Melweski
Inertie d’un système, M Devel, Université de
Franche-Comté