You are on page 1of 30

JOMO KENYATTA UNIVERSITY OF AGRICULTURE AND TECHNOLOGY

BACHELOR OF BUSINESS INFORMATION TECHNOLOGY

ARTIFICIAL INTELLIGENCE GROUP WORK: GROUP E

JOAN WAMBUI HDB212-0302/2019 NO. 32

VICTOR MACHIO HDB212-0335/2019 NO. 34

JOAN WANJIRU MWANGI HDB 212-0252/2019 NO. 2

BRIAN NDEGWA HDB212-0221/2019 NO. 31

KEITH NAMUTALA HDB212-0374/2019 NO. 23

SAMUEL MWAURA MWANGI HDB 212-0306/2019 NO. 24

JAMES LILECHI HDB212-0810/2020 NO.44

MERCY WAIRIMU HDB212-0812/2020 NO. 33

CYNTHIA MUTUKU HDB212-0301/2019 NO. 35

BRIAN MACHARIA HDB212-0251/2019 NO. 43


Table of Contents
Problem Solving Techniques in Artificial Intelligence (AI)........................................................4
Agents in AI.................................................................................................................................4
Problem Solving Techniques.......................................................................................................5
1. Heuristics..............................................................................................................................5
2. Searching Algorithms...........................................................................................................5
i. Informed Search....................................................................................................................6
ii. Uninformed Search...............................................................................................................6
3. Evolutionary Computation....................................................................................................6
4. Genetic Algorithms...............................................................................................................7
Applications of AI in Real World................................................................................................8
Problem-solving in AI..................................................................................................................9
Problem Formulation in AI........................................................................................................10
Problem-Solving Agents............................................................................................................10
Problem-solving steps................................................................................................................10
AI methods of problem-solving.................................................................................................11
Types of Intelligence..................................................................................................................11
Types of AI................................................................................................................................12
1. Reactive Machines..............................................................................................................12
2. Limited Memory.................................................................................................................12
3. Theory of Mind...................................................................................................................13
4. Self-aware AI......................................................................................................................13
5. Artificial Narrow Intelligence(ANI)...................................................................................13
6. Artificial General Intelligence (AGI).................................................................................13
7. Artificial Super Intelligence (ASI).....................................................................................14
Components of KBS..................................................................................................................14
Types of Knowledge-Based Systems.........................................................................................15
Uses of Knowledge-Based Systems...........................................................................................15
Benefits of Knowledge Based Systems.....................................................................................16
Challenges of Knowledge Based Systems.................................................................................16
Semantic Networks....................................................................................................................17

2
Components Of Semantic Network...........................................................................................17
Classification Of Semantic Networks........................................................................................17
Advantage of Semantic Networks in AI....................................................................................18
Example of Semantic Networks.................................................................................................19
Prolog.........................................................................................................................................19
Basic prolog program.................................................................................................................20
Applications of Prolog...............................................................................................................21
Reasoning Methods....................................................................................................................21
Backward Chaining....................................................................................................................23
Forward Chaining......................................................................................................................24
REFERENCES............................................................................................................................27

3
Problem Solving Techniques in Artificial Intelligence (AI)
Problem-solving is commonly known as the method to reach the desired goal or find a solution
to a given situation.

Problem-solving in Artificial Intelligence usually refers to researching a solution to a problem by


performing logical algorithms, utilizing polynomial and differential equations, and executing
them using modeling paradigms. There can be various solutions to a single problem, which are
achieved by different heuristics. Also, some problems have unique solutions. It all depends on
the nature of the given problem.

Examples of Problems in Artificial Intelligence

Artificial Intelligence is being used worldwide to automate systems for efficient utilization of
time and resources. Some of the most common problems encountered daily are games and
puzzles. These can be solved efficiently by using artificial intelligence algorithms.

Some of the most common problems that artificial intelligence has resolved are the following:

Chess

N-Queen problem

Tower of Hanoi Problem

Travelling Salesman Problem

Water-Jug Problem

Agents in AI
There are five primary agents used in Artificial Intelligence based on their capability of
perceiving intelligence. These agents are the following:

Simple Reflex Agents

Model-Based Reflex Agents

Goal-Based Agents

Utility-Based Agents

4
Learning Agents

These agents prove helpful in the mapping of states and actions. However, while solving a
complex problem, these agents often fail to comprehend the next step adequately.

Thus, problem-solving agents solve such scenarios. These agents use techniques like B-tree and
heuristic algorithms to solve problems using artificial intelligence.

Problem Solving Techniques


Artificial Intelligence is beneficial for solving complex problems due to its efficient methods of
solving. Following are some of the standard problem-solving techniques used in AI.

1. Heuristics
The heuristic method helps comprehend a problem and devises a solution based purely on
experiments and trial and error methods. However, these heuristics do not often provide the best
optimal solution to a specific problem. Instead, these undoubtedly offer efficient solutions to
attain immediate goals.

Therefore, the developers utilize these when classic methods do not provide an efficient solution
for the problem. Since heuristics only provide time-efficient solutions and compromise accuracy,
these are combined with optimization algorithms to improve efficiency.

Example:

An AI system might be faced with a complex game board such as chess. The AI system could
utilize a heuristic problem-solving approach to discover the best move. This could involve
looking at the board and recognizing certain patterns or strategies that are likely to result in a
winning position.

2. Searching Algorithms
Searching is one of the primary methods of solving any problem in AI. Problem-solving agents
use these searching algorithms to find optimal solutions. These problem-solving agents are often
goal-based and utilize atomic representation. Moreover, these searching algorithms possess
completeness, optimality, time complexity, and space complexity properties based on the quality
of the solution provided by them.

5
There are following two main types of searching algorithms:

i. Informed Search
These algorithms use basic domain knowledge and comprehend available information about a
specified problem as a guide for optimal solutions. The solutions provided by informed search
algorithms are more efficient than uninformed search algorithms.

There are following main two types of informed search algorithms:

Greedy Search

A * Search

ii. Uninformed Search


Uninformed search algorithms, also known as blind search algorithms, are search algorithms that
do not take advantage of any problem-specific knowledge or search heuristics. Instead, they rely
solely on the information available in the problem definition.

The following are the main five types of uninformed search algorithms:

Breadth-First Search

Depth First Search

Uniform Cost Search

Iterative Deepening Depth First Search

Bidirectional Search

6
3. Evolutionary Computation
This problem-solving method utilizes the well-known evolution concept. The theory of evolution
works on the principle of survival of the fittest. It states that the organism which can cope well
with their environment in a challenging or changing environment and reproduce, their future
generations gradually inherit the coping mechanism, generating the diversity in new child
organisms. In this way, the new organisms are not mere copies of the old ones but have the
mixes of characteristics that go along with that harsh environment. Humans are the most
prominent example of the evolution process that has evolved and diversified because of the
accumulation of favorable mutations over countless generations.

In AI, the evolution concept refers to the trial-and-error technique:

Randomly change the old solution to come up with the new one. If it gives better results, then
keep and throw away the rest of the solutions. If not, then discard it. It is based on the idea that
any system can be improved through repeated refinement and testing. The goal of the evolution
concept is to create a system that is able to better adapt to its environment and achieve its desired
goals.

4. Genetic Algorithms
Genetic algorithms are based on the notion of evolution. Direct random search is the technique
used by these algorithms. To produce a desirable offspring, the developers cross the two fittest
possibilities using the fit function. In order to determine each person's fitness, the developers first
collect demographic statistics and examine each individual. The estimation is based on how well
each member matches the required specification. To keep the best members, developers use;

i. Rank Selection
ii. Tournament Selection
iii. Steady Selection
iv. Roulette Wheel Selection (Fitness Proportionate Selection)
v. Elitism

By relying on bio-inspired operations like mutation, crossover, and selection, developers


frequently use genetic algorithms to generate a high-level solution to optimization and search
problems. The strategies for solving problems aid in enhancing program performance. The AI-

7
based search algorithms deliver results with the highest degree of precision and accuracy. These
algorithms execute more quickly than others and provide different searching techniques based on
the issue at hand. In contrast to employing optimal algorithms, implementing heuristics enables
the creation of theoretically simpler algorithms with lower computational costs. Search and
optimization issues can also benefit from evolutionary computations.

8
Applications of AI in Real World
1. In Auto-vehicles

Given the high-profile accidents involving autonomous vehicles this year, AI in this field has the
potential to drastically lower highway fatalities and injuries. A study from a private university
found that self-driving cars may alter lives in addition to reducing traffic-related fatalities and
injuries. AI might have more free time to work or enjoy fun, and it might also have more
possibilities for where to base humans. According to the survey, the greater comfort and
decreased cognitive burden of self-driving cars and shared transportation can affect where
individuals choose to reside.

2. In wildlife

The ability to evaluate vast amounts of data, similar to what is done in healthcare, could alter
animal conservation. By keeping an eye on an animal's movements, for instance, humans can
learn where it goes and what ecosystems need to be protected. In order to find the optimum
places in Montana to establish wildlife corridors for wolverines and grizzly bears, this study
makes use of computers. Long expanses of protected land known as wildlife corridors link
biologically significant areas and allow animals to move freely through the wilderness.

3. In E-Commerce

Recommendation engines backed by AI are becoming more and more common in e-commerce
platforms like Spotify, Netflix, and Amazon. These systems assess user activity, search terms,
and previous purchases using machine learning algorithms to offer tailored product, movie, and
music recommendations. These systems can create recommendations based on the patterns and
preferences that certain users have by analyzing vast volumes of data. The recommendations get
better as the algorithm has access to more data, making it simpler for consumers to find new
products they might be interested in. This not only enhances user experience but also aids in
boosting client satisfaction and revenue for organizations.

9
4. In Healthcare

MRIs, CT scans, and X-rays are examples of advanced medical imaging that could benefit from
AI-powered picture processing in terms of better diagnosis accuracy. AI can be trained to spot
patterns and irregularities that the human eye might find too subtle to notice. AI systems, for
instance, can examine X-ray pictures to find lung cancer, mammograms to find breast cancer,
and brain scans to find tumors.

Medical Research: By evaluating enormous amounts of data, forecasting how medications will
function in the body, and identifying viable new drug candidates, AI can be utilized to speed up
the drug discovery process. For instance, the biotech business Insilico Medicine is utilizing AI to
create novel medications for a variety of illnesses, such as Alzheimer's and cancer.

A personalized treatment plan can be created for each patient based on their medical history,
genetics, lifestyle, and environmental factors with the aid of artificial intelligence (AI). For
instance, IBM Watson's Oncology Expert Advisor employs AI to offer patients with cancer
individualized therapy suggestions. It examines a patient's genetic makeup, medical history, and
other aspects to suggest therapies that are most likely to be successful.

Problem-solving in AI
Goal: During this phase, the AI agent sets a goal or a mark as soon as a problem arises. In order
to do this, the agent must carefully investigate and define the problem. This is an essential step
since all other measures used to attain the objective would be ineffective if the issue's aim was
poorly developed.

Problem description: The agent decides what actions must be taken whenever a problem arises in
order to reach the established goal. The following steps are used to achieve this:

Initiating the State: A state area can be thought of as a collection of all the precise circumstances
that an agent can be associated with when learning the crisis' solution.

 Choosing the Primary State-An agent must start from a state in order to solve a problem.
The primary state is where the agent starts acting and is where the action is directed.

10
 Gather Information—At this point, the agent gathers information that it will use to
address the problem. These facts will be gathered along with one-off instances and
current pieces of information.
 Designing the Changes: Some problems are small enough to be understood quickly.
However, the majority of the time, problems will be of a nature that requires careful
planning and execution. So far in advance, this requires adequate data structures and
management procedures.

Problem Formulation in AI
One of the fundamental steps in fixing an issue is deciding what action to take to carry out the
developed aim. The process of understanding and selecting an action that needs to be evaluated
in order to accomplish a goal is known as problem formulation. The complexity of actually
achieving the goal increases if an agent has more than one way to do it because there would be
so many different approaches and strategies the AI entity might take, which would cause chaos
and a drastic drop in efficiency.

Problem-Solving Agents
Testing with the Goal State: In this phase, the agent's results are compared to those of the goal
state. If the objective has been reached, the agents stop any further actions, and the problem
reaches its ultimate state. However, if the goal is not reached, the agent keeps looking for ways
to get there.

Calculating the Cost of the Traveled Path: Every time an agent uses a strategy to analyze a
circumstance, that strategy is given a monetary value (or cost). Then, a price function is used to
estimate these prices. Therefore, the agent's implementation action uses the estimated
consequence. The perfect solution is that which is attained at the lowest cost to the path.

Problem-solving steps
One of the key elements in AI problem solving that establishes the worth of the algorithm used
to resolve the issue is performance benchmark. The techniques used to determine how well an
algorithm is operating:

i. Totality - Totality determines the algorithm's probability of finding the answer to the
problem, if one exists.

11
ii. Optimality - This stage involves computing the tracking methods that find the best
answer to the problem at hand.
iii. Duration Complexity - This determines how long the algorithm will continue to run
before finding the solution to the given problem.
iv. Space Intricacy - the criterion used to determine how much memory (in space) the
algorithm will require to complete the task.

AI methods of problem-solving
AI problem-solving is becoming more and more common. Artificial intelligence is being used by
computer scientists to automate their daily tasks in order to save their activities and duration.
Games and puzzles serve as live simulations of the world around us. The most useful AI
algorithms can be applied to fix them. In the most popular competitions, like Chess,
mathematical puzzles like magic squares and crypto arithmetic are used. AI problem-solving is
being used to tackle each of these difficulties and produce the most effective solutions possible.

Artificial intelligence assists software engineers in producing flawless software and designing it
in accordance with the circumstances. With the help of artificial intelligence algorithms, dead-
end problems can now also be decoded. Utilize some of the agents when using AI to solve
problems. Different agents help to specify movements and circumstances. But when it comes to
solving complex problems in the real world, they typically lose their effectiveness.

There are many different types of problem-solving agents stated and used at an atomic class level
without any inner conditions that may be seen by an algorithm for solving problems. The exact
way the problem-solving agent works is by identifying problems and potential solutions.
Artificial intelligence that solves problems uses a variety of techniques, including heuristic
algorithms, B-trees, and trees.

Types of Intelligence
The 2 crucial factors based on which the various types of AI are categorized are functionality and
technology. The classification will take into consideration how the system functions and what
technology a system utilizes to perform them.

12
Types of AI
(Based on functionality):
1. Reactive Machines
2. Limited Memory
3. Theory of Mind
4. Self-Aware

(Based on technology):

5. Artificial Narrow Intelligence (ANI)


6. Artificial General Intelligence (AGI)
7. Artificial Super intelligence (ASI)

1. Reactive Machines
These are the oldest forms of AI systems with comparatively limited technical capabilities. The
machines do not function through a memory base yet they reproduce the abilities of the human
mind to respond to various types of simulation.

Reactive machines do not execute memory based functions thus they cannot use their previous
experiences to manage the current tasks assigned to them. The most important application of
these types of AI systems is to respond to a typical set of inputs immediately. However, they
cannot store their experiences and utilize the outcome for future reactions.

Examples of reactive AI include:

a. Spam filters for our email that keep promotions and phishing attempts out of our inboxes.
b. The Netflix recommendation engine

2. Limited Memory
Limited Memory learns from the past and builds experiential knowledge by observing actions or
data. It uses historical, observational data in combination with pre-programmed information to
make predictions and perform complex classification tasks. It is the mostly used kind of AI
today.

One of the most relevant example of limited memory AI systems can be the ‘fingerprint scanning
machine’. It restricts entry to only authorized people in an organization premise. The machine

13
analyses the features of a finger-print based on the stored data and reacts immediately. If the
finger-print matches a previously loaded image, the device opens the lock to let the person enter.

3. Theory of Mind
The theory of mind is still in its research and development phases. With this type of AI,
machines will acquire true decision-making capabilities that are similar to humans. Such
machines will be able to understand and remember emotions, then adjust behavior based on
those emotions as they interact with people.

Progress is being made on this type of AI systems. For example, in Hong Kong, humanoid robot
Sophia developed by Hanson Robotics can recognize faces and respond to interactions with her
own facial expressions.

4. Self-aware AI
They are among the lesser known types of AI that presently exist mainly as a theoretical idea.
Self-aware AI would be so developed and at par with the human brain that they would possess an
adequate amount of self-awareness and self-consciousness. They will be able to make inferences
(such as “ I’m feeling angry because someone cut me off in traffic”) that are not possible with
other types of AI.

5. Artificial Narrow Intelligence(ANI)


ANI is a kind of AI that refrains a computer to perform more than one operation at a time. It has
a limited playing field when it comes to performing multiple intellectual tasks in the same time
frame. It is also known as Weak AI as it functions under a predefined, limited set of constraints.

Some examples are Google Assistant, Alexa and Siri.

6. Artificial General Intelligence (AGI)


AGI is the future of digital technology where self-assist robots or cyborgs will emulate human
sensory movements. With AGI, machines will be able to see, respond to, and interpret external
information similar to the human nervous system.

This is quite close to imitating how the human brain functions. So, Artificial General Intelligence
is still evolving, and the result might be truly revolutionary for humans.

14
7. Artificial Super Intelligence (ASI)
ASI is a futuristic concept that would be a peak achievement in AI research. The AI system
would use vast amounts of memory to perform tasks and make decisions even better than human
beings.

The outstanding amount of memory, rapid processing capabilities, and accelerated pace of
intelligent decision-making would enable machines to perform complex tasks easily and in a
shorter span of time.

Components of KBS
KBS stands for Knowledge-Based System, which is a type of computer program that is designed
to solve problems by using a knowledge database and inference rules. The main goal of a KBS is
to simulate the problem-solving capabilities of a human expert in a specific domain. A KBS
typically consists of three main components namely: Knowledge base, Inference engine and User
interface.

Knowledge Base: This is the repository of information and data that the KBS uses to solve
problems. The knowledge base can include facts, heuristics, and rules.

An example of a knowledge base in function could be an expert system that is used to diagnose
diseases in a medical setting. The knowledge base of the expert system would contain
information on various diseases, their symptoms, and the medical tests that are used to diagnose
them.

Inference Engine: This is the component of the KBS that performs the reasoning process and
uses the knowledge base to generate solutions to problems.

Still on the diagnosis example, the inference engine of the system would use the information
input by the knowledge base to generate a diagnosis based on the symptoms and test results
entered by the user.

User Interface: This is the component of the KBS that allows the user to interact with the
system and provides a way for the user to enter information and receive results.

15
As for the user interface in this case the user is presented with a form that they can use to enter
symptoms, medical history, and test results.

Types of Knowledge-Based Systems


Expert Systems: Expert systems are KBSs that are designed to mimic the decision-making
ability of a human expert in a specific domain. They use a knowledge base of facts and rules to
solve problems and provide recommendations.

Decision Support Systems (DSS): DSSs are KBSs that provide support for decision-making by
presenting relevant information and analyzing it to support the decision-making process.

Intelligent Tutoring Systems (ITS): ITSs are KBSs that provide customized instruction and
feedback to students based on their learning needs and progress.

Natural Language Processing Systems (NLP): NLP systems are KBSs that are designed to
understand and process human language. They can be used for language translation, text
classification, and question-answering, among other applications.

Case-based systems use case-based reasoning: This involves reviewing past knowledge of
similar situations. Based on what it finds, the knowledge-based system provides solutions that
were effective in those given situations.

Hypertext manipulation systems store knowledge by linking text to other texts and by using
hypertext. Hypertext refers to a network of discrete blocks of information interconnected as a
way to store data. This type of system allows you to access many types of data easily.

Uses of Knowledge-Based Systems


Medical diagnosis: KBSs can be used in the field of medicine to diagnose diseases based on
symptoms, medical history, and test results.

Financial planning: KBSs can be used in finance to help individuals plan for their retirement,
manage their investments, and make other financial decisions.

Legal reasoning: KBSs can be used in law to analyses legal cases and provide recommendations
for legal decisions.

16
Manufacturing and production: KBSs can be used in manufacturing and production to
optimize processes, reduce waste, and improve efficiency.

Customer service: KBSs can be used in customer service to provide instant support and answers
to customers' questions.

Education and training: KBSs can be used in education and training to provide personalized
learning experiences and improve the efficiency of the learning process.

Environmental monitoring and management: KBSs can be used in environmental monitoring


and management to analyze data from sensors and provide insights into environmental
conditions.

Benefits of Knowledge Based Systems.


1. Accelerating delivery processes of goods and services for B2C organizations.
2. Assisting users in making expert decisions.
3. Creating new knowledge by reviewing existing data and stored knowledge.
4. Grouping data across different areas of expertise.
5. Handling significant amounts of structured and unstructured data intelligently and
efficiently.
6. Improving productivity and consistency with decision-making processes.
7. Integrating knowledge on a large scale to create a common platform for accessing
knowledge.
8. Providing efficient documentation of important data for users to access easily.
9. Serving as an expert resource with human experts are unavailable.
10. Storing data conveniently for future use.

Challenges of Knowledge Based Systems


1. Acquiring, organizing and manipulating large volumes of data and information
2. Experiences potential anomalies in the systems, such as redundant rules and circular
dependencies
3. Handling the limitations of scientific and cognitive techniques
4. Navigates the generally abstract nature of knowledge
5. Provides a system that is only as high quality as the data and information it contains

17
6. Requires accurate and extensive data to perform correctly.

Semantic Networks
Semantic networks are a type of artificial intelligence system that uses a structured network of
concepts and relationships between them to represent and reason about knowledge. They are a
type of knowledge representation method based on graph theory, which can be used to represent
different types of knowledge and relationships between them. Semantic networks are used to
represent knowledge in a way that is easier for machines to understand, and can be used to
generate inferences and draw conclusions.

Components Of Semantic Network


1. Nodes: Nodes are the basic components of a semantic network. Each node represents an
entity such as a concept, an object, a person, a place, or an event.
2. Links: Links are the connections between two or more nodes. The links represent the
relationship between the nodes, such as the parent-child relationships or the associations
between concepts.
8. Attributes: Attributes are the properties of the nodes. Each node can have one or more
attributes associated with it, such as a name, an age, or a color.
9. Rules: Rules are the logical statements that define the relationships between the nodes
and the links. Rules can be used to define the meaning of the nodes and links and to
ensure the consistency of the semantic network.

Classification Of Semantic Networks


Logical Representation: Logical representations are used to represent knowledge using a formal
logic system, such as first-order logic. These representations are used to represent facts and
relationships between those facts. The advantage of logical representations is that they can be
used to represent complex knowledge in a concise way, and they can also be used to infer new
knowledge from existing knowledge. The disadvantage of this approach is that it can be difficult
to represent certain types of knowledge in a logical form.

Semantic Network Representation: Semantic network representations are used to represent


knowledge as a network of nodes, where each node represents a concept and the links between
the nodes represent relationships between those concepts. The advantage of this approach is that

18
it can represent complex and dynamic knowledge in a visual way. The disadvantage is that it can
be difficult to represent certain types of knowledge in a semantic network form.

Frame Representation: Frame representations are used to represent knowledge in terms of


frames, where each frame contains a set of slot-value pairs. The advantage of this approach is
that it can represent complex and dynamic knowledge in a structured way. The disadvantage is
that it can be difficult to represent certain types of knowledge in a frame form.

Production Rules: Production rules are used to represent knowledge as a set of rules that
describe how certain actions should be taken in certain situations. The advantage of this
approach is that it can represent complex and dynamic knowledge in a concise way. The
disadvantage is that it can be difficult to represent certain types of knowledge in a rule-based
form.

Advantage of Semantic Networks in AI


Semantic networks are a type of artificial intelligence (AI) technology used to represent and store
knowledge in a way that a computer can understand. The main advantage of semantics network
in AI is that it provides a way to represent and store knowledge in a structured way, which makes
it easier for computers to understand and use.

The semantic network also allows for hierarchical representation of knowledge. This means that
knowledge can be represented in the form of a hierarchy, which makes it easier for computers to
access and use. For example, if someone is looking for information about a specific topic, they
can easily navigate through the hierarchy of information to find what they are looking for.

The semantic network also provides a way to represent relationships between concepts, which is
essential for more complex AI tasks. This allows for more efficient and accurate reasoning and
problem solving.

Finally, the semantic network allows for the representation of multiple levels of abstraction. This
means that different levels of detail can be represented, which allows computers to better
understand the information they are looking at. This is especially important for more complex AI
tasks, such as natural language processing.

19
20
Example of Semantic Networks
For example, a semantic network model could be used to represent a dog. The nodes in the
network might include "dog," "golden retriever," "bark," and "fetch." The links between the
nodes would represent the relationships between the concepts, such as "dog is a type of golden
retriever," "golden retrievers bark," and "dogs fetch." Semantic networks are used to create
natural language processing systems, which are used to understand and respond to human
language. They are also used in expert systems, which are programs designed to simulate the
decision-making process of a human expert.

Prolog
Prolog is a programming language that is well-suited for developing logic-based artificial
intelligence applications. It is a declarative programming language, meaning that it allows the
programmer to specify the rules and facts about a problem domain, and then the Prolog
interpreter will use these rules and facts to automatically infer solutions to problems.

One of the key features of Prolog is its ability to handle uncertain or incomplete information. In
Prolog, a programmer can specify a set of rules and facts that are known to be true, but they can
also specify rules and facts that might be true or false. The Prolog interpreter will then use these
rules and facts to automatically reason about the problem domain and find solutions that are most
likely to be correct, given the available information.

How to use prolog

One way to use Prolog is to define a set of rules that describe the relationships between different
objects or concepts in your problem domain. For example, you might define rules that specify
that certain objects are bigger than others, or that some objects are the same color. Then, you can
use Prolog to ask questions about these objects and their relationships, and the interpreter will
use your rules to deduce the answers.

To use Prolog, you will need to have a Prolog interpreter installed on your computer. There are
several different Prolog interpreters available, including SWI-Prolog, GNU Prolog, and B-
Prolog. Once you have installed an interpreter, you can start writing your Prolog programs using
a text editor and then run them using the interpreter.

21
Basic prolog program
In Prolog, programs are made up of two main components: facts and rules. Facts are statements
that are assumed to be true, such as “John is a man” or “the capital of France is Paris.” Rules are
logical statements that describe the relationships between different facts, such as “if John is a
man and Mary is a woman, then John is not Mary.”

Prolog programs are written using a syntax that is similar to natural language. For example, a
simple Prolog program might look like this:

man(john).

woman(mary).

capital_of(france, paris).

not (X, Y) :- man(X), woman(Y).

In this example, the first three lines are facts, while the fourth line is a rule. The rule uses the
not/2 predicate to state that if X is a man and Y is a woman, then X is not Y.

Things to remember when using Prolog

There is no single “syntax” for Prolog, as the language allows for a wide range of different
programming styles and approaches. However, here are some basic elements of Prolog syntax
that are commonly used:

Facts are statements that are assumed to be true. In Prolog, facts are written using a predicate
name followed by a list of arguments enclosed in parentheses. For example: man(john).

Rules are logical statements that describe the relationships between different facts. In Prolog,
rules are written using the predicate name followed by a list of arguments enclosed in
parentheses, followed by a colon and a hyphen (:-) and the body of the rule. For example: not (X,
Y) :- man(X), woman(Y).

22
Variables are used to represent values that can change or be determined by the interpreter. In
Prolog, variables are written using a name that begins with an uppercase letter. For example: X

Queries are used to ask the interpreter to find solutions to problems based on the rules and facts
in the program. In Prolog, queries are written using the same syntax as facts, followed by a
question mark (?). For example: not (john, mary)?

Applications of Prolog
Prolog is used in various domains. It plays a vital role in automation system. Following are some
other important fields where Prolog is used −

i. Intelligent Database Retrieval


