Devam Ediyor

Program in Swi Prolog - depthfirst and breadthfirst


I need a program in Swi Prolog which will execute the algorithm of search in depth and in breadth for making a search of a path where an agent will follow in a frame NxN. The agent can go up, down, right , left inside the limits of the frame.

The program must execute two basic predicates (commands)

depthfirst(CurrentPos, FinalPos, Visited, Path)


breadthfirst(CurrentPos, FinalPos, Visited, Path)

for the two searches and what else is needed.

[url removed, login to view] the search of the path from the cell [2,3] to [4,4] with depthfirst will write: depthfirst(p(2,3), p(4,4),[],Path) and Prolog must return the result through the path. The Visited is initially null and gradually contains the positions already visited by our agent. Used to avoid places already visited.

To analyze the function of two predicates, using an example moving from point 2,3 to 4,4 in a frame of 5x5.

In deptfirst search is needed:

move from pos(X,Y) to pos(X+1,Y)

size(5) for N=5

move(pos(X,Y),pos(X1,Y1)):-size(N),X1 is .......

For the breadth:

memory retention by using assert and retract

state(pos(X,Y)),[...path from the beginning to X,Y])and the frontier will have states with the order in which will returned.

The program should be with comments.

Thanks in advanced.

Beceriler: Prolog

Daha fazlasını görün: depth path prolog, swi prolog breadth, return path, program algorithm example, program algorithm, pos algorithm, path algorithm, making algorithm, example algorithm, depth search algorithm, breadth search algorithm, beginning algorithm, search algorithm example, algorithm function, algorithm example, advanced algorithm, swi prolog agent, retention, null, depth breadth, algorithm search, breadth depth, inside order, program using algorithm, agent program

İşveren Hakkında:
( 8 değerlendirme ) kozani, Greece

Proje NO: #690540



Hello! I can do your project. Please see PM

1 gün içinde 30$ USD
(1 Değerlendirme)