Local Search: Hill Climbing. When A* doesn t work AIMA 4.1. Review: Hill climbing on a surface of states. Review: Local search and optimization

Similar documents
Outline for today s lecture Informed Search Optimal informed search: A* (AIMA 3.5.2) Creating good heuristic functions Hill Climbing

Local search algorithms

Chapter 4 Heuristics & Local Search

Craiova. Dobreta. Eforie. 99 Fagaras. Giurgiu. Hirsova. Iasi. Lugoj. Mehadia. Neamt. Oradea. 97 Pitesti. Sibiu. Urziceni Vaslui.

Introduction to Genetic Algorithms

10/5/2015. Constraint Satisfaction Problems. Example: Cryptarithmetic. Example: Map-coloring. Example: Map-coloring. Constraint Satisfaction Problems

Automated Software Engineering Writing Code to Help You Write Code. Gregory Gay CSCE Computing in the Modern World October 27, 2015

Heuristics & Pattern Databases for Search Dan Weld

The Genetic Algorithm

Wire Layer Geometry Optimization using Stochastic Wire Sampling

Evolutionary Optimization for the Channel Assignment Problem in Wireless Mobile Network

Games and Adversarial Search II

LANDSCAPE SMOOTHING OF NUMERICAL PERMUTATION SPACES IN GENETIC ALGORITHMS

CPS331 Lecture: Genetic Algorithms last revised October 28, 2016

Automating a Solution for Optimum PTP Deployment

Artificial Intelligence

CS 441/541 Artificial Intelligence Fall, Homework 6: Genetic Algorithms. Due Monday Nov. 24.

Solving Sudoku with Genetic Operations that Preserve Building Blocks

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

NUMERICAL SIMULATION OF SELF-STRUCTURING ANTENNAS BASED ON A GENETIC ALGORITHM OPTIMIZATION SCHEME

Genetic Algorithms with Heuristic Knight s Tour Problem

Adaptive Hybrid Channel Assignment in Wireless Mobile Network via Genetic Algorithm

Printer Model + Genetic Algorithm = Halftone Masks

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

A Novel Approach to Solving N-Queens Problem

Accurate Fault Location in Transmission Networks Using Modeling, Simulation and Limited Field Recorded Data

SECTOR SYNTHESIS OF ANTENNA ARRAY USING GENETIC ALGORITHM

Advances in Ordered Greed

Solving and Analyzing Sudokus with Cultural Algorithms 5/30/2008. Timo Mantere & Janne Koljonen

Foundations of Artificial Intelligence

Overview. Algorithms: Simon Weber CSC173 Scheme Week 3-4 N-Queens Problem in Scheme

CS188: Section Handout 1, Uninformed Search SOLUTIONS

AN EVOLUTIONARY ALGORITHM FOR CHANNEL ASSIGNMENT PROBLEM IN WIRELESS MOBILE NETWORKS

Solving Problems by Searching

Optimization of Time of Day Plan Scheduling Using a Multi-Objective Evolutionary Algorithm

Chapter 5 OPTIMIZATION OF BOW TIE ANTENNA USING GENETIC ALGORITHM

INTEGRATED CIRCUIT CHANNEL ROUTING USING A PARETO-OPTIMAL GENETIC ALGORITHM

EVOLUTIONARY ALGORITHMS IN DESIGN

CSC 396 : Introduction to Artificial Intelligence

UMBC 671 Midterm Exam 19 October 2009

Genetic Algorithms for Optimal Channel. Assignments in Mobile Communications

A Multi-Population Parallel Genetic Algorithm for Continuous Galvanizing Line Scheduling

A Genetic Algorithm for Solving Beehive Hidato Puzzles

A Novel approach for Optimizing Cross Layer among Physical Layer and MAC Layer of Infrastructure Based Wireless Network using Genetic Algorithm

Adversary Search. Ref: Chapter 5

An intelligent Othello player combining machine learning and game specific heuristics

AI Agents for Playing Tetris

GENETIC ALGORITHM BASED SOLUTION IN PWM CONVERTER SWITCHING FOR VOLTAGE SOURCE INVERTER FEEDING AN INDUCTION MOTOR DRIVE

A Genetic Algorithm-Based Controller for Decentralized Multi-Agent Robotic Systems

CS4700 Fall 2011: Foundations of Artificial Intelligence. Homework #2

UNIVERSITY of PENNSYLVANIA CIS 391/521: Fundamentals of AI Midterm 1, Spring 2010

GENETIC ALGORITHM BASED CONGESTION MANAGEMENT BY USING OPTIMUM POWER FLOW TECHNIQUE TO INCORPORATE FACTS DEVICES IN DEREGULATED ENVIRONMENT

