Thursday, November 28, 2019

Contact information (2013-14 Batch)


IIMT ALUMNI 2014 INFORMATION TECHNOLOGY BATCH Click here

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

Sunday, October 6, 2019

ARTIFICIAL INTELLIGENCE (AI) Unit 2 Assignment


AI Unit 2 Assignment: To Download click here

Submit the assignment on or before 24/10/2019

Monday, September 30, 2019

Saturday, September 28, 2019

Program 6 WAP to implement Factorial, Fibonacci of a given number.


Factorial -
Program-
factorial(0,1).
factorial(N,F):-
N>0,
N1 is N-1,
factorial(N1,F1),
F is N * F1.
Goal- To find Factorial of the number.
Output-


Fibonacci-
Program-
fib(0, 1) :- !.
fib(1, 1) :- !.
fib(N, F) :-
N > 1,
N1 is N-1,
N2 is N-2,
fib(N1, F1),
fib(N2, F2),
F is F1+F2
Goal- To find Fibonacci number.
Output-


Program 5 WAP in turbo prolog for medical diagnosis and show the advantage and disadvantage of green and red cuts.



Will be uploaded soon...............


Program 4 Write a program to solve the Monkey Banana problem.


Explanation- Assume that a room containing a Monkey, a Table and a Banana. The Banana is hanging from the ceiling of the room. Table is not below the banana. Monkey is anywhere in the room. In this program/problem we will prove that monkey can grasp the banana. If the monkey is clever he can grasp the banana by placing the table below the banana. Monkey only can reach the banana if he jumps from the table, otherwise he cannot reach to banana by jumping from floor or anywhere in room (except table). Monkey (strong monkey) can push the table.

Program-
on(floor,monkey).
on(fllor,box).
in(room,monkey).
in(room,box).
in(room,banana).
at(ceiling,banana).
strong(monkey).
grasp(monkey).
climb(monkey,box).
push(monkey,box):-strong(monkey).
under(banana,box):-push(monkey,box).
canreach(banana,monkey):-at(floor,banana); at(ceiling,banana),under(banana,box),climb(monkey,box).
canget(banana,monkey):-canreach(banana,monkey),grasp(monkey).

Goal Monkey can grasp (reach) the banana
Output-

Program 3 Write predicates one converts Centigrade temperatures to Fahrenheit, the other checks if a temperature is below freezing.


Formula for Centigrade (C) temperatures to Fahrenheit (F) -
F = C * 9 / 5 + 32
Rule
Centigrade to Fahrenheit (c_to_f)F is C * 9 / 5 + 32

Program-
c_to_f(C,F) :-F is C * 9 / 5 + 32.
% here freezing point is less than 32 Fahrenheit
freezing (F) :-F =< 32.

Goal to find Fahrenheit temperature and freezing point
Output-

Program 2 Write simple fact for the statements using PROLOG.



Statements:
1. The Cakes are delicious.
2. The Pickles are delicious.
3. The Pickles are spicy.
4. Priya relishes coffee.
5. Priya likes food if they are delicious.
6. Prakash likes food if they are spicy and delicious.

Statements in Prolog:
1. delicious(cakes).
2. delicious(pickles).
3. spicy( pickles).
4. relishes(priya, coffee).
5. likes(priya, Food) if delicious(Food). %Here Food is a variable
6. likes(prakash,Food) if spicy(Food) and delicious(Food).

Program Clauses:
delicious(cakes).
delicious(pickles).
spicy(pickles).
relishes(priya, coffee).
% here Food is a variable
likes(priya, Food):-delicious(Food).
likes(prakash, Food):- spicy(Food), delicious(Food).

Goal 1- Which food items are delicious.
Output-


Goal 2- What food does priya like.
Output-


Goal 3 what food does Prakash like.
Output-

Program 1 How to install SWI-Prolog in windows 10.


Step 1 Download SWI-Prolog click here.

Step 2 Run the Installer (Follow the instruction given on the installer).

Step 3 Open the SWI-Prolog.

Step 4 Click on File (in menu) File-->New (a new window will open save it by any name with extension .pl ). A new window will open you can write your program here. After writing the program select compile (in menu in the same window) and click on “make” and again click on “compile buffer”.

Step 4 Run the query on the SWI-Prolog window.