Computer Science cpsc322, Lecture 14

Slides:



Advertisements
Similar presentations
Constraint Satisfaction Problems
Advertisements

Heuristic Search techniques
Local Search Jim Little UBC CS 322 – CSP October 3, 2014 Textbook §4.8
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) Oct, 5, 2012.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Department of Computer Science Undergraduate Events More
CPSC 322, Lecture 16Slide 1 Stochastic Local Search Variants Computer Science cpsc322, Lecture 16 (Textbook Chpt 4.8) February, 9, 2009.
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 3, 2010.
CPSC 322, Lecture 15Slide 1 Stochastic Local Search Computer Science cpsc322, Lecture 15 (Textbook Chpt 4.8) February, 6, 2009.
1 Chapter 5 Advanced Search. 2 Chapter 5 Contents l Constraint satisfaction problems l Heuristic repair l The eight queens problem l Combinatorial optimization.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
CPSC 322, Lecture 13Slide 1 CSPs: Arc Consistency & Domain Splitting Computer Science cpsc322, Lecture 13 (Textbook Chpt 4.5,4.8) February, 02, 2009.
CPSC 322, Lecture 14Slide 1 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) February, 4, 2009.
Artificial Intelligence Constraint satisfaction Chapter 5, AIMA.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
Constraint Satisfaction Problems
Local Search CPSC 322 – CSP 5 Textbook §4.8 February 7, 2011.
Department of Computer Science Undergraduate Events More
CS 484 – Artificial Intelligence1 Announcements Homework 2 due today Lab 1 due Thursday, 9/20 Homework 3 has been posted Autumn – Current Event Tuesday.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Hande ÇAKIN IES 503 TERM PROJECT CONSTRAINT SATISFACTION PROBLEMS.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Fall 2006 Jim Martin.
Local Search Algorithms
Chapter 5 Constraint Satisfaction Problems
Local Search and Optimization Presented by Collin Kanaley.
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Local Search Algorithms and Optimization Problems
CPSC 322, Lecture 16Slide 1 Stochastic Local Search Variants Computer Science cpsc322, Lecture 16 (Textbook Chpt 4.8) Oct, 11, 2013.
Domain Splitting, Local Search CPSC 322 – CSP 4 Textbook §4.6, §4.8 February 4, 2011.
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.
CPSC 322, Lecture 15Slide 1 Stochastic Local Search Computer Science cpsc322, Lecture 15 (Textbook Chpt 4.8) Oct, 9, 2013.
Alternative Search Formulations and Applications
Cse 150, Fall 2012Gary Cottrell: Many slides borrowed from David Kriegman! Constraint Satisfaction Problems Introduction to Artificial Intelligence CSE.
CSG3F3/ Desain dan Analisis Algoritma
School of Computer Science & Engineering
Stochastic Local Search Computer Science cpsc322, Lecture 15
Department of Computer Science
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 13
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Lecture 11 SLS wrap up, Intro To Planning
Constraint Satisfaction Problems vs. Finite State Problems
Local Search Algorithms
CSCI 5582 Artificial Intelligence
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 13
Computer Science cpsc322, Lecture 14
Heuristic search INT 404.
Biointelligence Lab School of Computer Sci. & Eng.
Constraint Satisfaction Problems
Stochastic Local Search Variants Computer Science cpsc322, Lecture 16
Biointelligence Lab School of Computer Sci. & Eng.
Constraint satisfaction problems
Constraint Satisfaction Problems. A Quick Overview
Artificial Intelligence
Lecture 9 Administration Heuristic search, continued
More on HW 2 (due Jan 26) Again, it must be in Python 2.7.
First Exam 18/10/2010.
Domain Splitting CPSC 322 – CSP 4 Textbook §4.6 February 4, 2011.
Constraint Satisfaction
Local Search Algorithms
CS 188: Artificial Intelligence Fall 2007
CS 8520: Artificial Intelligence
CSC 380: Design and Analysis of Algorithms
Constraint Satisfaction Problems
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Constraint satisfaction problems
Local Search Algorithms
Presentation transcript:

Computer Science cpsc322, Lecture 14 Local Search Computer Science cpsc322, Lecture 14 (Textbook Chpt 4.8) May, 30, 2017 Lecture 14 CPSC 322, Lecture 14

Announcements Assignment1 due now! Assignment2 out today CPSC 322, Lecture 10

Recap solving CSP systematically Local search Constrained Optimization Lecture Overview Recap solving CSP systematically Local search Constrained Optimization Greedy Descent / Hill Climbing: Problems CPSC 322, Lecture 14

Systematically solving CSPs: Summary Build Constraint Network Apply Arc Consistency One domain is empty  Each domain has a single value  Some domains have more than one value  Apply Depth-First Search with Pruning Search by Domain Splitting Split the problem in a number of disjoint cases Apply Arc Consistency to each case Otherwise, split a domain & apply arc consistency to each case. Spiltting in half the variable with the smallest domain usually works best (who know why) ACC: Show with Cispace, first “scheduling problem”, and then crossword 1 for splitting. What makes sense is to split the node with 6 vars to the right, show that it gets to an empty solution, backtrack, and do more s0plitting on the var with 2 values on the top-left. Done. WENT WELL CPSC 322, Lecture 13

Constrained Optimization Greedy Descent / Hill Climbing: Problems Lecture Overview Recap Local search Constrained Optimization Greedy Descent / Hill Climbing: Problems CPSC 322, Lecture 14

Local Search motivation: Scale Many CSPs (scheduling, DNA computing, more later) are simply too big for systematic approaches If you have 105 vars with dom(vari) = 104 Systematic Search Arc Consistency 105 * 104 1010 * 108 1010 * 1012 but if solutions are densely distributed……. CPSC 322, Lecture 14

Local Search: General Method Remember , for CSP a solution is….. Start from a possible world Generate some neighbors ( “similar” possible worlds) Move from the current node to a neighbor, selected according to a particular strategy Example: A,B,C same domain {1,2,3} A useful method in practice for some consistency and optimization problems is local search move from one node to another according to a function that scores how good each neighbor is according to a function that scores how good each neighbor is CPSC 322, Lecture 14

Local Search: Selecting Neighbors How do we determine the neighbors? Usually this is simple: some small incremental change to the variable assignment assignments that differ in one variable's value, by (for instance) a value difference of +1 assignments that differ in one variable's value assignments that differ in two variables' values, etc. Example: A,B,C same domain {1,2,3} CPSC 322, Lecture 14

Iterative Best Improvement How to determine the neighbor node to be selected? Iterative Best Improvement: select the neighbor that optimizes some evaluation function Which strategy would make sense? Select neighbor with … A. Maximal number of constraint violations B. Similar number of constraint violations as current state C. No constraint violations D. Minimal number of constraint violations

Selecting the best neighbor Example: A,B,C same domain {1,2,3} , (A=B, A>1, C≠3) A common component of the scoring function (heuristic) => select the neighbor that results in the …… - the min conflicts heuristics For example, if the goal is to find the highest point on a surface, the scoring function might be the height at the current point. CPSC 322, Lecture 5

Example: N-Queens Put n queens on an n × n board with no two queens on the same row, column, or diagonal (i.e attacking each other) Positions a queen can attack

Example: N-queen as a local search problem CSP: N-queen CSP One variable per column; domains {1,…,N} => row where the queen in the ith column seats; Constraints: no two queens in the same row, column or diagonal Neighbour relation: value of a single column differs Scoring function: number of attacks How many neighbors ? 100 90 56 9

Example: Greedy descent for N-Queen For each column, assign randomly each queen to a row (a number between 1 and N) Repeat For each column & each number: Evaluate how many constraint violations changing the assignment would yield Choose the column and number that leads to the fewest violated constraints; change it Until solved

n-queens, Why? Why this problem? Lots of research in the 90’ on local search for CSP was generated by the observation that the run-time of local search on n-queens problems is independent of problem size! It consists of an initial search phase that starts during problem generation and a final search phase that removes conflicts During the initial search function Initial Search an initial permutation of the row positions of the queens is Generated A random permutation of n queens would generate approximately .5n collisions Since this number of collisions is very high the algorithm performance can be improved signicantly if collisions in the initial permutation are minimized During the final search procedure Final Search two queens are chosen for conflict minimization If a swap (the row) of two queens reduces the number of collisions then two queens are swapped Otherwise no action is taken The final search is repeated until all collisions are eliminated The number of collisions on a diagonal line can be computed in constant time using a characterization of diagonal lines CPSC 322, Lecture 14

Constrained Optimization Greedy Descent / Hill Climbing: Problems Lecture Overview Recap Local search Constrained Optimization Greedy Descent / Hill Climbing: Problems CPSC 322, Lecture 14

Constrained Optimization Problems So far we have assumed that we just want to find a possible world that satisfies all the constraints. But sometimes solutions may have different values / costs We want to find the optimal solution that maximizes the value or minimizes the cost It consists of an initial search phase that starts during problem generation and a final search phase that removes conflicts During the initial search function Initial Search an initial permutation of the row positions of the queens is Generated A random permutation of n queens would generate approximately .5n collisions Since this number of collisions is very high the algorithm performance can be improved signicantly if collisions in the initial permutation are minimized During the final search procedure Final Search two queens are chosen for conflict minimization If a swap (the row) of two queens reduces the number of collisions then two queens are swapped Otherwise no action is taken The final search is repeated until all collisions are eliminated The number of collisions on a diagonal line can be computed in constant time using a characterization of diagonal lines CPSC 322, Lecture 14

Constrained Optimization Example Example: A,B,C same domain {1,2,3} , (A=B, A>1, C≠3) Value = (C+A) so we want a solution that maximize that The scoring function we’d like to maximize might be: f(n) = (C + A) + #-of-satisfied-const For example, if the goal is to find the highest point on a surface, the scoring function might be the height at the current point. Hill Climbing means selecting the neighbor which best improves a (value-based) scoring function. Greedy Descent means selecting the neighbor which minimizes a (cost-based) scoring function. CPSC 322, Lecture 5

Constrained Optimization Greedy Descent / Hill Climbing: Problems Lecture Overview Recap Local search Constrained Optimization Greedy Descent / Hill Climbing: Problems CPSC 322, Lecture 14

Hill Climbing NOTE: Everything that will be said for Hill Climbing is also true for Greedy Descent One of the most obvious heuristics is to select the value that results in the minimum # of conflicts with the other variables - the min conflicts heuristics Ex, in case of eight queen, it is the number of attacking queens. Min conflict is surprising effective and can solve the million-queens problem in less than 50 steps. It has also been used to schedule the hubble telecope, reducing the time taken to schedule a week of observations from three weeks to around 10’ CPSC 322, Lecture 5

Problems with Hill Climbing Local Maxima. Plateau - Shoulders No way to move from a plateau, could escape from a shoulder With a randomly gerenated 8-queen initial state steepest ascent hill climbing gets stuck 86% of the times. Takes 4 steps on average to suceed and 3 to get stuck –good since there are 17 million states (Plateau) CPSC 322, Lecture 5

Even more Problems in higher dimensions E.g., Ridges – sequence of local maxima not directly connected to each other From each local maximum you can only go downhill CPSC 322, Lecture 5

Corresponding problem for GreedyDescent Local minimum example: 8-queens problem A local minimum with h = 1 CPSC 322, Lecture 5

Local Search: Summary A useful method for large CSPs Start from a possible world Generate some neighbors ( “similar” possible worlds) Move from current node to a neighbor, selected to minimize/maximize a scoring function which combines: Info about how many constraints are violated Information about the cost/quality of the solution (you want the best solution, not just a solution) move from one node to another according to a function that scores how good each neighbor is according to a function that scores how good each neighbor is Number of unsatisfied constraints OR weighted count CPSC 322, Lecture 5

Learning Goals for today’s class You can: Implement local search for a CSP. Implement different ways to generate neighbors Implement scoring functions to solve a CSP by local search through either greedy descent or hill-climbing. CPSC 322, Lecture 4

Next Class How to address problems with Greedy Descent / Hill Climbing? Stochastic Local Search (SLS) CPSC 322, Lecture 13