Artificial Intelligence A Modern Approach (3rd Ed.): Figure 6.8, Page 221.
function MIN-CONFLICTS(csp, max-steps) returns a solution or failure inputs: csp, a constraint satisfaction problem max-steps, the number of steps allowed before giving up current = an initial complete assignment for csp for i = 1 to max steps do if current is a solution for csp then return current var = a randomly chosen conflicted variable from csp.VARIABLES value = the value v for var that minimizes CONFLICTS(var, v, current, csp) set var = value in current return failure
Figure 6.8 The MIN-CONFLICTS algorithm for solving CSPs by local search. The initial state may be chosen randomly or by a greedy assignment process that chooses a minimal-conflict value for each variable in turn. The CONFLICTS function counts the number of constraints violated by a particular value, given the rest of the current assignment.
@author Ruediger Lunde
@author Mike Stampone