IIMT ALUMNI 2014 INFORMATION TECHNOLOGY BATCH Click here
Thursday, November 28, 2019
Wednesday, November 13, 2019
Program 8 Write a program to solve traveling salesman problem
Program:
road("A","B",200).
road("C","A",300).
road("B","C",100).
road("B","D",120).
road("C","D",130).
route(Town1 , Town2 , Distance):-road(Town1, Town2 , Distance).
route(Town1 , Town2 , Distance):-road(Town1, X , Distance1),route(X , Town2 , Distance2) , Distance is Distance1+Distance2,!.
Output-
Goal-Find the distance between A and B.
?- route("A", "B", Distance).
Distance = 200 ;
Distance = 800.
Goal-Find the distance between A and D.
?- route("A", "D", Distance).
Distance = 320.
Thursday, November 7, 2019
Sunday, November 3, 2019
Subscribe to:
Posts (Atom)