Unit 3: Programming “Encoding and Decoding”. We can now take a simple message like, Hello and convert it in stages: Hello 73 102 109 109 112 1001001 1100110.

Slides:



Advertisements
Similar presentations
Chapter 5: Control Structures II (Repetition)
Advertisements

Crew Pairing Optimization with Genetic Algorithms
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Genetic Algorithms By: Anna Scheuler and Aaron Smittle.
 Caesar used to encrypt his messages using a very simple algorithm, which could be easily decrypted if you know the key.  He would take each letter.
Tuesday, May 14 Genetic Algorithms Handouts: Lecture Notes Question: when should there be an additional review session?
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
Non-Linear Problems General approach. Non-linear Optimization Many objective functions, tend to be non-linear. Design problems for which the objective.
1 IOE/MFG 543 Chapter 14: General purpose procedures for scheduling in practice Section 14.5: Local search – Genetic Algorithms.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Chapter 3 Encryption Algorithms & Systems (Part B)
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Christopher Dougherty EC220 - Introduction to econometrics (chapter 4) Slideshow: nonlinear regression Original citation: Dougherty, C. (2012) EC220 -
PROGRAMMING In Lesson 5. RECAP  Complete the starter activity.
Brandon Andrews.  What are genetic algorithms?  3 steps  Applications to Bioinformatics.
Genetic Algorithm.
Evolving a Sigma-Pi Network as a Network Simulator by Justin Basilico.
Soft Computing Lecture 18 Foundations of genetic algorithms (GA). Using of GA.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Solving the Concave Cost Supply Scheduling Problem Xia Wang, Univ. of Maryland Bruce Golden, Univ. of Maryland Edward Wasil, American Univ. Presented at.
Placement of Entities in Object-oriented Systems by means of a Single-objective Genetic Algorithm Margaritis Basdavanos Alexander Chatzigeorgiou University.
CS 484 – Artificial Intelligence1 Announcements Lab 3 due Tuesday, November 6 Homework 6 due Tuesday, November 6 Lab 4 due Thursday, November 8 Current.
Investigation of the Effect of Neutrality on the Evolution of Digital Circuits. Eoin O’Grady Final year Electronic and Computer Engineering Project.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
Warm-up Activity 1. How many frames are in a Pixar animated movie such as The Incredibles?
HOW TO MAKE A TIMETABLE USING GENETIC ALGORITHMS Introduction with an example.
Applying Genetic Algorithm to the Knapsack Problem Qi Su ECE 539 Spring 2001 Course Project.
An Introduction to Genetic Algorithms Lecture 2 November, 2010 Ivan Garibay
FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
1 CS161 Introduction to Computer Science Topic #9.
Introduction to Genetic Algorithms. Genetic Algorithms We’ve covered enough material that we can write programs that use genetic algorithms! –More advanced.
Genetic Algorithms CSCI-2300 Introduction to Algorithms
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
Genetic Algorithms An Example Genetic Algorithm Procedure GA{ t = 0; Initialize P(t); Evaluate P(t); While (Not Done) { Parents(t) = Select_Parents(P(t));
Genetic Algorithms. 2 Overview Introduction To Genetic Algorithms (GAs) GA Operators and Parameters Genetic Algorithms To Solve The Traveling Salesman.
Homework #2: Functions and Arrays By J. H. Wang Mar. 20, 2012.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Unit 1: Programming. Programming Classwork: 1)Create a function that calculates the hypotenuse of a right triangle. Name: hypotenuse Inputs: A, B Output:
1 Lecture 5 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
GENETIC ALGORITHM Basic Algorithm begin set time t = 0;
N- Queens Solution with Genetic Algorithm By Mohammad A. Ismael.
The Standard Genetic Algorithm Start with a “population” of “individuals” Rank these individuals according to their “fitness” Select pairs of individuals.
Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Advanced AI – Session 6 Genetic Algorithm By: H.Nematzadeh.
Computer Science We use computers, but the focus is on applied problem solving. One of my favorite videos talks about computer sciencecomputer science.
EDDIE for Investment Opportunities Forecasting Michael Kampouridis mkampo [at] essex [dot] ac [dot] uk.
Genetic Algorithm(GA)
Genetic Algorithms and Evolutionary Programming A Brief Overview.
Genetic Algorithm (Knapsack Problem)
Using GA’s to Solve Problems
Chapter 14 Genetic Algorithms.
Genetic Algorithms.
Traffic Simulator Calibration
Chapter 6: Genetic Algorithms
Artificial Intelligence (CS 370D)
Chapter 12 part 1 Sample surveys.
Math and Data Types Practice Problems
Genetic Algorithms CSCI-2300 Introduction to Algorithms
Methods and Materials (cont.)
Searching for solutions: Genetic Algorithms
Artificial Intelligence CIS 342
Basic Mr. Husch.
Presentation transcript:

Unit 3: Programming “Encoding and Decoding”

We can now take a simple message like, Hello and convert it in stages: Hello Hello But is this message really safe from your classmates? C = [ ] Knapsack Sequence But is even this message really safe from your classmates?

“Encoding and Decoding” Now let’s let genetic algorithms have a chance at it… = “Encoded Message” Someone provide me with an encoded message using your knapsack encoding…don’t give me your secret code!

“Encoding and Decoding” Two encoded messages broken GA’s: 1) “After time adrift among open stars, along tides of light and through shoals of dust, I will return to where I began.”~ Michael Leung 2) “Cody approves of the JEWS encoding system. Stop asking about the name. Happy Hanukkah everyone!”~ Justus Jackson

