90 likes | 206 Views
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
E N D
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 IpList NetNode Has-a Has-a Has-a Population Chromosome Extends Thread Has-a Has-a DatagramListener DatagramBroadcaster Has-a Has-a ChromosomeLeg DgramListenerWorker Extends Thread Has-a PacketHandler
The Work Flow Solve Instance Start and BroadCast Anybody here Wait for reply (DgramListener) DgramListenerWorker Associated event with the packet Received Packets PacketHandler MsgParser 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 Client detects server’s time out 1 event Wait for Server’s Data 3 3 Broadcasts the server failed Listen for votes 4 End of Vote Vote Received 6 Msg:vote 5 Add to IP list Send “you are the server” To the highest IP 5 7 Vote Wait for votes result 8 Act Accordingly
The Program Flow Anybody here Listen Timeout Data Received We Serve We are Clients Update Population Listen Vote call received Data Received Anybody here Listen Send Data Data Received Timeout Vote call received Vote Broadcast: vote Listen Vote Received Listen Msg:You are the server Add IP to list Timeout We are servers Tell the server 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é