8puzzle in CP.

Slides:



Advertisements
Similar presentations
Solving Quadratic Equations Using the Zero Product Property
Advertisements

DCS Lecture how to solve it Patrick Prosser. Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
Constraint Based Reasoning over Mutex Relations in Graphplan Algorithm Pavel Surynek Charles University, Prague Czech Republic.
3.4 Artificial starting solution Page103
Let’s solve the equation: We shall use a scale to represent our equation. The variable x will be replaced with and the numbers will be represented with.
Minimization by Dr. Arshad zaheer
Constraint Satisfaction Problems
CS121 Heuristic Search Planning CSPs Adversarial Search Probabilistic Reasoning Probabilistic Belief Learning.
1.2 – Open Sentences and Graphs
ALGEBRA TILES Variables such as ‘x’ and ‘y’ are used to represent an unknown number Algebra tiles are the generally accepted manipulative to help students.
A simple assessed exercise Ciaran McCreesh & Patrick Prosser + 21.
4.4 Equations as Relations
EE/Econ 458 The Simplex Method using the Tableau Method
Topic III The Simplex Method Setting up the Method Tabular Form Chapter(s): 4.
Jinsong Guo Jilin University, China Background  Filtering techniques are used to remove some local inconsistencies in the search algorithms solving.
Sets and Sentences Open Sentences Foundations of Real Analysis.
Introduction to Planning Dr. Shazzad Hosain Department of EECS North South Universtiy
CPSC 322, Lecture 18Slide 1 Planning: Heuristics and CSP Planning Jim Little UBC CS 322 October 15, 2014 Textbook §8.
Chapter 5 Constraint Satisfaction Problems
Solving Quadratic Equations Quadratic Equations: Think of other examples?
Problem Reduction So far we have considered search strategies for OR graph. In OR graph, several arcs indicate a variety of ways in which the original.
Arc consistency AC5, AC2001, MAC. AC5 A generic arc-consistency algorithm and its specializations AIJ 57 (2-3) October 1992 P. Van Hentenryck, Y. Deville,
Put a different number in each circle (1 to 8) such that adjacent circles cannot take consecutive numbers.
8puzzle in CP initial state goal state A trivial example.
Solving Quadratic Equations Using the Zero Product Property March 18, 2014.
LINEAR AND INTEGER PROGRAMMING The Simplex Method: A tutorial in three acts.
Divisibility.
ALGEBRA TILES SOLVING EQUATIONS Replace the equation with tiles: Negative Positive -X X 1.
1 Math Pacing Graphing Linear Equations. Equations as Relations A linear equation can be written in the standard form of a linear equation: Ax + By =
Section 7.6 Functions Math in Our World. Learning Objectives  Identify functions.  Write functions in function notation.  Evaluate functions.  Find.
Jobshop scheduling.
Automatic Test Generation
The Slope-Intercept Formula
Planning as Satisfiability
EQUATION IN TWO VARIABLES:
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
The minimum cost flow problem
Numerical Representation of Strings
Introduction to Artificial Intelligence
Cardinality of Sets Section 2.5.
Abstraction Transformation & Heuristics
Error Handling Summary of the next few pages: Error Handling Cursors.
Functions Defined on General Sets
DOMAINS OF FUNCTIONS Chapter 1 material.
EMIS 8373: Integer Programming
Planning: Heuristics and CSP Planning
Analysis and design of algorithm
Chapter 3 The Simplex Method and Sensitivity Analysis
Solving Quadratic Equations by Factoring March 16, 2015
1. Reaching Definitions Definition d of variable v: a statement d that assigns a value to v. Use of variable v: reference to value of v in an expression.
Rounding Numbers Let’s find out how!.
Associate Professor of Computers & Informatics - Benha University
Solving Linear Programming Problems: Asst. Prof. Dr. Nergiz Kasımbeyli
Connecting Algebra Tiles to Integer Tiles
Logic: Domain Modeling /Proofs + Computer Science cpsc322, Lecture 22
Advanced consistency methods Chapter 8
Problems of Tutorial Consider a data set consisting of 1 response variable (Y) and 4 predictor variables (X1, X2, X3 and X4) with n=40. The following.
Matrix Algebra.
Constraint satisfaction problems
Breakfast Bytes Easy, Hard, and Impossible
Output Variables {true} S {i = j} i := j; or j := i;
Unit 30 Functions Presentation 1 Functions, Mappings and Domains 1
Part 4 - Chapter 13.
When we multiply by 10 we are making the number ten times bigger.
Section 1.5 Adding Integers
7.NS.1 Positive and Negative Numbers
Chapter 1. Formulations.
Constraint satisfaction problems
Solving Quadratic Equations by Factoring March 11, 2016
Presentation transcript:

8puzzle in CP

1 2 3 1 2 3 4 5 7 5 6 7 8 4 6 8

1 4 2 7 6 3 5 8 1 4 2 7 6 3 5 8 1 4 6 2 7 3 5 8 1 4 6 2 7 3 5 8