Optimum Coordination of Overcurrent Relays: GA Approach

Keywords- DC motor, Genetic algorithm, Crossover, Mutation, PID controller.

2. Simulated Based Evolutionary Heuristic Methodology

Parsimony II Search Algorithms

CandyCrush.ai: An AI Agent for Candy Crush

The Behavior Evolving Model and Application of Virtual Robots

Multi-user Space Time Scheduling for Wireless Systems with Multiple Antenna

Scheduling. Radek Mařík. April 28, 2015 FEE CTU, K Radek Mařík Scheduling April 28, / 48

Achieving Desirable Gameplay Objectives by Niched Evolution of Game Parameters

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

Algorithms for Genetics: Basics of Wright Fisher Model and Coalescent Theory

An Intelligent Othello Player Combining Machine Learning and Game Specific Heuristics

Optimization of Tile Sets for DNA Self- Assembly

Collaborative transmission in wireless sensor networks

A Factorial Representation of Permutations and Its Application to Flow-Shop Scheduling

Emergent Behaviour in the Frequency-Power Spectrum of Discrete Dynamic Networks

Conceptual Ship Design using MSDO Rob Wolf John Dickmann Ryan Boas Engineering Systems Division ESD.77

Lecture 10: Memetic Algorithms - I. An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved

Chapter 3 Learning in Two-Player Matrix Games

5.4 Imperfect, Real-Time Decisions

A Chaotic Genetic Algorithm for Radio Spectrum Allocation

An Evolutionary Approach to the Synthesis of Combinational Circuits

CHAPTER 5 PERFORMANCE EVALUATION OF SYMMETRIC H- BRIDGE MLI FED THREE PHASE INDUCTION MOTOR

CPS331 Lecture: Heuristic Search last revised 6/18/09

Analog to Digital Conversion

Game Theory and Randomized Algorithms

Tutorial: Constraint-Based Local Search

Inbreeding and self-fertilization

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

Digital Integrated CircuitDesign

Genealogical trees, coalescent theory, and the analysis of genetic polymorphisms

Announcements. CS 188: Artificial Intelligence Fall Today. Tree-Structured CSPs. Nearly Tree-Structured CSPs. Tree Decompositions*

E190Q Lecture 15 Autonomous Robot Navigation

Playing With Mazes. 3. Solving Mazes. David B. Suits Department of Philosophy Rochester Institute of Technology Rochester NY 14623

TJHSST Senior Research Project Evolving Motor Techniques for Artificial Life

A Retrievable Genetic Algorithm for Efficient Solving of Sudoku Puzzles Seyed Mehran Kazemi, Bahare Fatemi

Ar#ficial)Intelligence!!

Evolutionary robotics Jørgen Nordmoen

Algorithms for Data Structures: Search for Games. Phillip Smith 27/11/13

Evolutions of communication

Joint QoS Multicast Routing and Channel Assignment in Multiradio Multichannel Wireless Mesh Networks using Intelligent Computational Methods

DECISION MAKING TECHNIQUES FOR COGNITIVE RADIOS

Improving Evolutionary Algorithm Performance on Maximizing Functional Test Coverage of ASICs Using Adaptation of the Fitness Criteria

Sequential Dynamical System Game of Life

Meta-Heuristic Approach for Supporting Design-for- Disassembly towards Efficient Material Utilization

A Hybrid Evolutionary Approach for Multi Robot Path Exploration Problem

! Denver, CO! Demystifying Computing with Magic, continued

Ojas Ahuja, Kevin Black CS314H 12 October 2018

Transcription:

Outline When A* doesn t work AIMA 4.1 Local Search: Hill Climbing Escaping Local Maxima: Simulated Annealing Genetic Algorithms A few slides adapted from CS 471, UBMC and Eric Eaton (in turn, adapted from slides by Charles R. Dyer, University of Wisconsin-Madison)... CIS421/521 - Intro to AI - Fall 2017 2 Review: Local search and optimization Local search: Use single current state and move to neighboring states. Idea: start with an initial guess at a solution and incrementally improve it until it is one Advantages: Use very little memory Find often reasonable solutions in large or infinite state spaces. Useful for pure optimization problems. Find or approximate best state according to some objective function Optimal if the space to be searched is convex CIS 521 - Intro to AI - Fall 2017 3 Review: Hill climbing on a surface of states h(s): Estimate of distance from a peak (smaller is better) OR: Height Defined by evaluation function f (greater is better, unlike earlier use of f ) CIS 521 - Intro to AI - Fall 2017 4 Hill-climbing search I. While ( uphill points): Move in the direction of increasing evaluation function f II. Let s next = arg max f( s), s a successor state to the current state n s If f(n) < f(s) then move to s Otherwise halt at n Properties: Terminates when a peak is reached. Does not look ahead of the immediate neighbors of the current state. Chooses randomly among the set of best successors, if there is more than one. Doesn t backtrack, since it doesn t remember where it s been a.k.a. greedy local search "Like climbing Everest in thick fog with amnesia" CIS 521 - Intro to AI - Fall 2017 5 Hill climbing example I (minimizing h) start 4 5 8 h oop = 5 6 7 6 h oop = 4 5 4 5 8 6 7 5 h oop = 3 4 4 5 4 1 2 goal 3 4 5 h oop = 0 4 5 h oop = 1 h oop = 2 4 5 CIS 521 - Intro to AI - Fall 2017 6 1

