21
CS-424 Gregory Dudek Lecture 10 Annealing (final comments) Adversary Search Genetic Algorithms (genetic search)

Lecture 10

  • Upload
    tosca

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

Lecture 10. Annealing (final comments) Adversary Search Genetic Algorithms (genetic search). Comments on Assignment 2. Who’s gotten started? JAVA has a class for calling C functions. See SUN’s java 1.1 web page. It’s open ended. Give yourself time to ponder. What are good heuristics. - PowerPoint PPT Presentation

Citation preview

Page 1: Lecture 10

CS-424 Gregory Dudek

Lecture 10

• Annealing (final comments)• Adversary Search• Genetic Algorithms (genetic search)

Page 2: Lecture 10

CS-424 Gregory Dudek

Comments on Assignment 2• Who’s gotten started?• JAVA has a class for calling C functions.

– See SUN’s java 1.1 web page.

• It’s open ended. Give yourself time to ponder.• What are good heuristics.

– Things in the URL?– Things in the page content of the “current node”?– Things in the content of the destination URL?

• Tricks are important.– (This is typical of AI in practice).

• Measure your performance.– This is always important! Do it scientifically.

• Try easy stuff first.– A good general rule.

Page 3: Lecture 10

CS-424 Gregory Dudek

A comment• On minimal length paths….

• The Dynamic-Programming Principle [Winston]:“The best way through a particular, intermediate place is

the best way to it from the starting place, followed by the best way from it to the goal. There is no need to look at any other paths to or from the intermediate place.”

A variation on the A* theme called dynamic programming.Use the h instead of h’ and efficiently compute true path costs.

Page 4: Lecture 10

CS-424 Gregory Dudek

Adversary Search

Basic formalism• 2 players.• Each has to beat the other (competing objective

functions).• Complete information.• Alternating moves for the 2 players.

Page 5: Lecture 10

CS-424 Gregory Dudek

The players• Players want to achieve “opposite” goals:

– What’s bad for A is good for B, and vice versa.

• With respect to our static evaluation functions, one wants to maximize the function, the other wants to minimize it.

• Use a game tree to describe the state space.

• Approach: MINIMAX procedure.

Page 6: Lecture 10

CS-424 Gregory Dudek

Game Tree• Nodes represent board configurations.• Edges represent allowed moves from one

configuration to another.

• For most 2-player games, alternating levels in the tree refer to alternating moves by the 2 players.

• Static evaluation function measures the (apparent) goodness of a given configuration.– Returns a signed value, to indicate goodness for the

minimizing or maximizing player.

Page 7: Lecture 10

CS-424 Gregory Dudek

See overhead(based on RN Figure )

Page 8: Lecture 10

CS-424 Gregory Dudek

MINIMAX• If the limit of search has been reached, compute the

static value of the current position relative to the appropriate player. Return the result

• Otherwise, use MINIMAX on the children of the current position.– If the level is a minimizing level, return the minimum of

the results– If the level is a maximizing layer, return the maximum of

the results.

Page 9: Lecture 10

CS-424 Gregory Dudek

MINIMAX observations• The static evaluation function is…

– Crucial: all decisions are eventually based of the value it returns.

– Irrelevant: if we search to the end of the game, we always know the outcome.

• In practice, if same has a large search space then the static evaluation is especially important.

Page 10: Lecture 10

CS-424 Gregory Dudek

Minimax

• Divide tree into plies

• Propagate information up from terminal nodes.

• Storage needs grow exponentially with depth.

Page 11: Lecture 10

CS-424 Gregory Dudek

Alpha-Beta Search• Can we avoid all the search-tree expansion implicit

in MINIMAX?

• Yes, with a simple observation closely related to A* :

Once you have found a good path, you onlyneed to consider alternative paths that are

better than that one.

See example….

Page 12: Lecture 10

CS-424 Gregory Dudek

The “

””

Page 13: Lecture 10

CS-424 Gregory Dudek

The principle.• “If you have an idea that is surely

bad, do not take time to see how truly awful it is.” [Winston]

Page 14: Lecture 10

CS-424 Gregory Dudek

cutoff: How good is it?• What is the best-case improvement for alpha-beta?• What is the worst-case improvement for alpha-beta?

• Best case: only examine one leftmost “pre-terminal” nodes fully.

• Worst-case:– For some trees, it won’t help at all.– For some trees, even though it could help, it might not

help if the nodes are encountered in the wrong order.

Not in text

Page 15: Lecture 10

CS-424 Gregory Dudek

Progressive deepening

• How do you deal with (potential) time pressure?

• Search progressively deeper: first depth 1, then depth 2, etc.

• As before, ratio of interior to leaf nodes isbd(b-1)/(bd-1) or roughly (b-1)

[so if b=30, it only takes 1/30th extra time to do the progressive part of progressive deepening]

Not in text

Page 16: Lecture 10

CS-424 Gregory Dudek

Tricks• Several techniques have proven important in

practice. • Many critical techniques lead to improvements that

have no importance in terms of worst-case asymptotic complexity.

Transposition tables• Cache positions and their eventual outcome.• Is a position re-occurs, don’t need to reevaluate it,

since the information is in cache.

Page 17: Lecture 10

CS-424 Gregory Dudek

Issues

• Horizon effect

• Search-until-quiescent heuristic

• Singular-extension heuristic

Not in text

Page 18: Lecture 10

CS-424 Gregory Dudek

Next major topic: LEARNING• First, a transitional problem.

• How can we do hill climbing in a space of– representations ?– programs ?– entire systems ?

• e.g. Find the best program for (small) problem X.• Find the best settings for the knowb on a refinery.• Find the best LOGO program for a picture.• Find the best organism encoded as DNA.

Page 19: Lecture 10

CS-424 Gregory Dudek

GA’sGenetic Algorithms

Cool, novel, controversial, costly (?), powerful (?).Inspired by real evolution.

Idea:Encode the problem as a string.

For example, a character string on a restricted alphabet.Define a fitness function.

Page 20: Lecture 10

CS-424 Gregory Dudek

GA’s• Define a population of strings to encode a set of

alternative solutions to a problem.• Now, we want to keep good solutions and improve

them.• Add operators for:

– mixing strings– randomly changing strings

• Add an algorithm to repeatedly select the best, add variations, and evaluate.

Page 21: Lecture 10

CS-424 Gregory Dudek

GA’sGenetic Algorithms

Plastic transparencies & blackboard.