ii. Natural Language Understanding
iii. Machine Learning
iv. Robot Planning
v. Automation System
vi. Problem Solving

Reasoning Methods
1. Deductive Reasoning

Deductive Reasoning is the strategic approach that uses available facts, information or
knowledge to draw valid conclusions. Deductive reasoning uses a top-down approach. In
deductive reasoning, the arguments can be valid or invalid based on the value of the premises. If
the value of the premises is true, then the conclusion is also true. Deductive reasoning helps in
scanning the generalized statement into a valid conclusion. Some of the examples are, People
who are aged 20 or above are active users of the internet. Out of the total number of students
present in the class, the ratio of boys is more than the girls.

2. Inductive Reasoning

Inductive reasoning is associated with the hypothesis-generating approach rather than drawing
any particular conclusion to the facts at the beginning of the process. Inductive reasoning help in
making generalization from specific facts and knowledge. Inductive reasoning is the bottom-up
process. In inductive Reasoning even if the premises are true there is no chance that the

23
conclusion will also be true because it depends upon the inductive argument which can be either
strong or weak. Some of the examples are, all the students present in the classroom are from
London.

3. Common Sense Reasoning 

Common sense reasoning is the most occurred type of reasoning in daily life events. It is the type
of reasoning which comes from experiences. When a human face a different situation in life it
gains some knowledge. So whenever in the next point of time it faces a similar type of situation
then it uses its previous experiences to draw a conclusion to do situation. Some of the examples
are: when a bike crosses the traffic signal when it is red then it learns from its mistakes and next
time the bike is aware of the signal and actions. Also, while overtaking someone on the road
what all ideas should be kept in mind.

4. Monotonic Reasoning

It is the type of reasoning which follows a different approach towards the thinking process it uses
facts, information and knowledge to draw a conclusion about the problem but the major point is
its conclusion remain fixed permanently once it is decided because even if we add new
information or facts to the existing one the conclusion remains the same it doesn’t change.
Monotonic reasoning is used mainly in conventional reasoning systems and logic-based systems.
Some Examples of monotonic are: The Sahara desert of the world is one of the most spectacular
deserts; One of the longest rivers in the world is the Nile River.

5. Abductive Reasoning

Abductive Reasoning begins with an incomplete set of facts, information and knowledge and
then proceeds to find the most deserving explanation and conclusion. It draws conclusions based
on what facts you know at present rather than collecting some outdated facts and information. It
mostly plays a great role in the daily life decision-making process. Some of the examples are:
Doctor drawing conclusions regarding your health based on test reports: A bowl of soup is kept
and vapor evaporating from it which draws the conclusion that the bowl is hot in nature.

24
Backward Chaining
Backward Chaining is a method of problem-solving and reasoning that starts with the desired
outcome and works backwards to determine the required inputs or knowledge needed to reach
that goal. This method of reasoning is used in artificial intelligence and expert systems to deduce
conclusions from given data or knowledge. It is an efficient and effective way to solve problems,
especially those that require complex computations or a large amount of information.

In backward chaining, the process starts with the desired outcome or goal, which is then broken
down into smaller, more manageable steps. Each step is then examined to determine the
information or inputs needed to reach that step. This information is then used to determine the
previous step, and the process continues until all the necessary information has been gathered to
support the conclusion or solution to the problem.

Benefits

i. It allows the problem-solver to focus on only the necessary information, rather than
becoming bogged down by irrelevant details. This makes the process of finding a solution
much more efficient and effective.
ii. It can be used in real-time situations, where the information needed to solve a problem is
constantly changing. In these situations, the method can be adapted and updated as new
information becomes available.
iii. It is also a useful tool for decision-making. By starting with the desired outcome, the
problem-solver can determine the steps necessary to reach that outcome and weigh the
pros and cons of each step. This can help the problem-solver make informed decisions
and find the most efficient and effective solution to the problem.

Limitations

i. Its time-consuming and require a lot of computational resources, especially for complex
problems.
ii. The method may not always be appropriate for problems that have multiple solutions or
where the desired outcome is not well defined.

25
In conclusion, backward chaining is a useful and effective method of problem-solving and
reasoning that can be applied in a wide range of situations. By starting with the desired outcome
and working backwards to determine the necessary inputs, the problem-solver can focus on only
the necessary information and find the most efficient and effective solution to the problem.

Forward Chaining
Forward chaining is a common inference method used in artificial intelligence and expert
systems. It is a process of deducing new conclusions from existing knowledge by working
forward from known facts to new conclusions.

In forward chaining, the system starts with the available facts and then applies inference rules to
deduce new information. The process continues until no new conclusions can be drawn or a
desired conclusion is reached. The newly deduced information is then added to the set of known
facts, and the process repeats until a conclusion is reached or all possibilities have been
exhausted.

