Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no...
Transcript of Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no...
![Page 1: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/1.jpg)
Introduction to Artificial Intelligence
with Python
![Page 2: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/2.jpg)
Optimization
![Page 3: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/3.jpg)
optimization
choosing the best option from a set of options
![Page 4: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/4.jpg)
local search
search algorithms that maintain a single node and searches by moving to a neighboring node
![Page 5: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/5.jpg)
B
A
![Page 6: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/6.jpg)
B
![Page 7: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/7.jpg)
![Page 8: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/8.jpg)
Cost: 17
![Page 9: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/9.jpg)
state-space landscape
![Page 10: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/10.jpg)
global maximumobjective function
![Page 11: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/11.jpg)
global minimumcost function
![Page 12: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/12.jpg)
current state
![Page 13: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/13.jpg)
neighbors
![Page 14: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/14.jpg)
Hill Climbing
![Page 15: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/15.jpg)
![Page 16: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/16.jpg)
![Page 17: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/17.jpg)
![Page 18: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/18.jpg)
![Page 19: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/19.jpg)
![Page 20: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/20.jpg)
![Page 21: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/21.jpg)
![Page 22: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/22.jpg)
![Page 23: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/23.jpg)
![Page 24: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/24.jpg)
![Page 25: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/25.jpg)
![Page 26: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/26.jpg)
Hill Climbing
function HILL-CLIMB(problem): current = initial state of problem repeat: neighbor = highest valued neighbor of current if neighbor not better than current: return current current = neighbor
![Page 27: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/27.jpg)
Cost: 17
![Page 28: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/28.jpg)
Cost: 17
![Page 29: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/29.jpg)
Cost: 17
![Page 30: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/30.jpg)
Cost: 15
![Page 31: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/31.jpg)
Cost: 13
![Page 32: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/32.jpg)
Cost: 11
![Page 33: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/33.jpg)
Cost: 9
![Page 34: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/34.jpg)
![Page 35: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/35.jpg)
global maximum
![Page 36: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/36.jpg)
local maxima
![Page 37: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/37.jpg)
global minimum
![Page 38: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/38.jpg)
local minima
![Page 39: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/39.jpg)
![Page 40: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/40.jpg)
![Page 41: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/41.jpg)
![Page 42: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/42.jpg)
![Page 43: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/43.jpg)
![Page 44: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/44.jpg)
flat local maximum
![Page 45: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/45.jpg)
shoulder
![Page 46: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/46.jpg)
Variant Definition
steepest-ascent choose the highest-valued neighbor
stochasticchoose randomly from higher-valued
neighbors
first-choice choose the first higher-valued neighbor
random-restart conduct hill climbing multiple times
local beam search chooses the k highest-valued neighbors
Hill Climbing Variants
![Page 47: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/47.jpg)
Simulated Annealing
![Page 48: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/48.jpg)
![Page 49: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/49.jpg)
![Page 50: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/50.jpg)
![Page 51: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/51.jpg)
![Page 52: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/52.jpg)
![Page 53: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/53.jpg)
![Page 54: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/54.jpg)
![Page 55: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/55.jpg)
![Page 56: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/56.jpg)
Simulated Annealing
• Early on, higher "temperature": more likely to accept neighbors that are worse than current state
• Later on, lower "temperature": less likely to accept neighbors that are worse than current state
![Page 57: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/57.jpg)
Simulated Annealingfunction SIMULATED-ANNEALING(problem, max): current = initial state of problem for t = 1 to max: T = TEMPERATURE(t) neighbor = random neighbor of current ΔE = how much better neighbor is than current if ΔE > 0: current = neighbor with probability eΔE/T set current = neighbor return current
![Page 58: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/58.jpg)
Traveling Salesman Problem
![Page 59: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/59.jpg)
![Page 60: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/60.jpg)
![Page 61: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/61.jpg)
![Page 62: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/62.jpg)
![Page 63: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/63.jpg)
![Page 64: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/64.jpg)
![Page 65: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/65.jpg)
![Page 66: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/66.jpg)
Linear Programming
![Page 67: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/67.jpg)
Linear Programming
• Minimize a cost function c1x1 + c2x2 + ... + cnxn
• With constraints of form a1x1 + a2x2 + ... + anxn ≤ b or of form a1x1 + a2x2 + ... + anxn = b
• With bounds for each variable li ≤ xi ≤ ui
![Page 68: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/68.jpg)
Linear Programming Example
• Two machines X1 and X2. X1 costs $50/hour to run, X2 costs $80/hour to run. Goal is to minimize cost.
• X1 requires 5 units of labor per hour. X2 requires 2 units of labor per hour. Total of 20 units of labor to spend.
• X1 produces 10 units of output per hour. X2 produces 12 units of output per hour. Company needs 90 units of output.
![Page 69: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/69.jpg)
Linear Programming Example
• Two machines X1 and X2. X1 costs $50/hour to run, X2 costs $80/hour to run.
• X1 requires 5 units of labor per hour. X2 requires 2 units of labor per hour. Total of 20 units of labor to spend.
• X1 produces 10 units of output per hour. X2 produces 12 units of output per hour. Company needs 90 units of output.
50x1 + 80x2Cost Function:
![Page 70: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/70.jpg)
Linear Programming Example
• Two machines X1 and X2. X1 costs $50/hour to run, X2 costs $80/hour to run.
• X1 requires 5 units of labor per hour. X2 requires 2 units of labor per hour. Total of 20 units of labor to spend.
• X1 produces 10 units of output per hour. X2 produces 12 units of output per hour. Company needs 90 units of output.
50x1 + 80x2Cost Function:
5x1 + 2x2 ≤ 20Constraint:
![Page 71: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/71.jpg)
Linear Programming Example
• Two machines X1 and X2. X1 costs $50/hour to run, X2 costs $80/hour to run.
• X1 requires 5 units of labor per hour. X2 requires 2 units of labor per hour. Total of 20 units of labor to spend.
• X1 produces 10 units of output per hour. X2 produces 12 units of output per hour. Company needs 90 units of output.
50x1 + 80x2Cost Function:
5x1 + 2x2 ≤ 20Constraint:
10x1 + 12x2 ≥ 90Constraint:
![Page 72: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/72.jpg)
Linear Programming Example
• Two machines X1 and X2. X1 costs $50/hour to run, X2 costs $80/hour to run.
• X1 requires 5 units of labor per hour. X2 requires 2 units of labor per hour. Total of 20 units of labor to spend.
• X1 produces 10 units of output per hour. X2 produces 12 units of output per hour. Company needs 90 units of output.
50x1 + 80x2Cost Function:
5x1 + 2x2 ≤ 20Constraint:
(−10x1) + (−12x2) ≤ − 90Constraint:
![Page 73: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/73.jpg)
Linear Programming Algorithms
• Simplex
• Interior-Point
![Page 74: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/74.jpg)
Constraint Satisfaction
![Page 75: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/75.jpg)
1
2
3
4
Student:
![Page 76: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/76.jpg)
1
2
3
4
Student: Taking classes:
A B C
B D E
C E F
E F G
![Page 77: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/77.jpg)
1
2
3
4
Student: Taking classes:
A B C
B D E
C E F
E F G
Exam slots:
Monday
Tuesday
Wednesday
![Page 78: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/78.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 79: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/79.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 80: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/80.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 81: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/81.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 82: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/82.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 83: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/83.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 84: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/84.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 85: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/85.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 86: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/86.jpg)
1
2
3
4
A B C
B D E
C E F
E F G
A
B C
D
E
F
G
![Page 87: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/87.jpg)
A
B C
D
E
F
G
![Page 88: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/88.jpg)
Constraint Satisfaction Problem
• Set of variables {X1, X2, ..., Xn}
• Set of domains for each variable {D1, D2, ..., Dn}
• Set of constraints C
![Page 89: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/89.jpg)
Variables
{(0, 2), (1, 1), (1, 2), (2, 0), ...}
Domains
{1, 2, 3, 4, 5, 6, 7, 8, 9}for each variable
Constraints
{(0, 2) ≠ (1, 1) ≠ (1, 2) ≠ (2, 0), ...}
5 3 7
6 1 9 5
9 8 6
8 6 3
4 8 3 1
7 2 6
6 2 8
4 1 9 5
8 7 9
![Page 90: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/90.jpg)
A
B C
D
E
F
G
Variables
{A, B, C, D, E, F, G}
Domains
{Monday, Tuesday, Wednesday}for each variable
Constraints{A≠B, A≠C, B≠C, B≠D, B≠E, C≠E,
C≠F, D≠E, E≠F, E≠G, F≠G}
![Page 91: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/91.jpg)
hard constraints
constraints that must be satisfied in a correct solution
![Page 92: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/92.jpg)
soft constraints
constraints that express some notion of which solutions are preferred over others
![Page 93: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/93.jpg)
A
B C
D
E
F
G
![Page 94: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/94.jpg)
unary constraint
constraint involving only one variable
![Page 95: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/95.jpg)
unary constraint
{A ≠ Monday}
![Page 96: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/96.jpg)
binary constraint
constraint involving two variables
![Page 97: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/97.jpg)
binary constraint
{A ≠ B}
![Page 98: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/98.jpg)
node consistency
when all the values in a variable's domain satisfy the variable's unary constraints
![Page 99: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/99.jpg)
A B
{Mon, Tue, Wed} {Mon, Tue, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 100: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/100.jpg)
A B
{Mon, Tue, Wed} {Mon, Tue, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 101: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/101.jpg)
A B
{Tue, Wed} {Mon, Tue, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 102: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/102.jpg)
A B
{Tue, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
{Mon, Tue, Wed}
![Page 103: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/103.jpg)
A B
{Tue, Wed} {Mon, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 104: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/104.jpg)
A B
{Tue, Wed} {Mon, Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 105: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/105.jpg)
A B
{Tue, Wed} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 106: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/106.jpg)
A B
{Tue, Wed} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 107: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/107.jpg)
arc consistency
when all the values in a variable's domain satisfy the variable's binary constraints
![Page 108: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/108.jpg)
arc consistency
To make X arc-consistent with respect to Y, remove elements from X's domain until every choice for X has a possible choice for Y
![Page 109: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/109.jpg)
A B
{Tue, Wed} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 110: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/110.jpg)
A B
{Tue, Wed} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 111: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/111.jpg)
A B
{Tue} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 112: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/112.jpg)
A B
{Tue} {Wed}
{A ≠ Mon, B ≠ Tue, B ≠ Mon, A ≠ B}
![Page 113: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/113.jpg)
Arc Consistency
function REVISE(csp, X, Y): revised = false for x in X.domain: if no y in Y.domain satisfies constraint for (X, Y): delete x from X.domain revised = true return revised
![Page 114: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/114.jpg)
Arc Consistencyfunction AC-3(csp): queue = all arcs in csp while queue non-empty: (X, Y) = DEQUEUE(queue) if REVISE(csp, X, Y): if size of X.domain == 0: return false for each Z in X.neighbors - {Y}: ENQUEUE(queue, (Z, X)) return true
![Page 115: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/115.jpg)
A
B C
D
E
F
G
![Page 116: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/116.jpg)
A
B C
D
E
F
G
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 117: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/117.jpg)
Search Problems
• initial state
• actions
• transition model
• goal test
• path cost function
![Page 118: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/118.jpg)
CSPs as Search Problems
• initial state: empty assignment (no variables)
• actions: add a {variable = value} to assignment
• transition model: shows how adding an assignment changes the assignment
• goal test: check if all variables assigned and constraints all satisfied
• path cost function: all paths have same cost
![Page 119: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/119.jpg)
Backtracking Search
![Page 120: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/120.jpg)
Backtracking Searchfunction BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} from assignment return failure
![Page 121: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/121.jpg)
A
B C
D
E
F
G
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 122: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/122.jpg)
A
B C
D
E
F
G
Mon
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 123: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/123.jpg)
A
B C
D
E
F
G
Mon
Mon
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 124: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/124.jpg)
A
B C
D
E
F
G
Mon
Mon
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 125: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/125.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 126: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/126.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 127: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/127.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 128: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/128.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 129: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/129.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Tue {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 130: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/130.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Tue {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 131: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/131.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 132: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/132.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Mon
![Page 133: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/133.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Mon
![Page 134: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/134.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Tue
![Page 135: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/135.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Tue
![Page 136: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/136.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Wed
![Page 137: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/137.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
Wed
![Page 138: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/138.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
Wed {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 139: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/139.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 140: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/140.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 141: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/141.jpg)
A
B C
D
E
F
G
Mon
Tue
Tue
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 142: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/142.jpg)
A
B C
D
E
F
G
Mon
Tue
Tue
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 143: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/143.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 144: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/144.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 145: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/145.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
Mon
![Page 146: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/146.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
Mon
![Page 147: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/147.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
Tue
![Page 148: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/148.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
Tue
![Page 149: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/149.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
{Mon, Tue, Wed}
Wed
![Page 150: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/150.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
Mon
Wed
![Page 151: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/151.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
Mon
Wed
![Page 152: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/152.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon {Mon, Tue, Wed}
Tue
Wed
![Page 153: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/153.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Mon
Tue
Wed
![Page 154: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/154.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Mon
Tue
Wed
![Page 155: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/155.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Tue
Tue
Wed
![Page 156: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/156.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Tue
Tue
Wed
![Page 157: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/157.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Wed
Tue
Wed
![Page 158: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/158.jpg)
Inference
![Page 159: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/159.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 160: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/160.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 161: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/161.jpg)
A
B C
D
E
F
G
Mon
Tue
Mon
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 162: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/162.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 163: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/163.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Wed}
![Page 164: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/164.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Tue, Wed}
{Mon} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Wed}
![Page 165: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/165.jpg)
A
B C
D
E
F
G
Mon
Tue
{Wed}
{Mon} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Wed}
![Page 166: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/166.jpg)
A
B C
D
E
F
G
Mon
Tue
{Wed}
{Mon} {Mon, Tue, Wed}
{Tue}
{Wed}
![Page 167: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/167.jpg)
A
B C
D
E
F
G
Mon
Tue
{Wed}
{Mon} {Wed}
{Tue}
{Wed}
![Page 168: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/168.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Wed
Tue
Wed
![Page 169: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/169.jpg)
maintaining arc-consistency
algorithm for enforcing arc-consistency every time we make a new assignment
![Page 170: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/170.jpg)
maintaining arc-consistency
When we make a new assignment to X, calls AC-3, starting with a queue of all arcs (Y, X) where Y is a neighbor of X
![Page 171: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/171.jpg)
function BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment inferences = INFERENCE(assignment, csp) if inferences ≠ failure: add inferences to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} and inferences from assignment return failure
![Page 172: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/172.jpg)
function BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment inferences = INFERENCE(assignment, csp) if inferences ≠ failure: add inferences to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} and inferences from assignment return failure
![Page 173: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/173.jpg)
function BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment inferences = INFERENCE(assignment, csp) if inferences ≠ failure: add inferences to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} and inferences from assignment return failure
![Page 174: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/174.jpg)
SELECT-UNASSIGNED-VAR
• minimum remaining values (MRV) heuristic: select the variable that has the smallest domain
• degree heuristic: select the variable that has the highest degree
![Page 175: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/175.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Wed}
![Page 176: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/176.jpg)
A
B C
D
E
F
G
Mon
Tue
{Mon, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Wed}
![Page 177: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/177.jpg)
A
B C
D
E
F
G
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 178: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/178.jpg)
A
B C
D
E
F
G
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} {Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed}
![Page 179: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/179.jpg)
function BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment inferences = INFERENCE(assignment, csp) if inferences ≠ failure: add inferences to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} and inferences from assignment return failure
![Page 180: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/180.jpg)
function BACKTRACK(assignment, csp): if assignment complete: return assignment var = SELECT-UNASSIGNED-VAR(assignment, csp) for value in DOMAIN-VALUES(var, assignment, csp): if value consistent with assignment: add {var = value} to assignment inferences = INFERENCE(assignment, csp) if inferences ≠ failure: add inferences to assignment result = BACKTRACK(assignment, csp) if result ≠ failure: return result remove {var = value} and inferences from assignment return failure
![Page 181: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/181.jpg)
DOMAIN-VALUES
• least-constraining values heuristic: return variables in order by number of choices that are ruled out for neighboring variables
• try least-constraining values first
![Page 182: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/182.jpg)
A
B C
D
E
F
G
Mon
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} Wed
{Mon, Tue}
{Tue, Wed}
![Page 183: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/183.jpg)
A
B C
D
E
F
G
Mon
{Mon, Tue, Wed}
{Mon, Tue, Wed}
{Mon, Tue, Wed} Wed
{Mon, Tue}
Wed
![Page 184: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/184.jpg)
A
B C
D
E
F
G
Mon
Tue
Wed
Mon Wed
Tue
Wed
![Page 185: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/185.jpg)
Problem Formulation
Local Search
50x1 + 80x2
5x1 + 2x2 ≤ 20(−10x1) + (−12x2) ≤ − 90
Linear Programming
Constraint Satisfaction
A
B C
D
E
F
G
![Page 186: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/186.jpg)
Optimization
![Page 187: Introduction to Artificial Intelligence · 2020-03-09 · •initial state: empty assignment (no variables) •actions: add a {variable = value} to assignment •transition model:](https://reader034.fdocuments.net/reader034/viewer/2022050516/5fa007eefdb8e008687e5522/html5/thumbnails/187.jpg)
Introduction to Artificial Intelligence
with Python