Expert System project: PC repair assistant
It is needless to say how important PCs are in our daily lives. And like every machine and device; they tend to fail from time to time. When they do, this could be a hit.
Only computer technicians have the proper knowledge and are certified to repair PCs. They know their structure and how their hardware works. They are experts who can troubleshoot and fix any problem, be it a simple firmware update or replace all of the internal components. Fortunately, we have the technology to program their knowledge in the form of computer software, and programs and algorithms that will make decisions similar to how the experts would. This is going to be our project.
To download the zip file click here
What will you learn?
In this project you will learn how to program your computer to ‘know’ and master the field of computer problem diagnostics, and program it to ask questions that will give it the information needed to find a solution to any issue it may identify. You will learn how to defy a set of facts and a set of rules that will instruct the computer using Prolog language. Eventually creating an AI Expert System that does what a regular PC technician would do.
What is an Expert System?
An Expert System is a highly complex algorithm (type of AI) usually consisting of a big database and set of rules. It operates by gathering information on a specific problem in its field of expertise and after making its own analysis on the information can make conclusions and offer solutions to the problem.
Prolog
Short for “Program In Logic”, Prolog is a leading language in logic programming that was developed in 1970. It is used mainly for software based on logic and AI. The language is based on logical verses (true or false statements) which are deduced from facts and rules. The syntax of this language is very different from languages like C and JavaScript. Its semantics more resembles human language than a computer language.
The project and its field of expertise
1. Identify the problem
2. Give guidance and explanation on how the problem was found.
3. Offer a solution to fix the problem.
4. Explain how it got to the solution and why it worked.
The System can troubleshoot issues in the following areas:
1. Power Supply
2. Graphics
3. CPU
4. RAM
5. Motherboard
6. Disk Drives
7. DVD/ROM Drives
8. Audio
The overlay
The first requirement of an expert system is to have the ability to answer for a particular query, whether it can be proven according to the knowledge base or not. The goal is to build a shell for an expert system that can handle the broad areas of knowledge.
Knowledge basis:
The knowledge basis refers to the content of an expert system. It describes the components of the field of knowledge, and the existing connections and the various components. Usually the knowledge basis is described using basic data called “facts” and rules that describe the relationship between them called “laws”.
Conclusion algorithm:
The conclusion algorithm consists of a mechanism capable of drawing conclusions based on knowledge. The facts and laws describe the knowledge while the conclusion algorithm determines how to analyze the knowledge. It should be emphasized that the inference system does not depend on the knowledge base itself and is therefore part of the general overlay. This part of the expert system is extremely important as it behaves similar to human thought.
Explanation system:
The explanation system allows an explanation to the user after the process of diagnosis and inference of the system. The user wants to know according to what conditions and rules the conclusion of the expert system was obtained.
Overlay:
The envelope includes the inference mechanism, the explanation mechanism and the user interface. It knows how to draw conclusions based on the knowledge base and explain them to the user. Ideally the envelope does not depend on the knowledge base and can operate in the same way on the basis of different knowledge. The system components are general and do not change according to the field of expertise. The envelope should be constructed so that it is general and that a change in the field of expertise will be reflected only in the knowledge base.
Program is independent of other programs
Software installation is not required, it is only necessary to enter the contents of the file and run the software from there.
Graphical representation of knowledge (facts)
The data structure used for this project to store all of the data is a state machine. This type of data structure is suitable because it functions like a flowchart. After constructing it right the machine can simply move between states according to the input it gets.
All of the facts in this database were consulted with a real computer expert and vast research was made to make these facts accurate.
The state machine starts from the menu when the program runs (starting state) and continues according to what the user will choose from the options.
Start:
Each arch (the bridge between 2 states) was defined so:
edge(_origin,_value,_destination).
Where _origen and _destination are variables that contain the ID of the states the arch is connecting. The _value variable contains the condition that needs to occur to go from the _origin state to the _destination state.
These are hundreds of lines that look like this:
edge(b4,no,b6).
edge(b4,yes,b7).
edge(b5,yes,b8).
edge(b5,no,b9).
edge(b7,yes,b10).
edge(b7,no,b11).
edge(b9,yes,b12).
edge(b9,no,b13).
edge(b11,no,b12).
The actual data of every state will be accessed so:
vertice_data(_vertivce,_name,_explanation).
Where _vertice contains the ID of the state, _name is the name of the state and also the question that arises when reaching this step and _explanation contains detailed text that explains the current situation, if necessary.
For example:
vertice_data(d12,'Insert another power lead into the drive.','').
The information of the dictionary will be accessed like this:
term(_code,_term,_description).
Where _code is the number of the term. They are numbered to be easily accessed via the user interface. _term is the name of the term, like “PATA”, and _descriptions contains a text that describes the term.
For example:
term(20,’PATA’,’Parallel ATA (PATA), originally AT Attachment (ATA), is an information cable for the connection of storage devices such as hard disks, floppy drives, and optical disc drives in computers.’).
These would be the methods to access the data of the expert system. The data structure is a virtual graph that is represented by bubbles that are linked by arrows. The user can choose the option ‘Yes’ or ‘No’ and that would lead him to the next step of the diagnostics.
All of the data is store in the files:
data.pl
library.pl
Rules
Now we get to the programming
engine.pl
Method to load all the files:
load.
Method that starts the program:
start.
Method that transfers the user to the main menu:
menu.
Method that receives the user’s input and transfers it to the relevant page:
menu(_option)
When _option is a number that represents the selected option.
Search method that finds and loads the requested state:
system_activate(_vertice,_trip).
Where _vertice is the state and _trip is the memory that contains all previous states in a form of a stack, which is very useful for the system to remember all the states its got through.
Method that finishes the process and concludes the troubleshoot:
system_finish_manu(_trip),
Where _trip contains the entire history of the diagnostic, and _code represents user’s selection. From here the user can go to the conclusion menu, return to the main menu or another option.
Method that activates the explanation engine:
explanation1(_trip).
Method that displays _trip in a form of a flowchart:
explanation2(_trip).
Explanation method:
explanation_engine(_trip,_memory,_trip_explain).
Where _trip contains the entire history of the diagnostics, _memory is a list of explanations that the system generates and _trip_explain is a string that contains all of the given explanations. This rule uses only _trip to generate the explanation for the conclusion. It analyzes every variable in the list and explains every step.
Helper Methods:
Prolog has built in functions that were used in this project to write the rules.
List sorting Method:
sort/2
Method to check if a value exists in a list:
member/2
Method to concat two strings:
atom_concat/3
Method to find all values that satisfy a condition:
findall/3
Method to flip all values in a list:
reverse/2
Summary
Computer hardware is an area I have delved into long enough. I decided to do the project around this topic from the beginning. Throughout the work, I had to gather a huge amount of information about all the computer parts, certain concepts, and the way to fix faults. I gathered a lot of information, invested a lot of thought when I sketched on a page the stages of diagnosing faults, I consulted each time if the technician of the school who accompanied me throughout the work, and this is to make the data of the system as accurate as possible.
Preparing for the project was difficult and challenging. Occasionally I got into situations that were not clear to me when I was trying to write a solution to a problem, even though consulting a technician and a broader internet search helped me find a solution. However, I had the challenge of programming the software in a prologue language, although I overcame this difficulty later.
Eventually, I learned a great many things in the field of computer hardware and my proficiency in prologue improved. I enjoyed making this expert system and I hope it can help real help to the technicians who will want to use it.
Thank you
We thank you for learning and hopefully completing our project. We are looking forward to hear from you in the comment section. Questions and constractive critisizm is welcome.
We would like to know what you think about our Expert System project: PC repair assistant