constraintSat.example

# constraintSat.example - To choose a variable Choose the...

This preview shows pages 1–2. Sign up to view the full content.

To choose a variable: Choose the variable with the minimum remaining values ("MRV" heuristic) most constrained we'll find out sooner if the current assignment is doomed to fail Tie, choose the variable that is involved in the most constraints with other variables ("degree" heuristic) Suppose a variable has been chosen. Under the "least-constraining-value" heuristic for ordering values prefer the value that rules out the fewest choices for the neighboring variables in the constraint graph. In this cryptarithmetic problem, each letter stands for a different number between 1 and 9. Representing this as a CSP: two two ------- four Variables: t, w, o, f, u, r, c1, c2, c3 The C* variables are the carries, numbered from the right. The carries may be 0-8; the letters may be 1-9 Constraints: alldiff(t, w, o, f, u, r) o + o = r + c1 * 10 w + w + c1 = u + c2 * 10 t + t + c2 = o + c3 * 10 f = c3 Assignment = {} Choose next variable: MRV, all ties Degree: stop and think; which would you choose? Suppose you choose f. It only shares constraints with c3 and the other letters. So, it has more successors than any other variable. Let's choose another variable, with fewer successors. Less of the state space to search! Which has highest degree: My proposal for a definition of the degree of variable V: sum = 0 for all square boxes B connected to V: sum += number of edges of B - 1 degree(f) = 5 + 1 = 6 degree(c2) = 3 + 3 = 6 degree(w) = 5 + 3 = 8

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

constraintSat.example - To choose a variable Choose the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online