Hill-climbing Example: n-queens n-queens problem: Put n queens on an n n board with no two queens on the same row, column, or diagonal Good heuristic: h = number of pairs of queens that are attacking each other Hill-climbing example: 8-queens A state with h=17 and the h-value for each possible successor A local minimum of h in the 8-queens state space (h=1). h=5 h=3 h=1 (for illustration) CIS 521 - Intro to AI - Fall 2017 7 h = number of pairs of queens that are attacking each other CIS 521 - Intro to AI - Fall 2017 8 Search Space features Drawbacks of hill climbing Local Maxima: peaks that aren t the highest point in the space Plateaus: a broad flat region that gives the search algorithm no direction (random walk) Ridges: dropoffs to the sides; e.g. steps to the North, East, South and West may go down, but a step to the NW may go up. CIS 521 - Intro to AI - Fall 2017 9 CIS 521 - Intro to AI - Fall 2017 10 Toy Example of a local "maximum" The Shape of an Easy Problem (Convex) start 4 1 2 3 5 1 4 2 3 1 5 4 1 2 3 7 5 6 8 CIS 521 - Intro to AI - Fall 2017 11 2 2 4 1 2 3 5 2 goal 1 2 3 4 5 0 CIS 521 - Intro to AI - Fall 2017 12 2

Gradient ascent/descent Gradient methods vs. Newton s method A reminder of Newton's method from Calculus: x i+1 x i η f '(x i) / f ''(x i) Images from http://en.wikipedia.org/wiki/gradient_descent Gradient descent procedure for finding the arg x min f(x) choose initial x 0 randomly repeat x i+1 x i η f '(x i) until the sequence x 0, x 1,, x i, x i+1 converges Step size η (eta) is small (perhaps 0.1 or 0.05) CIS 521 - Intro to AI - Fall 2017 13 Newton,s method uses 2 nd order information (the second derivative, or, curvature) to take a more direct route to the minimum. The second-order information is more expensive to compute, but converges quicker. (this and previous slide from Eric Eaton) Contour lines of a function Gradient descent (green) Newton,s method (red) Image from http://en.wikipedia.org/wiki/newton's_method_in_optimization CIS 521 - Intro to AI - Fall 2017 14 The Shape of a Harder Problem The Shape of a Yet Harder Problem CIS 521 - Intro to AI - Fall 2017 15 CIS 521 - Intro to AI - Fall 2017 16 One Remedy to Drawbacks of Hill Climbing: Random Restart In the end: Some problem spaces are great for hill climbing and others are terrible. Better: Local beam search Keep track of k states instead of one Initially: k random states Next: determine all successors of k states If any of successors is goal finished Else select k best from successors and repeat. Major difference with random-restart search Information is shared among k search threads. Can suffer from lack of diversity. Stochastic variant: choose k successors proportionally to state success. CIS 521 - Intro to AI - Fall 2017 17 CIS421/521 - Intro to AI - Fall 2017 18 3