Perfect Solution

Imperfect Solutions

“Encoding and Decoding” Now that we have managed to both encode and decode a message using a Knapsack sequence, let’s begin work on a GA that can break a code… …even without knowing the knapsack sequence!!!

“Encoding and Decoding” What’s the first step in any GA routine? Need a reminder???

Genetic Algorithms Genetic algorithms usually consist of the following five steps: 1.Create a starting population randomly 2.Test the fitness of each member and assign selection probability 3.Reproduce 4.Test new population for threshold criteria 5.Wash, rinse and repeat…

“Encoding and Decoding” The starting population for our problem should be a set of guesses for what the Knapsack sequence might be, so we know something about the constraints. Any guess must be: Same length as the actual sequence Super increasing Randomly created

“Encoding and Decoding” Write a function called superIncreasing that will create M sets of guesses for the knapsack sequence arranged in an MxN array, where N is the length of the sequence. Input:Description: MThe number of guesses to create NLength of each knapsack sequence Output:Description: PAn MxN array of guesses for the Knapsack sequence Super Increasing – every element is greater than the sum of all previous elements Ex: [ ]

“Encoding and Decoding” [ P ] = superIncreasing( M,N ) Hint: Pick a random number between 1-5 Add this number to the superincreasing series Repeat – Sum the series – Add to the sum a random number between 1-5 – Add that new number to the series

“Encoding and Decoding” Write a function called Crossover that will take in P, an mxn array of guesses for the knapsack sequence, and output N a similar array where every two guesses have been randomly allowed to replicate by crossover at a randomly selected point. Input:Description: Parray of guessed knapsack sequences Output:Description: Narray of crossover-replicated sequences

“Encoding and Decoding” Write a function called Mutate that will take in P, an mxn array of guesses for the knapsack sequence, and output N, a similar array where a random element in each row may have been “mutated”; for our purposes mutation is adding +/-1 to an element. Input:Description: Parray of guessed knapsack sequences Output:Description: Narray of crossover-replicated sequences

“Encoding and Decoding” Let’s get to work on a fitness function that will help us to home in on a solution for the encoded message. 1)Download the function, knapsackFitness.m, from the BPI website. 2)Read through the comments and begin work on coding the steps described. A set of sample input and output data is included so that you can test your function when completed.

“Lockers” At the end of the school year, an obsessive/compulsive worker is asked to clean out N lockers, initially all closed. Each time he cleans, he leaves the door open if it was closed, or closed if it was open. The first time he cleans, he leaves all the doors open. The second time, he closes every second door. The third time he cleans, he closes every third door if it is open, or opens it if was closed. The fourth time…well this continues until he has cleaned the lockers N times. How many lockers are open if N = 4? N=6? N = 1000?

“Lockers” How many lockers are open if N = 4? N=6? N = 1000? Open Closed Open

“Slope” Write a script that will create an empty figure containing only a 8 x 8 grid (i.e. x ranges from 1 to 8, as does y). Using the ginput function, allow the user to plot two points on the grid by clicking anywhere on the grid. Calculate the slope and the distance between the two points.