# Answer to Question #29452 in Perl for gagan

Question #29452

Describe the CSP to solve a map colouring problem using the solver from csp.pl. (Steps: Find a representation for map area adjacency, define a colour domain, run some example maps.)

Computational Intelligence: a logical approach.

% Prolog Code.

% A CSP solver using arc consistency

% Copyright (c) 1998, Poole, Mackworth, Goebel and Oxford University Press.

% csp(Domains, Relations) means that each variable has

% an instantiation to one of the values in its Domain

% such that all the Relations are satisfied.

% Domains represented as list of

% [dom(V,[c1,...,cn]),...]

% Relations represented as [rel([X,Y],r(X,Y)),...]

% for some r

csp(Doms,Relns) :-

ac(Doms,Relns).

% ac(Dom,Relns) is true if the domain constrants

% specified in Dom and the binary relations

% constraints specified in Relns are satisfied.

ac(Doms,Relns) :-

make_arcs(Relns,A),

consistent(Doms,[],A,A).

% make_arcs(Relns, Arcs) makes arcs Arcs corresponding to

% relations R

Computational Intelligence: a logical approach.

% Prolog Code.

% A CSP solver using arc consistency

% Copyright (c) 1998, Poole, Mackworth, Goebel and Oxford University Press.

% csp(Domains, Relations) means that each variable has

% an instantiation to one of the values in its Domain

% such that all the Relations are satisfied.

% Domains represented as list of

% [dom(V,[c1,...,cn]),...]

% Relations represented as [rel([X,Y],r(X,Y)),...]

% for some r

csp(Doms,Relns) :-

ac(Doms,Relns).

% ac(Dom,Relns) is true if the domain constrants

% specified in Dom and the binary relations

% constraints specified in Relns are satisfied.

ac(Doms,Relns) :-

make_arcs(Relns,A),

consistent(Doms,[],A,A).

% make_arcs(Relns, Arcs) makes arcs Arcs corresponding to

% relations R

Expert's answer

Unfortunately, your question requires a lot of work and cannot be done for free.

Submit it with all requirements as an assignment to our control panel and we'll assist you.

Submit it with all requirements as an assignment to our control panel and we'll assist you.

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment