an introduction to artificial life lecture 4b: informed search and exploration ramin halavati...

38
An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati ([email protected]) In which we see how information about the state space can prevent algorithms from blundering about the dark.

Upload: jade-washington

Post on 31-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

An Introduction to Artificial Life

Lecture 4b: Informed Search and ExplorationRamin Halavati ([email protected])

In which we see how information about the state space can prevent algorithms from blundering about the dark.

Page 2: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Local search algorithms• Some times the path to goal matters…

– Shortest route to a city.– The solution to 8-Puzzle.– Robot’s route in a building.– A Check-Mate

• And some times, not– 8 Queens.– Job-Shop Scheduling– Automatic program generation– Check-Mate in Barareh!

Page 3: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Local search algorithms• When path doesn’t matter…

• State space = set of "complete" configurations

• Find configuration satisfying constraints

• Keep a single "current" state or a fixed number of independent current states, try to improve it or them.

Page 4: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Objective Landscape

Page 5: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill-Climbing Search• "Like climbing Everest in thick fog with

amnesia"

• Greedy Local Search

Page 6: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill-Climbing Search: 8-Queens

• h = number of pairs of queens that are attacking each other, either directly or indirectly

• h = 17 for the above state

Page 7: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing Problems• Local Maxima/Minima

Page 8: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing Problems

• A local minimum with h = 1•

Page 9: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing Problems• Ridges

Page 10: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing Problems

• Plateaux– A state whose all neighbors have similar

fitness.

Page 11: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing, Now What?• 8-Queens, random examples:

– 86% Failure, 14% Success.– In average, 4 moves.

– State Space: 88 > 17,000,000

• Solution 1: Random Restart:– Restart from a random point if failed.

• Almost 7 tries for 8-queens.• 3,000,000 queens in less than 1 minute.

Page 12: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing, Now What?• Solution 2:

– Sideway moves for plateaux. / Limited.

• Solution 3:– Stochastic Hill Climbing, random selection

among up hills.• Slower convergence, sometimes better solutions.

• Solution 4:– First Choice Hill Climbing.

Page 13: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Practical State Spaces

Page 14: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Simulated Annealing Search• Hill Climbing:

– Just move to a better state. – Efficient, but can stuck in local maxima

• Random Walk:– Move to a random neighbor.– Complete, but extremely inefficient.

• Idea: Escape local maxima by allowing some "bad" moves but gradually decrease their frequency.

Page 15: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Simulated Annealing Search

Page 16: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Simulated Annealing Search• One can prove: If T decreases slowly enough,

then simulated annealing search will find a global optimum with probability approaching 1

• Widely used in VLSI layout, airline scheduling, etc.

Page 17: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Local Beam Search• Keep track of k states rather than just one

• Start with k randomly generated states

• At each iteration, all the successors of all k states are generated

• If any one is a goal state, stop; else select the k best successors from the complete list and repeat.

•••

Page 18: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Local Beam Search• Looks similar to Parallel Random Start Hill

Climbers, but it’s not.

• Stochastic Beam Search

Page 19: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Genetic Algorithms• Beagle Voyage

• Animals adopt to

environmental.

Page 20: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Genetic Algorithms• Natural Evolution:

– Given these requirements:1. A creature whose features affects his reproduction

rate.2. Offspring features are very much, but not exactly

similar to the parent(s).3. There is a competition on resources.

– We will have• Gradual Progress

– The Blind Watchmaker - DawkinsThe Blind Watchmaker - Dawkins

Page 21: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Genetic algorithms• Start with k randomly generated states

(population)

• A successor state is generated by combining two parent states

• Produce the next generation of states by selection, crossover, and mutation.

• Evaluation function (fitness function). Higher values for better states.– Selection of Higher Fitnesses

••

Page 22: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Genetic algorithms• Cross Over:

– To select some part of the solution (state) from one person and the rest from another.

• Mutation:– To change a small part of one solution with a small probability.

Page 23: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Genetic algorithms

Page 24: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

L.S. in Continues Spaces• Infinite number of successor states.

– To select three best locations for airports.• (x1,y1) , (x2,y2) , (x3,y3)

• Approach 1:– To discretize

• Just change them by ±

• Approach 2:– To compute gradient!

• J

332211 y

f

x

f

y

f

x

f

y

f

x

fxx

Page 25: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Online Search / Unknown Env.

• Offline Search– Generate as many nodes as you wish, in any

order.

• Online Search– Interleave computation and action

• Dynamic Domains• Stochastic Domains.• Unknown Domains.

– Exploration

Page 26: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Online Search Problems• You can see the successors just by applying an

action.

• You may have different results from repeating a similar action at a certain state.

• You just see one step ahead.G

S

Page 27: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Algorithms for Online Search• Nothing General Enough

• Limitation to Local Search

• Competitive Ratio

• Safely Explorable

Page 28: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Hill Climbing, once more…• Hill Climbing stores just one state, so it is

an online searcher

• But can not Randomly Restart.– Random Walk– Adding Memory:

• Learning Real Time A*

Page 29: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Learning Real Time A*• To remember and update the costs of all

visited nodes.

Page 30: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Learning Real Time A*

Page 31: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Essay Proposals• What is MA*? Compare it with SMA* and A*.

• What is Tabu Search?

• What is Viterbi Search?

• What is Tree-Trellis?

• What are variants of Genetic Algorithms?

• What is Immunity System Search?

• What is Simulated DNA Computing Search?

• Compare Natural Evolution and Genetic Algorithms.

Page 32: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Essay Proposals• What is Game of Life?

• What other search method exist that are inspired from nature?

Page 33: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Essay Proposals• Bring a survey of any of the proposed

algorithms in real applications.

• Bring a detailed usage of one of the algorithms in a real application.

• Choose 5 exercises and do them in details, from any chapter, but tell me first.

Page 34: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Exercises• Choose one of 4.15 – 4.18

• Due: Esfand 30th

• Email To: [email protected]

• Subject: AIEX-415 .. AIEX-418

Page 35: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Project Proposals• Make an improvement in one of the

algorithms, compare your results with original one on different domains.

• …

Page 36: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Project Proposals• Choose a real problem. Design and

implement a suitable algorithm for it. Compare your results with required results or other solutions.

Page 37: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

Project Proposals• Choose a one player game, find some

other people who agree on yours. Write a common engine and perform a competition, with or without time limit.– Mahjongg, Solitaire, Open Tetris, …

Page 38: An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati (halavati@ce.sharif.edu) In which we see how information

That’s all.