1 / 4

Implementing Maintaining Arc Consistency (MAC) with Backtracking in CSP

This document details the implementation of the Maintaining Arc Consistency (MAC) algorithm, integrated with backtracking for solving Constraint Satisfaction Problems (CSP). Unlike traditional backtracking, MAC utilizes interleaved calls to the AC-3 algorithm to maintain consistency during the search process. The Recursive-Backtracking function is defined to explore variable assignments based on given constraints, while the Min-Conflicts heuristic offers an efficient approach to find solutions by minimizing conflicts in a specified number of steps.

teigra
Télécharger la présentation

Implementing Maintaining Arc Consistency (MAC) with Backtracking in CSP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Maintaining Arc Consistency (MAC) MAC is the same as Back-tracking, but with calls to AC-3 interleaved... function Backtracking-Search(csp) returns solution/failure return Recursive-Backtracking({ }, csp, domains) function Recursive-Backtracking(assignment,csp,domains) returns domains/failure if assignment is complete then return assignment var Select-Unassigned-Variable(Variables[csp], assignment, csp) for each value in Order-Domain-Values(var, assignment, csp) do if value is consistent with assignment given Constraints[csp] then add {var = value} to assignment reduced_domains  AC-3(assignment,csp) // check for failure too result Recursive-Backtracking(assignment, csp, reduced_domains) if result  failure then return result remove {var = value} from assignment return failure

  2. function Min-Conflicts(csp,max_steps) returns soln/failure current  complete, random initial var assignment for i=1 to max_steps do if current is a solution (satisfies all constraints) then return current var randomly chosen conflicted variable val value that minimizes Conflicts(var,val,current,csp) current current  {var=val} return failure (or best assignment found)

More Related