AI Unit 5
AI Unit 5
An AI system can be defined as the study of the rational agent and its environment. The agents
sense the environment through sensors and act on their environment through actuators. An AI
agent can have mental properties such as knowledge, belief, intention, etc.
What is an Agent?
An agent can be anything that perceiveits environment through sensors and act upon that
environment through actuators. An Agent runs in the cycle of perceiving, thinking, and acting.
An agent can be:
o Human-Agent: A human agent has eyes, ears, and other organs which work for sensors
and hand, legs, vocal tract work for actuators.
o Robotic Agent: A robotic agent can have cameras, infrared range finder, NLP for
sensors and various motors for actuators.
o Software Agent: Software agent can have keystrokes, file contents as sensory input and
act on those inputs and display output on the screen.
Hence the world around us is full of agents such as thermostat, cellphone, camera, and even we
are also agents.
Before moving forward, we should first know about sensors, effectors, and actuators.Artificial
Intelligence designed to predict rainfall within two hours
Sensor: Sensor is a device which detects the change in the environment and sends the
information to other electronic devices. An agent observes its environment through sensors.
Actuators: Actuators are the component of machines that converts energy into motion. The
actuators are only responsible for moving and controlling a system. An actuator can be an
electric motor, gears, rails, etc.
Effectors: Effectors are the devices which affect the environment. Effectors can be legs, wheels,
arms, fingers, wings, fins, and display screen.
Intelligent Agents:
An intelligent agent is an autonomous entity which act upon an environment using sensors and
actuators for achieving goals. An intelligent agent may learn from the environment to achieve
their goals. A thermostat is an example of an intelligent agent.
Rational Agent:
A rational agent is an agent which has clear preference, models uncertainty, and acts in a way to
maximize its performance measure with all possible actions.
A rational agent is said to perform the right things. AI is about creating rational agents to use for
game theory and decision theory for various real-world scenarios.
For an AI agent, the rational action is most important because in AI reinforcement learning
algorithm, for each best possible action, agent gets the positive reward and for each wrong
action, an agent gets a negative reward.
Rationality:
The rationality of an agent is measured by its performance measure. Rationality can be judged on
the basis of following points:
Note: Rationality differs from Omniscience because an Omniscient agent knows the actual
outcome of its action and act accordingly, which is not possible in reality.
Structure of an AI Agent
The task of AI is to design an agent program which implements the agent function. The structure
of an intelligent agent is a combination of architecture and agent program. It can be viewed as:
Following are the main three terms involved in the structure of an AI agent:
Types of AI Agents
Agents can be grouped into five classes based on their degree of perceived intelligence and
capability. All these agents can improve their performance and generate better action over the
time. These are given below:
While learning AIs still seem like a futuristic concept, they are not. Many high-profile businesses
have already started applying it to their businesses. In essence, learning AI is just patterned AI
recording what it has predicted previously and applying it to a new problem. However, learning
AI brings a new aspect to artificial intelligence that has never been seen before. That aspect is
multi-agent systems.
Multiagent systems
Active research is currently underway in the field of building distributed control systems based
on the multiagent paradigm (Zhu et al., 2020). The basis of this paradigm is the idea of building
a management and decision-making system as a distributed community of “agents” who
independently make decisions and, if necessary, can use the “collective mind” to achieve their
goals under conditions of significant uncertainty.
The generalized architecture of a multiagent system is shown in Fig. 7.13. A multiagent system
includes two active agents that have the ability to analyze the state of the information field of a
distributed control object.
A feature of such an organization of the management system is that the agents are independent of
each other—each agent has its own goal. To achieve this goal, the agent uses information from
input sensors, and if necessary, can use actuators. To perform targeted actions, the agent uses the
built-in knowledge base and logical inference system. Agents, in the course of their activities,
using the communication channel and information exchange protocols, can exchange data,
knowledge, and control signals. In real applications, the number of agents is not limited.
Multiple learning Agent AIs can exist in an agent-based but they never directly communicate
with each other. A multi-agent system, on the other hand, is an agent-based system that involves
direct communication between two or more sets of learning AIs with minimum rules.
This form of M2M communication allows learning AI to actually ‘communicate’ and solve
complex problems faster. There are various advantages of MAS over other forms of AI
ecosystems.
Decentralization
This is probably the greatest advantage of a multi-agent system. All agent-based systems are
constrained by rules which make centralize them and free communication between agents and
general Patter AI is usually not possible unless the learning agent AI has been designed to
counteract this.
The centralized system means that even if one AI system fails, the entire ecosystem will crash.
This is exactly why agent-based systems are designed to prevent direct communication between
agents. A MAS can prevent this from happening by making all agents independent of each other
and the failure of one agent doesn’t mean that the other will fail too. A failure in one agent would
simply mean that the communication lines between the agents would break and the surviving
agent would make decisions according to its algorithms.
Interconnectibility
Once multi-agent systems are successfully applied, they can even communicate with legacy
systems and legacy systems could be connected to MAS ecosystems without major trouble. A
simple MAS ‘skin’ would help them communicate saving a lot of time and resources.
Autonomous
ABS requires consistent human input to get the desired result whereas MAS systems can be
completely autonomous while communicating and generating results.
Better Computing
Multi-Agent systems are relatively robust, reliable, efficient and provide better solutions than
agent-based systems. There is simply no competition for this technology in AI.
What are Expert Systems?
The expert systems are the computer applications developed to solve complex problems in a
particular domain, at the level of extra-ordinary human intelligence and expertise.
Characteristics of Expert Systems
High performance
Understandable
Reliable
Highly responsive
Knowledge Base
Inference Engine
Use of efficient procedures and rules by the Inference Engine is essential in deducting a correct,
flawless solution.
In case of knowledge-based ES, the Inference Engine acquires and manipulates the knowledge
from the knowledge base to arrive at a particular solution.
In case of rule based ES, it −
Applies rules repeatedly to the facts, which are obtained from earlier rule application.
Adds new knowledge into the knowledge base if required.
Resolves rules conflict when multiple rules are applicable to a particular case.
To recommend a solution, the Inference Engine uses the following strategies −
Forward Chaining
Backward Chaining
Forward Chaining
It is a strategy of an expert system to answer the question, “What can happen next?”
Here, the Inference Engine follows the chain of conditions and derivations and finally deduces
the outcome. It considers all the facts and rules, and sorts them before concluding to a solution.
This strategy is followed for working on conclusion, result, or effect. For example, prediction of
share market status as an effect of changes in interest rates.
Backward Chaining
With this strategy, an expert system finds out the answer to the question, “Why this
happened?”
On the basis of what has already happened, the Inference Engine tries to find out which
conditions could have happened in the past for this result. This strategy is followed for finding
out cause or reason. For example, diagnosis of blood cancer in humans.
User Interface
User interface provides interaction between user of the ES and the ES itself. It is generally
Natural Language Processing so as to be used by the user who is well-versed in the task domain.
The user of the ES need not be necessarily an expert in Artificial Intelligence.
It explains how the ES has arrived at a particular recommendation. The explanation may appear
in the following forms −
Natural language displayed on screen.
Verbal narrations in natural language.
Listing of rule numbers displayed on the screen.
The user interface makes it easy to trace the credibility of the deductions.
Requirements of Efficient ES User Interface
It should help users to accomplish their goals in shortest possible way.
It should be designed to work for user’s existing or desired work practices.
Its technology should be adaptable to user’s requirements; not the other way round.
It should make efficient use of user input.
No technology can offer easy and complete solution. Large systems are costly, require
significant development time, and computer resources. ESs have their limitations which include
−
Limitations of the technology
Difficult knowledge acquisition
ES are difficult to maintain
High development costs
Application Description
There are several levels of ES technologies available. Expert systems technologies include −
Expert System Development Environment − The ES development environment includes
hardware and tools. They are −
o Workstations, minicomputers, mainframes.
o High level Symbolic Programming Languages such as LISt Programming (LISP)
and PROgrammation en LOGique (PROLOG).
o Large databases.
Tools − They reduce the effort and cost involved in developing an expert system to large
extent.
o Powerful editors and debugging tools with multi-windows.
o They provide rapid prototyping
o Have Inbuilt definitions of model, knowledge representation, and inference design.
Shells − A shell is nothing but an expert system without knowledge base. A shell provides
the developers with knowledge acquisition, inference engine, user interface, and
explanation facility. For example, few shells are given below −
o Java Expert System Shell (JESS) that provides fully developed Java API for
creating an expert system.
o Vidwan, a shell developed at the National Centre for Software Technology, Mumbai
in 1993. It enables knowledge encoding in the form of IF-THEN rules.
Expert system shells are toolkits that can be used to develop expert systems. They consist of some
built expert system components with an empty knowledge base. Hence, in most cases, the
knowledge engineer is left with only populating the knowledge base. It is essentially a special-
purpose tool that is built-in in line with the requirements and standards of a particular domain or
expert-knowledge area applications. It may be defined as a software package that facilitates the
building of knowledge-based expert systems by providing a knowledge representation scheme
and an inference engine.
Difference ES shells offer various ways to model the knowledge into the knowledge base. They
are
1. as rules
Knowledge is populated using rules. These rules can be programmed by Prolog, Java, Python or
any other preferred language based on the expert system shell being used
2. in the form of a decision tree
Figure 02: A tree-based expert system created based on the rules mentioned above
( Source: Created by Author)
3. as objects (frames) — A data structure with typical knowledge about a particular object or
concept.
ES shell is an ideal option for the rapid development of expert systems. Due to this reason, it can
be considered as one of the most commercially viable approaches in expert system
implementation.
3. A structured skeleton of a knowledge base (in its empty state) with the suitable knowledge
representation facilities
Not only the above components but also some ES Shells provide facilities for database
connectivity through interpreter, web integration, and natural language processing (NLP) features.
The user interface is the portal available for both end-users (who use the expert system to get
solutions) and the knowledge engineer (who perform the knowledge engineering and modelling).
The knowledge base can be connected with an external database (like MySQL) since the
knowledge base is not optimal in storing extensive data. The knowledge base cannot directly
access the database and these access features are mediated through an interpreter.
Some ES Shells have inbuilt knowledge base editors which facilitate the Knowledge Engineer to
easily update and check the knowledge base. Knowledge Engineer collects the expertise
knowledge in a specific domain and models in populating the knowledge base.
Inference engine which is the most important part of an expert system access the knowledge base
and solves the problem by either backward chaining or forward chaining of facts and rules in the
knowledge base. In ES Shells, the inference engine is also a built-in component that is usually
programmed in ProLog.
Most ES shells are composed of another component called ‘Explanation System’ which provides
the user with reasons and explanations to provide a certain answer, by considering the ‘case
specification data’ available.
In an expert system shell, the design of the user interface and other software components are
programmed by the software engineer. Therefore an expert system is a collaborative design of 03
major parties: expert, knowledge engineer and software engineer. (Depending on the size these
parties may vary from individuals to large teams)
Following are a few examples of expert systems available for developers to build expert systems
at various scales. Depending on the ES Shell there are various pros and cons associated with each
shell.
4.1 ES-Builder
ES Builder stands for Expert System Builder. It is one of the most famous Expert System Shell. It
is a free ES shell that is implemented especially for students and researchers to develop expert
system shells. The shell consists of an improved web interface built using the AJAX framework.
The ES-Builder stores the facts and rules of the knowledge base in an online MySQL database.
There is a built-in inference engine (written in Prolog)and user interfaces are developed using
simple HTML and CSS. The database connectivity is maintained to access the knowledge base
using PHP.
The rule base knowledge base can also be developed using a decision tree that consists of
attributes, values and conclusions.
Attribute: Attributes are characteristics of possible conclusions that are to be tested in the
ES.
Value: Each Value node represents the most correct response to an Attribute for a particular
conclusion.
Conclusion: The final decision made based on the attributes and values is the conclusion.
Benefits of ES Builder:
Autogenerated User Interfaces (Simple HTML CSS design of the user interface)
Ability to create backup files of the knowledge base and easy integration with MYSQL
database.
Limitations of ES-Builder:
Only forward chaining rules are supported backward chaining rules are not supported.
4.2 CLIPS
CLIPS stands for C-Language Integrated Production System. As the meaning suggests the CLIPS
expert system shell is written in the procedural langue C. CLIPS was developed in 1985 at
NASA’s Johnson Space Center. It is a rule-based programming language that is used for creating
an expert system. CLIPS are used in systems where the heuristic solution is easier to implement
and maintain than a traditional algorithmic approach.
CLIPS provides 03 different tools for knowledge representation in the form of programming
methodologies/ programming paradigms. The 03 methods are:
Procedural
Object-oriented
Rule-based programming
Since the CLIPS is written in C language, the expert system developed by CLIPS requires ANSI
compiler also. Since the systems that already have the ANSI compiler can easily run the expert
system without changing the source code.
Benefits of CLIPS:
Can be easily embedded in other subroutines made in procedural languages to extend the
existing functionality.
Limitations of CLIPS:
Support only forward chaining rules but does not support backward chaining rules.
4.3 JESS
JESS stands for Java Expert System Shell. JESS is another expert system shell and a scripting
language that is completely written by Java programming language. JESS is heavily used to build
rule-based expert systems which is tightly linked to systems that are written on Java. The expert
systems built by using JESS can be either run on command-line interface or can be used as an
Applet.
JESS based expert systems are widely used as intelligent agents, in enterprise resource planning
systems, and in order validation of eCommerce platforms.
Benefits of JESS:
Faster than the expert systems developed using expert system shells written on C language.
Contains some commands which allow less memory usage when executing the system.
Limitations of JESS: