Here is a puzzle I found on a t-shirt

Slides:



Advertisements
Similar presentations
Traveling Salesperson Problem
Advertisements

Iterative Deepening A* & Constraint Satisfaction Problems Lecture Module 6.
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
BackTracking Algorithms
Types of Algorithms.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Section 1.7: Coloring Graphs
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
This material in not in your text (except as exercises) Sequence Comparisons –Problems in molecular biology involve finding the minimum number of edit.
Problem Solving and Search in AI Heuristic Search
Backtracking.
State-Space Searches.
Identifying Reversible Functions From an ROBDD Adam MacDonald.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
Moving Around in Scratch The Basics… -You do want to have Scratch open as you will be creating a program. -Follow the instructions and if you have questions.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Minimax with Alpha Beta Pruning The minimax algorithm is a way of finding an optimal move in a two player game. Alpha-beta pruning is a way of finding.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Lecture 3: Uninformed Search
Graham Kendall +44 (0) G5AIAI Introduction to AI Graham Kendall Combinatorial Explosion.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
For Monday Read chapter 4 exercise 1 No homework.
Homework 0 This homework will NOT normally be graded or turned in, unless you want extra credit. If you do want to hand in your work, you can earn 0.5%
1 Section 5.1 Analyzing Algorithms Let P be a problem and A an algorithm to solve P. The running time of A can be analyzed by counting the number of certain.
Lecture 3: Uninformed Search
Confidence intervals for µ
Week 7 - Friday CS221.
BackTracking CS255.
KEYSTONE EXAM TIPS & TRICKS.
Statistics 2. Tree Diagrams
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
Backtracking And Branch And Bound
Stats and Probability 2. Tree Diagrams
Instructor: Vincent Conitzer
In this lesson you will learn how to tell what time it is when
Binary Search Back in the days when phone numbers weren’t stored in cell phones, you might have actually had to look them up in a phonebook. How did you.
Types of Algorithms.
Binary Search Back in the days when phone numbers weren’t stored in cell phones, you might have actually had to look them up in a phonebook. How did you.
Creativity in Algorithms
Multi-Way Search Trees
Types of Algorithms.
Bin Sort, Radix Sort, Sparse Arrays, and Stack-based Depth-First Search CSE 373, Copyright S. Tanimoto, 2002 Bin Sort, Radix.
(These will be on tomorrow’s quiz!)
Mr Barton’s Maths Notes
Branch and Bound.
Skill Review Unique has a bag of marbles. There are 4 colors of marbles: red, blue, yellow, and green. The table shows the frequencies of marbles after.
Binary Search Back in the days when phone numbers weren’t stored in cell phones, you might have actually had to look them up in a phonebook. How did you.
Dot Collections: Find 5, create expressions with 5.
Stats and Probability 2. Tree Diagrams
You already have these slides, this is just a repacking in the order I intend to present them on OCT 14.
Probability True or False? Answers.
A General Backtracking Algorithm
Bin Sort, Radix Sort, Sparse Arrays, and Stack-based Depth-First Search CSE 373, Copyright S. Tanimoto, 2001 Bin Sort, Radix.
First Grade Dolch Sight Words
Backtracking.
Rounded Off Values Upper and Lower Bounds.
Backtracking and Branch-and-Bound
Test 2 Review The test will consist of 3 sections.
Types of Algorithms.
Compact routing schemes with improved stretch
First Grade Sight Words
State-Space Searches.
State-Space Searches.
M3D16 Have out: Bellwork: pencil, red pen, highlighter, GP notebook
State-Space Searches.
Mathematical Induction II
Presentation transcript:

Here is a puzzle I found on a t-shirt The task, is to go from start to finish, alternating the colors of the “orbs” you pass…

.. So this partial solution is not legal, since I have past two blues in a row…

Here is a solution (I am not sure if it is unique)

To Think About Assume we are to solve this with blind search.. How would you represent the states and the operators? What is the branching factor? What is the diameter? Can you get it exactly, or at least upper and/or lower bounds? Which blind search algorithm would you use?

The states should be the intersections The states should be the intersections. It is only there that we have a choice. Here choices are operators. For each state we need to know.. F H I M Possible operators allowed For example: From C, we can get to B, E or F From A, we can get to B C E G J L N B D K O A P

We also need to know the parity for each operator. That is to say, we need to know the last color visited. For example: For node F If C was parent, last color was Blue If H was parent, last color was Blue If M was parent, last color was Blue If E was parent, last color was Red F H I M C E G J L N B D K O A P

F H I M C E G J L N B D K O A P For node F If C was parent, last color was Blue If H was parent, last color was Blue If M was parent, last color was Blue If E was parent, last color was Red Given the above, we can list the legal operators IF last color was Blue legal operators = { E } ELSE legal operators = { C, M , H} END F H I M C E G J L N B D K O A P

A B C D E F B N L O P Start Goal! What can we say about the branching factor? The are some four-way intersections, but you can never go back (because the last color you saw, would be seen again). So the branching factor is at most three for the four-way intersections, and there are four of them. The are some three-way intersections, but again you can never go back. So the branching factor is at most two for the three-way intersections, and there are twelve of them1. So an estimate for the branching factor is b = (12/16 * 2) + (4/16*3) = 2.25. This is actually an upper bound. A Start B C D E F B N L O P Goal! 1Really should say, at most 12, because A has only one choice

A B C D E F B N L O P Start Goal! What can we say about the branching factor? The are some four-way intersections, but you can never go back (because the last color you saw, would be seen again). So the branching factor is at most three. That is good enough an estimate. What can we say about the depth? Lets do a lower bound. If I take away all the colors, then I can solve this with ten moves: A, B, C, F , H, I, M, L, N, O, P So 10 is a lower bound. Lets do an upper bound. If we count the number of intersections, we might guess 16. However, with a little introspection, we can see that: We might have to visit some intersections twice, each time from a different parent, and each time going a different way. We never have to visit an intersection twice! So an upper bound is d = (16 * 2) = 32. A Start B C D E F B N L O P Goal!

Which algorithm should we use? How many nodes do we have to check? Assume we take one nanosecond to test each state we pop off NODES. Assume the worst case We have b = 2.25 and d = 32. (2.25^32) nanosecond = 3.1 minutes Assume the best case We have b = 2.25 and d = 10 (2.25^10) nanosecond = 3.3 microseconds Assume the actual depth is half way between best and worst case We have b = 2.25 and d = 24 (2.25^24) nanosecond = 0.28 seconds It probably does not matter what algorithm we use. We are not likely to run out of space or time. Likewise, I would not bother to optimize my code. However, this assumes we solving the puzzle once. The similar “google maps” problem needs to be solved millions of times a day, so for that problem, we would optimize the code very carefully.