Search CSE391 -2005 1 When you can’t use A* Hill-climbing Simulated Annealing Other strategies 2 person- games.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Local Search Algorithms
LOCAL SEARCH AND CONTINUOUS SEARCH. Local search algorithms  In many optimization problems, the path to the goal is irrelevant ; the goal state itself.
For Friday Finish chapter 5 Program 1, Milestone 1 due.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
CSC344: AI for Games Lecture 5 Advanced heuristic search Patrick Olivier
Local search algorithms
Local search algorithms
Game Playing CSC361 AI CSC361: Game Playing.
02 -1 Lecture 02 Heuristic Search Topics –Basics –Hill Climbing –Simulated Annealing –Best First Search –Genetic Algorithms –Game Search.
CS 460 Spring 2011 Lecture 3 Heuristic Search / Local Search.
CS 4700: Foundations of Artificial Intelligence
Trading optimality for speed…
Review Best-first search uses an evaluation function f(n) to select the next node for expansion. Greedy best-first search uses f(n) = h(n). Greedy best.
CSC344: AI for Games Lecture 4: Informed search
Adversarial Search and Game Playing Examples. Game Tree MAX’s play  MIN’s play  Terminal state (win for MAX)  Here, symmetries have been used to reduce.
Adversarial Search: Game Playing Reading: Chess paper.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
Optimization via Search CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 4 Adapted from slides of Yoonsuck Choe.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
Local Search and Optimization
1 Local search and optimization Local search= use single current state and move to neighboring states. Advantages: –Use very little memory –Find often.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati In which we see how information.
Local Search Algorithms This lecture topic Chapter Next lecture topic Chapter 5 (Please read lecture topic material before and after each lecture.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
CS 484 – Artificial Intelligence1 Announcements Homework 2 due today Lab 1 due Thursday, 9/20 Homework 3 has been posted Autumn – Current Event Tuesday.
Informed search algorithms
Informed search algorithms
1 Shanghai Jiao Tong University Informed Search and Exploration.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Iterative Improvement Algorithm 2012/03/20. Outline Local Search Algorithms Hill-Climbing Search Simulated Annealing Search Local Beam Search Genetic.
Artificial Intelligence for Games Online and local search
Local Search Algorithms
Local Search Pat Riddle 2012 Semester 2 Patricia J Riddle Adapted from slides by Stuart Russell,
For Friday Finish chapter 6 Program 1, Milestone 1 due.
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
Local Search and Optimization Presented by Collin Kanaley.
When A* doesn’t work CIS 391 – Intro to Artificial Intelligence A few slides adapted from CS 471, Fall 2004, UBMC (which were adapted from notes by Charles.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Local search algorithms In many optimization problems, the state space is the space of all possible complete solutions We have an objective function that.
Informed search algorithms Chapter 4 Slides derived in part from converted to powerpoint by Min-Yen.
Announcement "A note taker is being recruited for this class. No extra time outside of class is required. If you take clear, well-organized notes, this.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Local Search. Systematic versus local search u Systematic search  Breadth-first, depth-first, IDDFS, A*, IDA*, etc  Keep one or more paths in memory.
Chapter 4 (Section 4.3, …) 2 nd Edition or Chapter 4 (3 rd Edition) Local Search and Optimization.
Lecture 6 – Local Search Dr. Muhammad Adnan Hashmi 1 24 February 2016.
Local Search Algorithms and Optimization Problems
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Department of Computer Science Lecture 5: Local Search
Local Search Algorithms CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Constraints Satisfaction Edmondo Trentin, DIISM. Constraint Satisfaction Problems: Local Search In many optimization problems, the path to the goal is.
Local search algorithms In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution State space = set of "complete"
Games: Expectimax MAX MIN MAX Prune if α ≥ β. Games: Expectimax MAX MIN MAX
Optimization via Search
Department of Computer Science
Informed Search Chapter 4 (b)
Local Search Algorithms
Artificial Intelligence (CS 370D)
Local Search and Optimization
Informed Search Chapter 4 (b)
Informed search algorithms
More on Search: A* and Optimization
Artificial Intelligence
More on HW 2 (due Jan 26) Again, it must be in Python 2.7.
More on HW 2 (due Jan 26) Again, it must be in Python 2.7.
First Exam 18/10/2010.
Local Search Algorithms
Presentation transcript:

Search CSE When you can’t use A* Hill-climbing Simulated Annealing Other strategies 2 person- games

Search CSE Hill-climbing Just keep current state Generate successors If best successor is better than current state, move to it. Otherwise, you’re stuck – local maxima.

Search CSE N-queens NxN board N queens Place the queens on the board so that all queens are safe. No queen is on the same row, column or diagonal as another queen.

Search CSE queens Initial state: no queens Successor function: add a queen to any empty square Goal: are all queens safe? 64 x 63 x 62 ….= 3 x possible sequences

Search CSE queens – almost a solution, 4 steps

Search CSE queens Initial state: no queens Successor function: add a queen to a safe empty square Goal: are all queens safe? 2057 possible sequences

Search CSE Applying hill climbing to 8 queens Initial state: 8 queens placed randomly Successor function: move queen in its column (8 x 7 = 56 successors) 8 8 Goal state: all queens are safe Works 14% of the time, gets stuck 86%

Search CSE queens – a random start state

Search CSE queens – h = # of pairs of queens attacking each other

Search CSE queens – almost a solution, 4 steps Almost a solution - 5 moves

Search CSE Applying hill climbing to 8 queens Initial state: 8 queens placed randomly Successor function: move queen in its column (8 x 7 = 56 successors) 8 8 or allow up to 100 sideways moves… Goal state: all queens are safe Works 94% of the time, gets stuck 6%

Search CSE Hill-climbing Local maxima: a peak which is higher than each of its neighbors but lower than the global maximum. Ridge: a sequence of local maxima Plateau: function value is flat –Flat local maxima, no uphill exit –Shoulder, can find uphill path

Search CSE Hill-climbing Just keep current state Generate successors If best successor is better than current state, move to it. Otherwise, you’re stuck – local maxima. Random restart.

Search CSE Simulated annealing Modeled after “annealing” in metallurgy –Heated metal cools slowly so that crystals can form Closer to a purely random walk Starts by picking random moves (high temp) As the “temperature” cools, shifts to preferring “best” moves. Applications: –VLSI layouts, factory scheduling, airline scheduling

Search CSE Other strategies Local beam search –Same as hill-climbing, but keeps k nodes in memory instead of just 1. Genetic algorithms –Generate a successor by combining two parent states, instead of just modifying one. –Apply random mutations –Evaluate with “fitness function”

Search CSE person games – more complex Opponent introduces non-determinism –Minimax, alpha-beta Space and time limitations can introduce inaccessibility

Search CSE Problem Formulation Initial state Operators Terminal test (goal state) Utility function (payoff) –Minimax: back up from terminal state, high values for max, low values for min

Search CSE Tic-Tac-Toe Initial state –Representation? matrix Successor functions –Placing x’s and o’s Goal states –Explicit Utility function - Minimax x o x o x x o x x x x o

Search CSE Straightforward Mimimax Utility function (payoff) –Minimax: back up from terminal state, high values for max, low values for min

Search CSE x x x o x x o x x o x x o x o x x o x o x x o x x o x o x o x o x x o x o x x o x o x o x x o x x x o x x o o x x o x o x x o x o Tic-Tac-Toe x x o x o x o x x x o o x

Search CSE A More “Intelligent” Minimax Backing up wins and losses –Requires entire search tree – Often infeasible Can use heuristic estimates, e(p), instead –pick “best next move” based on limited search –After opponent’s move, extend search further and estimate again

Search CSE Tic-Tac-Toe Evaluation Function If p is a win for MAX then e(p) = If p is a win for MIN then e(p) = - Else h(n) = ( X’s # of complete open rows,columns, diagonals - O’s # of complete open rows, columns,diagonals) e(p) = = 2 o x

Search CSE Heuristic Minimax for Tic-Tac-Toe x o x o x x o ox ox x o x x o xoxo x o xo xo x o x o x o x 6-5=1 5-5=0 4-5=-1 5-6=-1 5-5=0 5-6=-1 6-6=0 4-6=-2 5-4=1 6-4=

Search CSE o x o x o x o x x o x x o x o x o x o x o o x x o x o o x x o x o x x o o x o x o o x x o x o x o o x o x o x o x o o o x o x o x x o o x x o o o x x o x o x 4-2=2 3-2=1 5-2=3 3-2=1 4-2=2 3-2=1 4-3=1 3-3=0 5-3=2 3-3= 0 4-3=1 4-3=1 4-2=2 4-2=2 5-2=3 3-2=1 4-2=2 4-2=2 4-3=1 4-3=1 3-3= Minimax - 2

Search CSE Minimax-3 o o x 2-1=1 3-1=2 - = - 2-2=0 2-2=0 3-2=1 -=- 2-1=1 2-1=1 2-1= x o o x o o x x o o o x x x o o x X o x o o x x o x o o x o x o o x o x o o x x x o o o o x x o o o x o o o x x x o o x x x o o o x x x o o o x x x o o o x x x - -

Search CSE Alpha/Beta The value of a MAX node = current largest final backed-up value of its successors The value of a MIN node = current smallest final backed-up value of its successors

Search CSE Alpha/Beta Pruning Stop search below any MIN node where Stop search below any MAX node where

Search CSE Alpha/Beta for Tic-Tac-Toe x o x o x x o ox ox x o x x o xoxo x o xo xo x o x o x o x 6-5=1 5-5=0 4-5=-1 5-6=-1 5-5=0 5-6=-1 6-6=0 4-6=-2 5-4=1 6-4=2 MIN=-1, BETA=-1 MIN=-2, BETA=-1 MIN=1, BETA=1 MAX=1, ALPHA= -1 X X X X ALPHA= 1

Search CSE Alpha/Beta Pruning o o x 2-1=1 3-1=2 - = - 2-2=0 2-2=0 3-2=1 x o o x o o x x o o o x x x o o x X o x o o x x o x o o x o x o o x o x o o x x x o o o o x x o o o x XX X o o x x x o o o x x x X X X - = - MIN= -, BETA= - MIN= - BETA= - MIN=1, BETA=1 MAX=1 ALPHA=1