Representation 1 4 6 2 7 3 5 8 1 4 7 2 5 8 3 6 9 1 4 7 2 5 8 3 6 9

Representation 1 4 6 2 7 3 5 8 1 4 2 7 6 3 5 8 1 4 2 7 6 3 5 8 1 4 6 2 7 3 5 8 1 4 6 2 7 3 5 8

1 4 6 2 7 3 5 8 Representation of states To get from initial state to a goal state we make a number of moves and moves take us to new states If we have a plan that takes us from I to G in n steps we will have n-1 states between I and G Represent a state as 9 constrained integer variables S[i] has a value [0..8], the tile in position i the value 0 corresponds to the blank tile Therefore for a plan, let’s say of 3 steps from I to G we will have states S[1..4][1..9] S[1][5] is the tile in the 5th position of the 1st state (and is 0 in our example)

1 4 6 2 7 3 5 8 1 4 7 2 5 8 3 6 9 Representation of moves There are 24 possible moves from a state position of blank (zero) possible moves (swaps) move numbers 1 (1,2),(1,4) 1,2 2 (2,1),(2,3),(2,5) 3,4,5 3 (3,2),(3,6) 6,7 4 (4,1),(4,5),(4,7) 8,9,10 5 (5,2),(5,4),(5,6),(5,8) 11,12,13,14, 6 (6,3),(6,5),(6,9) 15,16,17 7 (7,4),(7,8) 18,19 8 (8,5),(8,7),(8,9) 20,21,22 9 (9,6),(9,8) 23,24 We have n-1 move variables, where move[i] has a domain [1..24]

Representation of moves & states 1 4 6 2 7 3 5 8 1 4 6 2 7 3 5 8 move[1] = 14 1 4 6 2 7 3 5 8 move[2] = 21 1 4 2 7 6 3 5 8 move[1] = 18 1 4 2 7 6 3 5 8 position of blank (zero) possible moves (swaps) move numbers 1 (1,2),(1,4) 1,2 2 (2,1),(2,3),(2,5) 3,4,5 3 (3,2),(3,6) 6,7 4 (4,1),(4,5),(4,7) 8,9,10 5 (5,2),(5,4),(5,6),(5,8) 11,12,13,14, 6 (6,3),(6,5),(6,9) 15,16,17 7 (7,4),(7,8) 18,19 8 (8,5),(8,7),(8,9) 20,21,22 9 (9,6),(9,8) 23,24

Constraints on a move 1 4 6 2 7 3 5 8 If we are in state 1 and the blank tile is in position 1 and we make move 1 (swap(1,2)) then in state 2 the blank is in position 2 and what is in position 2 of in state 1 is now in position 1 in state 2

Constraints on a move 1 4 6 2 7 3 5 8

Constraints on a move 1 4 6 2 7 3 5 8 But … when we make a move, only the things that we move change! This is the frame problem (GOF AI) … and so on

Constraints on a move 1 4 6 2 7 3 5 8 We also need to say that if the blank tile (zero) is not in a specific position we cannot make a specified move … and so on

1 4 6 2 7 3 5 8 Solving The move variables are our decision variables Find values for the move variables that satisfy the constraints This will find a plan of n-1 steps if one exists

1 4 6 2 7 3 5 8 Bi-directional search Search from I to G and from G to I simultaneously Replace the variables move[i] introduce fmove[i] the forwards move from state i to state i+1 introduce bmove[i] the backward move from state i + 1 to I post all the constraints we hadd before in both directions! add the following constriants I call this a bridge between backward & forward moves We can now search in the following order fmove[1],bmove[n-1],fmove[2],bmove[n-2] ...

1 4 6 2 7 3 5 8 Propagation through plans There is little if any propagation through plans

1 4 6 2 7 3 5 8 Propagation through plans There is little if any propagation through plans If in state i I cannot move the blank tile into position x then in state i+1 I cannot make a move out of position x! Example: If at time T I cannot put the bunch of flowers on the table then at time T+1 I cannot move the bunch of flowers from the table

1 4 6 2 7 3 5 8 Propagation through plans If in state i I cannot move the blank tile into position x then in state i+1 I cannot make a move out of position x! I call this a rippling constraint position of blank (zero) possible moves (swaps) move numbers 1 (1,2),(1,4) 1,2 2 (2,1),(2,3),(2,5) 3,4,5 3 (3,2),(3,6) 6,7 4 (4,1),(4,5),(4,7) 8,9,10 5 (5,2),(5,4),(5,6),(5,8) 11,12,13,14, 6 (6,3),(6,5),(6,9) 15,16,17 7 (7,4),(7,8) 18,19 8 (8,5),(8,7),(8,9) 20,21,22 9 (9,6),(9,8) 23,24

1 4 6 2 7 3 5 8 My problems with planning what happens if we cannot find a plan in n-1 steps? Build a bigger model … or add another layer to the model like iterative dfs could we have a null move, i.e. a move[i] = 0 yes, but we have to condition the rippling constraint our rippling constraint can generate a contradiction otherwise! the model is BIG I’m working on something neater

That’s all for now folks