Applying Genetic Algorithm to the Knapsack Problem Qi Su ECE 539 Spring 2001 Course Project.

Slides:



Advertisements
Similar presentations
Algorithm Design Techniques
Advertisements

Genetic Algorithm.
CS6800 Advanced Theory of Computation
Exact and heuristics algorithms
Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm
Spie98-1 Evolutionary Algorithms, Simulated Annealing, and Tabu Search: A Comparative Study H. Youssef, S. M. Sait, H. Adiche
Non-Linear Problems General approach. Non-linear Optimization Many objective functions, tend to be non-linear. Design problems for which the objective.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Data Mining CS 341, Spring 2007 Genetic Algorithm.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Chapter 10: Algorithm Design Techniques
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Artificial Intelligence Genetic Algorithms and Applications of Genetic Algorithms in Compilers Prasad A. Kulkarni.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Genetic Algorithms Nehaya Tayseer 1.Introduction What is a Genetic algorithm? A search technique used in computer science to find approximate solutions.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Brandon Andrews.  What are genetic algorithms?  3 steps  Applications to Bioinformatics.
Genetic Algorithm.
Evolutionary Intelligence
© Negnevitsky, Pearson Education, CSC 4510 – Machine Learning Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
An Introduction to Genetic Algorithm (GA) By: Dola Pathak For: STAT 992:Computational Statistics SPRING
Intro. ANN & Fuzzy Systems Lecture 36 GENETIC ALGORITHM (1)
Genetic Algorithms by using MapReduce
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
HOW TO MAKE A TIMETABLE USING GENETIC ALGORITHMS Introduction with an example.
More on Heuristics Genetic Algorithms (GA) Terminology Chromosome –candidate solution - {x 1, x 2,...., x n } Gene –variable - x j Allele –numerical.
The Generational Control Model This is the control model that is traditionally used by GP systems. There are a distinct number of generations performed.
Genetic Algorithms K.Ganesh Reasearch Scholar, Ph.D., Industrial Management Division, Humanities and Social Sciences Department, Indian Institute of Technology.
Genetic Algorithms Siddhartha K. Shakya School of Computing. The Robert Gordon University Aberdeen, UK
Optimal Placement of Wind Turbines Using Genetic Algorithms
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
DYNAMIC FACILITY LAYOUT : GENETIC ALGORITHM BASED MODEL
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
Genetic Algorithms CSCI-2300 Introduction to Algorithms
 Genetic Algorithms  A class of evolutionary algorithms  Efficiently solves optimization tasks  Potential Applications in many fields  Challenges.
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
ECE 103 Engineering Programming Chapter 52 Generic Algorithm Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
Evolutionary Algorithms K. Ganesh Research Scholar, Ph.D., Industrial Management Division, Humanities and Social Sciences Department, Indian Institute.
Chapter 12 FUSION OF FUZZY SYSTEM AND GENETIC ALGORITHMS Chi-Yuan Yeh.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
Genetic Algorithms. The Basic Genetic Algorithm 1.[Start] Generate random population of n chromosomes (suitable solutions for the problem) 2.[Fitness]
Waqas Haider Bangyal 1. Evolutionary computing algorithms are very common and used by many researchers in their research to solve the optimization problems.
Neural Networks And Its Applications By Dr. Surya Chitra.
Genetic Algorithms. Underlying Concept  Charles Darwin outlined the principle of natural selection.  Natural Selection is the process by which evolution.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Agenda  INTRODUCTION  GENETIC ALGORITHMS  GENETIC ALGORITHMS FOR EXPLORING QUERY SPACE  SYSTEM ARCHITECTURE  THE EFFECT OF DIFFERENT MUTATION RATES.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
Overview Last two weeks we looked at evolutionary algorithms.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Class Scheduling Using Constraint Satisfaction Victoria Donelson Garrett Grimsley.
EVOLUTIONARY SYSTEMS AND GENETIC ALGORITHMS NAME: AKSHITKUMAR PATEL STUDENT ID: GRAD POSITION PAPER.
Genetic Algorithms An Evolutionary Approach to Problem Solving.
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
Genetic (Evolutionary) Algorithms CEE 6410 David Rosenberg “Natural Selection or the Survival of the Fittest.” -- Charles Darwin.
Genetic Algorithm (Knapsack Problem)
Using GA’s to Solve Problems
Genetic Algorithms.
Bulgarian Academy of Sciences
Bin Packing Optimization
An evolutionary approach to solving complex problems
CS621: Artificial Intelligence
Basics of Genetic Algorithms (MidTerm – only in RED material)
Basics of Genetic Algorithms
Searching for solutions: Genetic Algorithms
Presentation transcript:

Applying Genetic Algorithm to the Knapsack Problem Qi Su ECE 539 Spring 2001 Course Project

Introduction – Knapsack Problem We have a list of positive integers a 1, …, a n, and another integer b. Find a subset a i1, …, a ik, so that a i1 +… + a ik = b. Pack Volume=b Size A1 Size A2 Size A4 Size A3 Size A5 Size A6 Can we find k objects which will fit the pack volume b perfectly? Size A7

Knapsack Problem Candidate Solutions can be represented as knapsack vectors: S=(s 1, …, s n ) where s i is 1 if a i is included in our solution set, and 0 if a i is not. Example: We are given a 1, a 2, a 3, a 4, a 5, a 6 and b. A potential solution is the subset a 1, a 2, a 4. We represent it as a knapsack vector: (1, 1, 0, 1, 0, 0)

Introduction – Genetic Algorithm Outline of the Basic Genetic Algorithm [Start] Generate random population of n chromosomes (suitable solutions for the problem) [Fitness] Evaluate the fitness f(x) of each chromosome x in the population [New population] Create a new population by repeating following steps until the new population is complete [Selection] Select two parent chromosomes from a population according to their fitness (the better fitness, the bigger chance to be selected) [Crossover] With a crossover probability cross over the parents to form a new offspring (children). If no crossover was performed, offspring is an exact copy of parents. [Mutation] With a mutation probability mutate new offspring at each locus (position in chromosome). [Accepting] Place new offspring in a new population [Replace] Use new generated population for a further run of algorithm [Test] If the end condition is satisfied, stop, and return the best solution in current population [Loop] Go to step 2

Project Overview Genetic Algorithm Approach Start with a population of (0,0,1,0,1,0,0,1,1,1) (1,1,0,0,0,1,0,0,1,0) (1,0,1,0,0,0,1,1,0,1) ….. random knapsack vectors: Compute fitness scores ….. Reproduce (1,1,0,0,0,1,0,0,1,0) (1,0,1,0,0,0,1,1,0,1) (0,0,1,0,1,0,0,1,1,1) (1,0,1,0,0,0,1,1,0,1) (1,1,0,0,0,0,1,1,0,1) (0,0,1,0,1,0,1,1,0,1) ….

Project Overview Genetic Algorithm Approach (1,1,0,0,0,0,1,1,0,1) (0,0,1,0,1,0,1,1,0,1) Random mutation (1,1,0,0,0,0,1,1,0,1) (0,0,1,0,1,1,1,1,0,1) …. Repeat reproduction and mutation process until 1.A valid solution is found 2.200,000 iterations executed

Project Overview Exhaustive Search Approach (0,0,0,0,0,0,0,0,0,1) (0,0,0,0,0,0,0,0,1,0) (0,0,0,0,0,0,0,0,1,1) (0,0,0,0,0,0,0,1,0,0) (0,0,0,0,0,0,0,1,0,1) (0,0,0,0,0,0,0,1,1,0) …. Check all possible knapsack vectors until a valid solution is found

Project Overview Backtracking Approach Knapsack set={20,30,70,50 } b=100 Iteration: Current Included Set 1{20} 2{20, 30} 3{20, 30, 70} Sum>b: backtrack: remove 70, try another choice 4{20, 30, 50} Sum==b: valid solution found.

Project Overview Random Approach (0,0,1,0,0,1,1,1,1,0) (1,1,0,1,0,0,0,0,1,0 (0,0,1,1,1,0,0,1,0,0) (0,1,1,0,1,0,0,1,0,1) (1,1,0,1,1,1,0,1,0,0) Randomly generate knapsack vectors until a valid solution is found

Results Comparison of Four Approaches in terms of Iterations

Results Comparison of Four Approaches in terms of execution time

Results Comparison of GA and Random for number of trials/200 where a valid solution wasn’t found

Results Sumary Comparison of Four Approaches  GA is a good approach to solve the knapsack problem.  GA performs better than Exhaustive search and Backtracking.  GA and Random performances may be hard to compare because our completion criteria is 1. Find valid solution ,000 iterations GA and Random perform different amount of work per iteration.

GA vs Random at Different Mutation Probabilities Compare Iterations

GA vs Random at Different Mutation Probabilities Compare Execution Time

GA vs Random at Different Mutation Probabilities Compare Number of Trials/200 where a valid solution wasn’t found

GA vs Random at Different Mutation Probabilities Summary  Iterations suggest GA better.  Execution Time suggest Random better.  Trials where solution not found suggest GA better.  Current experimental setup of 200,000 iterations as completion precludes conclusive direct comparisons between GA and Random. We should change experiment to terminate execution after a fixed amount of time.

Conclusion  Genetic algorithm is a superior approach to the traditional exhaustive search and backtracking algorithms in solving the knapsack problem.  GA always finds a valid solution faster than the two traditional approaches.  A direct comparison between the performance of GA and random solution search method is difficult in the context of this experiment.  Future works – change execution termination criteria from fixed number of iterations to fixed amount of execution time.