Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Evolutionary Computation - Artificial Intelligence - Lecture Notes | CPSC 5185U, Study notes of Computer Science

Material Type: Notes; Class: Artificial Intelligence; Subject: Computer Science; University: Columbus State University; Term: Fall 2009;

Typology: Study notes

Pre 2010

Uploaded on 08/04/2009

koofers-user-czl-1
koofers-user-czl-1 🇺🇸

10 documents

1 / 6

Toggle sidebar

Related documents


Partial preview of the text

Download Evolutionary Computation - Artificial Intelligence - Lecture Notes | CPSC 5185U and more Study notes Computer Science in PDF only on Docsity! Chapter 7 – Evolutionary Computation In this chapter, we discuss another method of mimicking natural processes in our design of computer software. This time, we discuss evolutionary computation, of which genetic algorithms are one of the major components. There are two simple requirements for a problem to be solvable by genetic algorithms. 1) That its arguments be expressible as binary strings, and 2) One can always compare two partial solutions and determine which is better. This second requirement eliminates many of the more interesting problems. One consequence of the first requirement is that every partial solution to the problem be encoded by a binary string of the same length; denote this length by M. Consider a problem in which the solutions can be encoded as 24-bit strings. Two possible solutions would be. 111100001111000011110000, and 111111000000111111000000. Genetic algorithms function by applying two basic operations to partial solutions in order to find better partial solutions. These operations might be called mutation and crossing. The process is as follows: one applies the operation to single partial solutions or pairs of partial solutions and then evaluates the resulting partial solutions. If the newly generated partial solutions are better than the previous the new ones are kept; otherwise they are likely discarded. Genetic algorithms apply processes seen to operate well in nature: changes are made randomly and the better ones kept. Mutation Mutation refers to taking a partial solution and changing one or more bits. In common practice, only one of the bits is changed. The bit to be changed is selected randomly. The sequence 111100001111000011110000 can mutate to 111100001111010011110000. Note only one bit was changed. Crossing Crossing (the textbook calls this mating) refers to swapping parts of two partial solutions. It operates by selecting a bit number at random, splitting each of the two partial solutions at that point, and then recombining by swapping parts. Consider the following two partial solutions which are split at the indicated point. 111100001111000011110000 => 11110000111100 0011110000 111111000000111111000000 => 11111100000011 1111000000 Crossing at this point gives 11110000111100 1111000000 or 111100001111001111000000 and 11111100000011 0011110000 or 111111000000110011110000. Written on 11/28/2020 Chapter 7 Page 1 of 6 pages CPSC 5185 Introduction to Artificial Intelligence Genetic Algorithms My Way The basic process of genetic algorithms, as discussed on page 220 of the textbook, comes down to a simple process. 1) Start with a set of trial solutions, generated by some method. 2) Play with these solutions, generating new ones and evaluating them. 3) After some time, stop the process and take the best solution. We shall comment on each of the steps presented in the textbook. Rather than using the biological language favored by the textbook and most authors, we shall use the language of binary strings. The student should note that we are saying the same thing, These notes will present a problem not found in the textbook. The problem is based on a common encryption scheme, called XOR encryption. The student who did not sleep through CPSC 2105 (Computer Organization) will note that this problem can be easily solved by a very direct application of Boolean algebra, but here we shall attempt a solution by use of genetic algorithms. It is better to pick an easy problem as an example. The problem to be discussed involves cryptography. The objective of cryptography is to send messages via insecure media (such as by radio broadcast) and have the contents of the message known only to those authorized to receive the message. The sender of a message applies a cryptographic algorithm, often called a cipher to convert a message in readable form, called a plaintext into a disguised form called a ciphertext. The assumption is that the ciphertext can be decrypted, or converted to readable plaintext, only by those who are authorized to receive the message. Most ciphers operate by using a well- known cryptographic algorithm and a secret key, known to only the sender and recipient. Cryptanalysis is the study of ways to retrieve the meaning of a ciphertext without the consent of either the sender or recipient. There are various methods of cryptanalysis, some of which are less elegant than others. Two inelegant methods are stealing the key that enables one to decrypt the messages or “rubber hose cryptanalysis” involving the application of rather nasty methods of persuasion to a human who knows the key. Some of the weaker cryptographic algorithms can be easily broken by use of well-known attacks. An attach itself is an algorithm that can be used to produce the plaintext of a message given enough ciphertext. There are several classes of attacks. A known plaintext attack on a cipher occurs when the hacker attempting to crack the code has both the plaintext of a message and its enciphered form. For many of the weaker cryptographic algorithms, this attack can yield the secret key and thus allow the cryptanalyst to read all future messages. The goal of all modern cryptographic algorithms is to prevent such an attack. There is a caution to be observed here. One should not put too much trust in the security of ciphers. In a well-documented example of American cryptanalysis of Japanese diplomatic ciphers before the attach on Pearl Harbor, the Americans intercepted messages to the Japanese ambassador to the US and had translated plaintext to the US Secretary of State before the Japanese ambassador received his copy from his code room. Written on 11/28/2020 Chapter 7 Page 2 of 6 pages CPSC 5185 Introduction to Artificial Intelligence Steps 5 – 8 At each step, we use the following algorithm to generate the set of 14 potential solutions. 1) Pick the four potential solutions with the lowest score. At the start we begin with the initial four solutions that are specified. 2) Copy these four solutions into the new solution set. 3) Mutate each of these four solutions to produce a new solution. For the first mutation the point will be selected as p = 17. For others, pick a random number p, 1  p  24. 4) There are six different ways that the four numbers can be made into s 2-set: (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), and (3, 4). Use these six pairings of the four best solutions to form six additional more by crossing at the same point. For the first crossing, the point will be selected as p = 13, afterwards the value will be random. At the beginning of the first iteration, we have a set comprising 4 initially specified solutions, 4 solutions obtained by mutating these solutions, and 6 solutions obtained by crossing these specified solutions. At the beginning of any other iteration, we have a set comprising 4 best solutions from the previous iteration, 4 solutions obtained by mutating these solutions from the previous iteration, and 6 solutions obtained by crossing these solutions from the previous iteration. We then evaluate each solution and pick the four with the lowest score, because those will be closest to the desired key. If any of the potential solutions has fitness value 0, we declare it the solution and stop the iteration. If we do not have a solution, we copy the four best partial solutions for use in the next iteration and discard the rest. We then do steps 5 through 8 over again. Here is the initial set of 14 partial solutions. Some digits underlined only for clarity. First we have the initial four 111100001111000011110000 000011110000111100001111 111111000000111111000000 000000111111000000111111 The four mutations at p = 17 111100001111000001110000 000011110000111110001111 111111000000111101000000 000000111111000010111111 The six crosses (1, 2) 111100001111011100001111 (1, 3) 111100001111011111000000 (1, 4) 111100001111000000111111 (2, 3) 000011110000111111000000 (2, 4) 000011110000100000111111 (3, 4) 111111000000100000111111 Written on 11/28/2020 Chapter 7 Page 5 of 6 pages CPSC 5185 Introduction to Artificial Intelligence The results below were done with a solution set of twenty. The additional six came from the crossings above – using the fact that each crossing produces two new solutions. The first entry is the complete list of twenty solutions, each with its decimal fitness value. 111100001111000011110000 12 000011110000111100001111 12 111111000000111111000000 12 000000111111000000111111 12 111100001111000001110000 13 000011110000111110001111 11 111111000000111101000000 13 000000111111000010111111 11 111100001111011100001111 15 000011110000100011110000 9 111100001111011111000000 15 111111000000100011110000 9 111100001111000000111111 12 000000111111000011110000 12 000011110000111111000000 12 111111000000111100001111 12 000011110000100000111111 9 000000111111011100001111 15 111111000000100000111111 9 000000111111011111000000 15 This seems to go on forever. After 48 iterations, the answer appears. 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110101 0 011001100001101010110101 0 011001100001101010110101 0 011001100001101010110101 0 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 011001100001101010110111 1 The desired key is the value 0110 0110 0001 1010 1011 0101, written in hexadecimal as 0x661AB5. Written on 11/28/2020 Chapter 7 Page 6 of 6 pages
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved