AI 笔记 Week 05 Constraint Satisfaction

This week: watch Lesson 4, Constraint Satisfaction, and read Chapter 6 in AIMA (Russell & Norvig).
Assignment 2: Tridirectional Search
**Due: September 24! Here is the GitHub repo.

I need to read the book to understand this chapter.


AI 笔记 Week 05 Constraint Satisfaction_第1张图片
Constrint Satisfaction Problem

challenge question

AI 笔记 Week 05 Constraint Satisfaction_第2张图片
Quiz: GSP Challenge Question
  • use the techniques mentioned in the quiz to solve a problem like this

Map Coloring problem

  • question: color the map with a minimum number of colors while no states adjacent will be colored the same.
AI 笔记 Week 05 Constraint Satisfaction_第3张图片
map

The map-coloring problem has the following components:

  1. Variables
  2. Domains
  3. Constraints: or rules to specify the problem.
  • Unary constraints concerns only one variable.
  • The problem can be illustrated by a Constraint Graph if the constraints are binary.

Constraint Graph

AI 笔记 Week 05 Constraint Satisfaction_第4张图片
Map coloring
  1. Nodes are variables
  2. Arc (Edges) represents constraints.
AI 笔记 Week 05 Constraint Satisfaction_第5张图片
quiz
AI 笔记 Week 05 Constraint Satisfaction_第6张图片
quize: my answer

There are multiple solutions to the quiz. But all the solutions must follow the rules (satisfy the constraints).

  • Constraints can be multi-nary and soft constraints.

Constraint Hypergraph for the challenge question

AI 笔记 Week 05 Constraint Satisfaction_第7张图片
image.png

Backtracking Search

AI 笔记 Week 05 Constraint Satisfaction_第8张图片
psuedo code
AI 笔记 Week 05 Constraint Satisfaction_第9张图片
Example
  • backtrack search is like depth-first search, it goes deeper and deeper until it reaches a "dead-end"
  • In case of dead-end, the algorithm backtrack up to the upper division to try another branch.
  • repeat these steps until the solution is reached.

There are ways to improve the search efficiency

  1. choose the least constraining value for each step
  2. choose the variable with the fewest legal values
AI 笔记 Week 05 Constraint Satisfaction_第10张图片
Least constraining value
  • in the image above, in the branching step, which area should we choose to color? Least constrain value will choose the right-upper corner because it has more color to choose from. if we choose orange again, we will leave green to be unused (or lest constrained).
AI 笔记 Week 05 Constraint Satisfaction_第11张图片
Minimum remaining values

[Minimum remaining values]: or we can choose the middle-lower region because it has the least color to choose from.


AI 笔记 Week 05 Constraint Satisfaction_第12张图片
Degree Heuristic

When there is a tie, a heuristic could be used to select the next step/ area to explore.

quiz

AI 笔记 Week 05 Constraint Satisfaction_第13张图片
quiz
  • we can use minimal remain values to choose the region adjacent to the red and blue blocks because this will make it region only have 2 colors to choose from (minimum remaining values)
  • Or we can choose the one on the top if it since it only has one color to choose from (least constraining values) since it only have Green to use.

forward checking

  • we can also use forward checking as a warning system for dead-end branches
AI 笔记 Week 05 Constraint Satisfaction_第14张图片
forward checking
  • forward checking keeps track of the available domain for each variable in each step
  • a dead-end is reached when there is no domain for an unresolved variable.
AI 笔记 Week 05 Constraint Satisfaction_第15张图片
Arc Consistency
  • Arc Consistency: all the variables have at least a value in the possible domain.
  • Neighbors should not have the same color, thus a selection of a color can have a chain effect on the domain for variables.
  • when we find a region has no value available to assign, return 'Failure' to the problem.

AI 笔记 Week 05 Constraint Satisfaction_第16张图片
quiz

Question: select all the possible values for each region and indicate whether the entire network arc consistent or not.

Structured CSPs

AI 笔记 Week 05 Constraint Satisfaction_第17张图片
Structured CSPs
AI 笔记 Week 05 Constraint Satisfaction_第18张图片
Conditioned CSP as tree
  • How fast the algorithm will be?

Iterative Algorithms

AI 笔记 Week 05 Constraint Satisfaction_第19张图片
Iterative Algorithms
  • Iterative Algorithms works very well then the solutions are plenty or very few.
  • the problem becomes hard to solve when the ratio of constraints and solutions reaches a critical ratio
AI 笔记 Week 05 Constraint Satisfaction_第20张图片

the challenge question

AI 笔记 Week 05 Constraint Satisfaction_第21张图片
challenge question

can be resolved by forward-checking: checking the available domains for values.

s Readings

AIMA: Chapter 6

你可能感兴趣的:(AI 笔记 Week 05 Constraint Satisfaction)