Outline Local Search: Hill Climbing Escaping Local Maxima: Simulated Annealing Genetic Algorithms Simulated annealing (SA) Annealing: the process by which a metal cools slowly and as a result freezes into a minimum-energy crystalline structure often done by repeating reheating. Conceptually SA exploits an analogy between annealing and the search for a minimum energy E SA uses a control parameter T, which by analogy with the original application is known as the system "temperature." T starts out high and gradually decreases toward 0. CIS421/521 - Intro to AI - Fall 2017 19 CIS421/521 - Intro to AI - Fall 2017 20 Simulated annealing (SA) hill climbing BUG IN TEXT!!! AIMA Text: Switches viewpoint from hill-climbing to gradient descent Implies a good move has a very negative E But: AIMA algorithm hill-climbs (moving toward larger f ) & larger E is good on each move SA uses a random search that occasionally accepts negative E, and therefore decreases in f. Probability of accepting lower f decreases with T SA hill-climbing can avoid becoming trapped at local maxima. AIMA Simulated Annealing Algorithm function SIMULATED-ANNEALING( problem, schedule) returns a solution state input: problem, a problem schedule, a mapping from time to temperature current MAKE-NODE(problem.INITIAL-STATE) for t 1 to do T schedule(t) if T = 0 then return current next a randomly selected successor of current E next.value current.value if E > 0 then current next else current next only with probability e E /T Nice simulation on web page of travelling salesman approximations via simulated annealing: http://toddwschneider.com/posts/traveling-salesman-with-simulated-annealing-r-andshiny/ CIS421/521 - Intro to AI - Fall 2017 21 CIS421/521 - Intro to AI - Fall 2017 22 Simulated annealing (cont.) A "bad" move from A to B (f(b)<f(a)) is accepted with the probability ( f (B) f (A)) / T P(move A B ) = e At higher T, a bad move will be accepted more often As T tends to zero, this probability tends to zero, and SA becomes just hill climbing If T is lowered slowly enough, SA will find a global optimum. CIS421/521 - Intro to AI - Fall 2017 23 Applicability Discrete Problems where state changes are transforms of local parts of the configuration E.G. Travelling Salesman problem, where moves are swaps of the order of two cities visited: Pick an initial tour randomly Successors are all neighboring tours, reached by swapping adjacent cities in the original tour Search using simulated annealing.. CIS421/521 - Intro to AI - Fall 2017 24 4

Outline Local Search: Hill Climbing Escaping Local Maxima: Simulated Annealing Genetic Algorithms Genetic algorithms 1. Start with k random states (the initial population) 2. New states are generated by either 1. Sexual Reproduction : (combining) two parent states (selected proportionally to their fitness) 2. Mutation of a single state or Encoding used for the genome of an individual strongly affects the behavior of the search Similar (in some ways) to stochastic beam search CIS421/521 - Intro to AI - Fall 2017 25 CIS421/521 - Intro to AI - Fall 2017 26 Representation: Strings of genes Each chromosome represents a possible solution made up of a string of genes Each gene encodes some property of the solution There is a fitness metric on phenotypes of chromosomes Evaluation of how well a solution with that set of properties solves the problem. New generations are formed by Crossover: sexual reproduction Mutation: asexual reproduction Encoding of a Chromosome The chromosome encodes characteristics of the solution which it represents, often as a string of binary digits. Chromosome 1 1101100100110110 Chromosome 2 1101111000011110 Each set of bits represents some dimension of the solution. CIS421/521 - Intro to AI - Fall 2017 27 CIS421/521 - Intro to AI - Fall 2017 28 Example: Genetic Algorithm for Drive Train Genes for: Number of Cylinders RPM: 1 st -> 2 nd RPM 2 nd -> 3 rd RPM 3 rd -> Drive Rear end gear ratio Size of wheels A chromosome specifies a full drive train design Reproduction Reproduction by crossover selects genes from two parent chromosomes and creates two new offspring. To do this, randomly choose a crossover point (perhaps none). For child 1, everything before this point comes from the first parent and everything after from the second parent. Crossover looks like this ( is the crossover point): Chromosome 1 11001 00100110110 Chromosome 2 10011 11000011110 Offspring 1 11001 11000011110 Offspring 2 10011 00100110110 CIS421/521 - Intro to AI - Fall 2017 29 CIS421/521 - Intro to AI - Fall 2017 30 5

Mutation Mutation randomly changes genes in the new offspring. For binary encoding we can switch randomly chosen bits from 1 to 0 or from 0 to 1. Original offspring 1101111000011110 Mutated offspring 1100111000001110 The Basic Genetic Algorithm 1. Generate random population of chromosomes 2. Until the end condition is met, create a new population by repeating following steps 1. Evaluate the fitness of each chromosome 2. Select two parent chromosomes from a population, weighed by their fitness 3. With probability p c cross over the parents to form a new offspring. 4. With probability p m mutate new offspring at each position on the chromosome. 5. Place new offspring in the new population 3. Return the best solution in current population CIS421/521 - Intro to AI - Fall 2017 31 CIS421/521 - Intro to AI - Fall 2017 32 Genetic algorithms:8-queens A Genetic Algorithm Simulation www.boxcar2d.com CIS421/521 - Intro to AI - Fall 2017 33 CIS421/521 - Intro to AI - Fall 2017 34 The Chromosome Layout Best from Generations 20-46: 594.7 Strengths: Vector Angles and Magnitudes adjacent Adjacent vectors are adjacent Weakness: Wheel info (vertex, axle angles & wheel radiuses not linked to vector the wheel is associated with. CIS421/521 - Intro to AI - Fall 2017 35 CIS421/521 - Intro to AI - Fall 2017 36 6