Forward chaining is well suited for problems that require a search for a solution, such as in
decision-making and problem-solving. It is also well suited for rule-based systems, where the
system needs to apply a set of rules in a specific order to reach a conclusion.

Forward chaining is an efficient way to deduce new information from a set of known facts and
can be used in a wide range of AI applications.

Example:

Suppose we have a knowledge base containing the following facts and rules:

 Facts:
 Mark is a student.
 Mary is a student.
 Mark has a scholarship.
 Mary has a job.

26
Rules:

i. If a person is a student and has a scholarship, then they are financially stable.
ii. If a person is a student and has a job, then they are financially stable.

Starting with the available facts, we apply the inference rules to deduce new information:

 Mark is a student (fact)


 Mark has a scholarship (fact)
 Therefore, John is financially stable (deduced from rule 1)
 Mary is a student (fact)
 Mary has a job (fact)
 Therefore, Mary is financially stable (deduced from rule 2)

The newly deduced information (that Mark and Mary are financially stable) is then added to the
set of known facts. The process stops because there are no more rules to apply. In this example,
forward chaining allowed us to deduce that both Mark and Mary are financially stable based on
the combination of their status as students and their sources of income (scholarship or job).

Properties

i. Data-Driven: Forward chaining is driven by the data in the knowledge base, which
means that the system works forward from the known facts to reach new conclusions.
ii. Rule-Based: Forward chaining relies on a set of rules or inference mechanisms to deduce
new information. The rules are applied in a specific order to reach a conclusion.
iii. Iterative: Forward chaining is an iterative process where new conclusions are deduced in
each iteration, and the process continues until no new information can be deduced or a
desired conclusion is reached.
iv. Effective in Search Problems: Forward chaining is effective in solving problems that
require a search for a solution, such as decision-making and problem-solving.
v. Efficient: Forward chaining is a more efficient approach than backward chaining in
situations where the goal is known, and the system only needs to deduce new information
to reach the goal.

27
vi. Limited by Known Facts: The accuracy and efficiency of forward chaining are limited
by the accuracy and completeness of the known facts. If the initial facts are incorrect or
incomplete, the deduced information will also be incorrect or incomplete.

28
REFERENCES

Daria. (2023, January 20). Problem solving techniques in artificial intelligence (AI).

PDF.co. https://pdf.co/blog/problem-solving-techniques-in-artificial-intelligence-ai?

utm_referer=https%3A%2F%2Fpdf.co%2Fblog%2Fproblem-solving-techniques-in-

artificial-intelligence-ai#8

Gliozzo, A., Ackerson, C., Bhattacharya, R., Goering, A., Jumba, A., Kim, S. Y.,

Krishnamurthy, L., Lam, T., Littera, A., McIntosh, I., Murthy, S., Ribas, M., &

Redbooks, I. (2017). Building cognitive applications with IBM Watson services: Volume

1 getting started. IBM Redbooks.

Problem solving techniques in AI. (n.d.). Javatpoint. Retrieved February 11, 2023, from

https://www.javatpoint.com/problem-solving-techniques-in-ai

Haenlein, Michael, and Andreas Kaplan. "A brief history of artificial intelligence: On the past,

present, and future of artificial intelligence." California management review 61.4 (2019):

5-14.

Warwick, K. (2013). Artificial intelligence: the basics. Routledge.

https://www.forbes.com/sites/cognitiveworld/2019/06/19/7-types-of-artificial-intelligence/?

sh=58288b66233e

By Indeed Editorial Team, Published April 25, 2022, "Knowledge-Based Systems". 2020 Journal
Citation Reports. Web of Science (Science ed.). Clarivate. 2021-06-30.

https://www.indeed.com/career-advice/career-development/what-is-knowledge-based-system

Battani G and Meloni H {1973} Interpreteur du language de programmation Prolog. Groupe


intelligence Artificielle, Marseille-Luminy, 1973

29
Boyer R S and Moore J S {1972} The sharing of structure in theorem proving programs.
Machine Intelligence 7 (ed. Meltzer & Michie), Edinburgh U. Press, 1972.

Bruynooghe M {1976} An interpreter for predicate logic programs: Part 1. Report CW 10,
Applied Maths & Programming Division, Katholieke Univ Leuven, Belgium, Oct
1976.

Coles, A., Coles, A., Fox, M., & Long, D. (2010). Forward-chaining partial-order planning. In
Proceedings of the International Conference on Automated Planning and Scheduling
(Vol. 20, pp. 42-49).

Akil, I. (2017). Analisa efektifitas metode forward chaining dan backward chaining pada sistem
pakar. Jurnal Pilar Nusa Mandiri, 13(1), 35-42.

Al-Ajlan, A. (2015). The comparison between forward and backward chaining. International
Journal of Machine Learning and Computing, 5(2), 106.

30

You might also like