THE EXPERT SYSTEM OF STEEL Copyright 1984, by Potomac Pacific Engineering Inc. Licensed FREE to all users with some restrictions. Read and agree to the license conditons and our disclaimer of warranties prior to using this program. ***************************************************************** READ THIS : The Basic programs are distributed in ACSII form for compatibility reasons. They were saved with the ,A option (SAVE "MAIN",A). For faster loading of the programs, load each program then save each program without using the ,A option (SAVE "MAIN"). If your computer uses 360 K disks copy the 320 K disks to 360 K disks using " A: copy *.* b: ". ***************************************************************** We have developed this system using SANYO basic on a SANYO computer. We then compile most of my programs on the Microsoft Basic Compiler. SANYO Basic is downward compatiable with IBM Basic. If you use IBM Basic you are going to run out of memory very fast. We suggest using a compiled version rather then a basic version. Differences in Basic Languages: This program uses the following commands which may be slightly different than the version of basic you are using. 1. CLS - CLEAR SCREEN 2. LOCATE - locates the position on the screen 3. LOF( ) - returns the file length 4. PRINT CHR$(8) - Moves the cursor back one space. **** note IBM BASIC uses PRINT CHR$(29) **** If your Basic does not support these commands you can usually simulate the commands in your language. The above commands were used only once in each program in a subroutine. PRINT CHR$(8) NOTE : WE DISTRIBUTE THE DATA BASE WITH EITHER CH = 8 FOR USERS OF MICROSOFT BASIC OR CH = 29 FOR IBM BASIC. YOU MAY OR MAY NOT HAVE TO MAKE THE FOLLOWING CHANGE. If you try the programs and the prompt does not contain the cursor you probably have to make this change. The prompt should look like : >__< with the cursor just to the left of the >. If PRINT CHR$(8) does not move the cursor back one space then you may need to change the program. Look in your BASIC manual to determine which ASCII code will move the cursor back one space. (IBM BASIC USER IT IS CHR$(29) ). To make the change easier for you I have used PRINT CHR$(CH) so that you only have to change the value of the variable CH. In the operations programs change line 61 from: 61 CH = 8 TO 61 CH = 29 or whatever ASCII character will move the cursor back. Do the same thing in the Custom Programs at line 70 and in the sort program at line 10. CLS If your computer does not use CLS command to clear the screen then you must replace it with the command that will clear your screen. The CLS is at line 13000- in the operations programs line 500- in the custom programs and line 15000 in the sort program. LOCATE If your computer does not use the LOCATE command to locate a position on the screen then you must replace it with the command that will. The locate command is used once in the operations programs and only on line 13100- and in the CSCREEN program. LOF( ) If your computer does not use the LOF command to return the file length then you will have to replace it with the command that does. NOTE **** Some versions of Microsoft Basic will support LOF( ) but it is not documented in their manual ****. The Microsoft Basic compiler will support the the LOF command but it is not documented in their manual. The command LOF( ) is not used in the custom programs. DISCLAIMER OF WARRANTIES PRIOR TO USING THESE PROGRAMS READ THIS DISCLAIMER OF WARRANTIES AND THE LICENSE AGREEMENT. IF YOU DO NOT AGREE WITH ALL OF THE CONDITIONS THEN YOU ARE NOT LICENSED TO USE THIS PROGRAM. Note : This is almost the same agreement you get with any program you purchase from IBM, Microsoft or any other software firm. Potomac Pacific Engineering Inc. licenses this program solely on an "as is" basis. Potomac Pacific Engineering shall have no liability or responsibility to Licensee or any other person or entity with respect to any liability, loss or damage caused or alleged to be caused directly or indirectly by this product, including but not limited to interuption of services, loss of business or anticipatory profits or consequential damages resulting from the use or operation of this program. Potomac Pacific Engineering makes no warranties, either express or implied regarding this program, its merchantibility and or its fitness for a particular purpose. Licensee agrees that Potomac Pacific Engineering shall not be held liable for any consequential damages, even if Potomac Pacific Engineering has been advised of the possibility of such damages. All computers and computer programs malfunction from time to time. It is the entire responsibilty of the user who designs the system to : 1) Design backup procedures that will not allow you to incur damages. 2) Design procedures to prevent fraud. 3) Design manual procedures that you can use while your computer is out of order. 4) Design systems that will not cause you significant damages if the program or computer fails. LICENSE INFORMATION Each Program and the Manual is Copyrighted 1984 by Potomac Pacific Engineering Inc. The program is not sold. It is licensed FREE to all users with the following restrictions : 1. You may sell or give away any program that contains only portions of the operations programs, or spreadsheet or expert system without payment of royalties as long as the following statements are enclosed in the manual of your program : REQUIRED STATEMENTS FOR ALL PROGRAMS : Portions (C) Copyright Potomac Pacific Engineering Inc. 1984 All rights reserved. (end of required statement) We would appreciate it if you reference our program in your manual. 2. You may not distribute any modified programs that contain any portions of the custom programs nor may you use any portions of our program in a data base program that will compete with our program. You may not use any part of our programs in a different data base, spreadsheet or expert system inference engine program. A data base program is defined a program where a user can define his own files (data bases). 3. In the interests of standardization you may not distribute modified versions of the programms. The programs and the manual may not be modified. We encourage you to write any enhancements to the programs. However, keep any enhancements in a separate program that can be merged with our programs if any other user would like to use your enhancement. Please send us a copy of any enhancements or modifications you would like to donate to the public, we will consider adding them to our program. 4. Clubs and users groups many distribute copies of the program with the changes necessary for the program to run on their computers. For example if a TI user's group manages to get a program running on the TI then they may distribute the modified program. Only nonprofit groups may sell the data base and only for a nominal fee to cover costs. The programs may not be bundled with anything that is sold, without our written consent. We reserve the right to withdraw the license if any of the license conditions are violated. THE EXPERT SYSTEM OF STEEL An expert system is a system that approximates the judgement of a human expert. An expert system may be set up to act as a psychiatrist, automobile mechanic, a physician, or other expert. An Inference Engine, which is what this expert system technically is, is a framework that uses variable rules, problems, questions, problems and solutions, and a programmed logic to handle any number of expert systems. The advantage of an inference engine is that you can set up your own expert system without doing any programming just by entering the questions, rules, problems, solutions and their relationships An expert system asks questions then provides a diagnosis and then recommends a solution. The first half of this manual explains the basics of this expert system and how to use this expert system. The second part of this manual provides information on how to create your own expert systems. How To Use The Expert System Of Steel First you should briefly read this manual. Then you should jump right in and try using the system. If you don't understand anything you should refer back to this manual for an explanation. You have been provided with two versions of the expert system, the compiled version ( EXPERT.EXE ) and the basic version ( EXPERT.BAS ). Using the compiled version is easier and the program runs faster. The basic version is provided because it is the source code and can be modified. To start the compiled version : 1. Turn your computer on with your operating system disk (MS-DOS or PC-DOS) in the default disk drive. 2. After entering the time and date your computer will display A: 3. Put the expert system disk in the default disk drive. 4. Type "expert" then press return. A:expert (press return) 5. The program will load. 6. The first screen will look like : Put the Expert System disk in the default disk drive ****** THEN PRESS ANY KEY TO CONTINUE ***** The expert system only uses the expert system disk Keep it in the default disk drive at all times during this program (end of first screen) The expert system disk is the disk with the files QUESTION, PROBLEMS and SOLUTION on it. In this case the program EXPERT is on the same disk and the disk should already be in the default disk drive since you loaded your program from it. DO NOT TAKE THE DISK OUT ANYTIME DURING THE PROGRAM. Press any key to continue. The second screen should look like : E X P E R T S Y S T E M P R O G R A M 1.0 Copyright 1984 by Potomac Pacific Engineering Inc. This program is licensed free to all users with some restrictions See the manual for more information on the license ******************* DO YOU WANT TO ********************* 1 - START A NEW PROBLEM 2 - CONTINUE WITH A PRIOR ANALYSIS ********** ENTER THE NUMBER THEN PRESS RETURN *********** >__< (end of the second screen) You can either start a new problem or continue with a previous analysis. Starting a new problem means that all of the answers will be set at no answer and the computer will start at the beginning by asking you all of the introductory questions. The other option is to continue with a prior analysis. When continuing with a prior analysis the computer will read the answers that you or someone else has saved on the disk and then continue with the analysis at the start node. If you enter 1 for "start a new problem" the computer will go through each question, setting the answer to NO ANSWER, next if the question has been designated by the system designer as an introductory question the computer will ask you to answer the question. Answer the question. If you do not know what the answer is you may tell the computer that you do not want to answer the question by pressing the letter N for no answer. If you enter 2 for "continued with a prior analysis" the computer will display all the files on the default disk drive then ask you for the name of the file you saved the questions on, that you want to continue. On your first time using the system I would suggest entering "1" to start a new problem. The computer will then ask you the introductory questions. The sample "expert" application is a psychitrist. Don't take the sample application too seriously as the rules were developed mostly for debugging purposes and not for the correct psychoanalysis. A real "expert" application would take up most of the disk space which is why such a short simple application is included. After you answer the introductory questions or the computer reads the answers from the disk the next screen should look like : AT STARTING NODE 0 # QUESTION + - P CK CONT 1 Bad Physical Shape 90 0 7 PC CONT 5 Crazy (mental) 90 70 9 NC CONT 6 Lazy 0 80 6 NC CONT 9 Stupid 0 0 5 NC CONT 13 Evil 0 0 4 NC CONT 16 Normal 50 0 2 C CONT BRANCH ? * NEGATIVE NBR TO OVERRIDE * 9999 TO OPTIONS COMPUTER RECOMMENDS 5 (end of screen) Explanation of the Screen Problem Number - is shown at far left. It is the number of each problem that is a subproblems of the current node. Problem Description - the name of each problem Probability For - is shown right below the + on the screen The cumulative probability of all the evidence that the problem exists Probability Against - right below the - on the screen The cumulative probability of all the evidence that the problem does not exist Priority - Is shown right below the P on the screen. The search priority 0 - lowest 9 - highest searched first Checked - Is shown right below the CK on the screen C - all ready checked with all questions answered PC - partialy checked - already checked out but not all of the questions have been answered NC - not checked Continued - right below the CONT on the screen CONT - continued, there are further subproblems to this problem END - end, there are no further subproblems to this problem How The Problems are Set Up The design of this expert system is set up in a tree structure. The starting node is 0. In our sample application the "tree" starts with the "branches" 1 Bad Physical Shape 5 Crazy (mental) 6 Lazy 9 Stupid 13 Evil 16 Normal Each of These Branches or problems branches out into more subproblems. For example the branch "Crazy (mental)" branches out into : 21 Psychotic 22 Neurotic 23 Mental Breakdown Each of These Branches or problems branches out into more subproblems. For example the "Psychotic " branches out to the subproblems : 24 Schizophrena 25 Delusionary 26 Megalomanic 27 Can't distinguish between fact and fiction 28 Paranoid 29 Sadistic 30 Masochistic The Paranoid branch branches out to paranoid type A and Type B while the other problems do not have any further subproblems. The tree of problems may also be visualized as : 0 - start node / / / \ \ \ 1 5 6 9 13 16 / / \ | / \ / \ \ / \ / / \ \ 2 3 4 | 7 8 10 11 12 14 15 17 18 19 20 | / | \ 21 22 23 continued down through all the problems The expert system starts you at the start node. The computer will recommend that you explore the branch with the highest priority that has not already been explored. The computer will continue to explore the path as long as the probability for is greater the 40 and the probability against is less then 40. Getting back to what is on your screen, the computer asks : BRANCH ? NEGATIVE NBR TO OVERRIDE * 9999 TO OPTIONS COMPUTER RECOMMENDS 5 You have three options here: ENTERING A POSITIVE NUMBER If you enter a positive number the computer will ask you the questions which confirm or deny the existence of the problem. ENTERING A NEGATIVE NUMBER If you enter a negative number the computer will switch control of the analysis to that node on the tree ENTERING 9999 ( or any number greater then 9999 ) The computer will switch control to the options ANSWERING QUESTIONS If you enter a positive number, the computer will ask you the questions which confirm or deny the existence of the problem. The number of questions may vary form 1 question to 20 questions. The questions will be displayed on the screen as : 1 3 Are you 1-male 2-female 1=1 80 2 11 How many TV sets do you own NA>3 60 3 19 Can you run 5 miles 1-yes 2-no NA=1 -70 4 39 What is your IQ 120>100 -80 WHICH QUESTION ? 1 to 4 ZERO FOR NONE , THEN ANSWER (end of screen) In this Screen : The first column is the number for the question. The second column is the record number of the question. The words are obviously the question. The fourth column is the answer for the question. If the question has not been answered then NA will be shown The fifth column is the rule. The rule is either = equals, > greater than, < less than or >< not equals. The sixth column is the fact value that the answer is compared against to determine if the rule is true or false. The seventh and last column is the probability that is true if the condition is true. A positive probability supports the existence of the problem while a negative probability denys the existence of the problem. The questions shown above may be read as follows: 1. If "male" then there is a 80% chance that the problem exists. 2. If more then 3 TV sets are owned there is a 60% chance that the problem exists. 3. If you can run 5 miles there is a 70% chance that the problem does not exist. 4. If the IQ is greater than 100, there is a 80% chance that the problem does not exist. To answer the first question, enter the number 1 and press return. Then type in the answer. All the questions are answered with numbers. If the question has the options 1-yes 2-no then enter either 1 or 2. The computer will not accept any alphabetic characters except for N. The letter N stands for no answer. You do not have to answer any of the questions if you do not know any of the answers. Don't waste your time reanswering questions that are already answered. You may change any of the answers by the the same procedure of entering the question number then the answer. In our sample set of four questions,the first one is already answered. To enter an answer of ten for the second question ( how many TV sets you own ) the screen will look like : QUESTION ? 1 TO 4, ZERO FOR NONE, THEN ANSWER >2_< >10______< QUESTION ? 1 TO 4, ZERO FOR NONE, THEN ANSWER >0_< (end of screen) After you enter zero for no more questions, the program will recalculate the probability for the problem. If the problem has more subproblems and the "probability for" is greater then 40% and the "probability against" is less then 40%, the computer will change control to display all the subproblems of the current problem. You may or may not wish to explore the subproblems. If you do not want to explore the subproblems you may enter a negative number after the prompt : BRANCH ? * NEGATIVE NBR TO OVERRIDE * 9999 TO OPTIONS COMPUTER RECOMMENDS 5 >______< If you enter a negative number, the computer will switch control to the subproblems of the positive value of the number you entered. If the negative number you entered has no subproblems the computer will prompt you for another number. If you don't understand this, run the program and see what happens when you enter a negative number. You will usually want to enter a number that is more towards the start node 0. Skipping from one part of the tree to a different part is not a recommended way to conduct a search. You can always just follow the computer recommendations. OPTIONS If you enter the number 9999 or any number greater then 9999 after the prompt: BRANCH ? * NEGATIVE NBR TO OVERRIDE * 9999 TO OPTIONS COMPUTER RECOMMENDS 5 >9999___< The computer will then prompt you with : ** OPTIONS ** 0-NONE 1-SAVE 2-PRINT OPTIONS DISPLAYED ON PAPER 3-REVIEW ALL PROBLEMS 4-ALL QUESTIONS AND ANSWERS 5-PRINT PROBLEM 6-EXIT >__< The options are explained in the following sections: 0 - NONE This option returns you to the subproblems you previously were exploring. This option is usefull if you change your mind about using an option. 1 - SAVE This option saves the answers, probabilities and the paths explored on disk so that you may continue with the analysis or reexamine the results latter on. The computer will ask you for the name of the file you want to save it on. The computer will then save the information on the default disk drive. As with all files, if you save the information under the same name you previously used, you will overwrite (lose) the original file with the same name. 2 - PRINT OPTIONS DISPLAYED ON PAPER This option prints the problems and subproblems displayed on the screen on paper. It does not change any of answers or search path. 3 - REVIEW ALL PROBLEMS The computer will display : PRINT OUT PROBLEMS DO YOU WANT TO CHECK ALL PROBLEMS OR ONLY THOSE SEARCHED ? 0 - RETURN 1 - ONLY THOSE ALREADY SEARCHED 2 - ALL - TAKES A LOT LONGER >__< (end of screen) Use 0 if you have changed your mind and do not want to review any of the problems. Using option 1 will check only the options that you looked at. Using option 2 will check every problem and take a lot longer. If you have searched the tree and already looked at all of the probable solutions you probably only need to use option 1. The computer will then display: PRINT OUT ALL PROBLEMS WITH A PROBABILITY FOR HIGHER THEN ENTER A NUMBER FROM -1 TO 100 >_____< AND WHOSE PROBABILITY AGAINST IS LOWER THEN ENTER A NUMBER FORM 0 TO 101 >_____< (end of screen) The computer will go through each problem and display it if it meets the conditions you entered. For example you may request the computer to display all problems with a "probability for" higher than 50% and a "probability against" lower than 50%. If you entered CHECK ONLY THOSE PROBLEMS ALREADY SEARCHED the computer will display the problems that were already searched that meet the higher than 50% "probability for" conditions and "probability against" lower than 50% condition. If you entered CHECK ALL PROBLEMS the computer will display every problem that has a "probability for" higher than 50% and a "probability against" lower than 50%. If you set the search limits at "probability for" greater then -1 and "probability against" lower than 101 all the problems will meet these conditions and will be displayed. Conversely if you set the limits at "probability for" greater than 100 and "probability against" less than 0 then none of the problems will meet the conditions. The computer will then display : DO YOU WANT THE PROBLEMS 1 - SHOWN ON THE SCREEN ONLY 2 - PRINTED ON PAPER AND SHOWN ON THE SCREEN 3 - PRINT ON PAPER WITH SUPPORTING RULES >__< (end of screen) If you enter 1 the computer will print the options on the screen only. If you expect a lot of problems to be printed then you may want to have them listed on paper since you can only view 10 problems on the screen at one time. After the computer has printed out all the problems the computer will display : DO YOU WANT TO CONDUCT A SEARCH FOR ALL AND MULTIPLE SOLUTIONS 1 - YES SEARCH 2 - NO >__< (end of screen) If you choose 1-yes the computer will print or show on the screen all the solutions that solve any one of the problems that met the previous conditions. This option may not be used if there was more then 250 problems that meet the conditions you previously specified ( The computer will tell you if there are more then 250 problems). 4 - ALL QUESTIONS AND ANSWERS This option is used if you want to review the questions and answers. The computer will display : DO YOU WANT 1 - ONLY QUESTIONS ANSWERED SHOWN 2 - ALL QUESTIONS SHOWN >__< DO YOU WANT 1 - SHOWN ON THE SCREEN ONLY 2 - SHOWN ON THEN SCREEN AND PRINTED ON PAPER >__< (end of screen) The options are self explanatory. It should be noted that if you request all questions shown if may take a while to look at hundreds of questions if the application contains hundreds of questions. 5 - PRINT PROBLEM This option prints a single problem on paper with its supporting rules (questions). 6 - EXIT This option is used to exit the program. Prior to leaving the program the computer will warn you that you are about to lose the answers you have entered if you have not saved them and give you the option not to exit the program. EXPLANATION OF THE PROBABILITY CALCULATIONS This expert system uses two distinct probabilities. The PROBABILITY FOR is the probability that the problem exits. The PROBABILITY AGAINST is the probability that the problems does not exist. We have elected to use two separate probabilities as opposed to one single probability as two probabilities provide more information to the users. The probabilities have a limit of 0 to 100. For example the following probabilities may be interpreted as : Probability For Against Meaning 100 0 100% chance the problem exists no evidence against 90 0 90% chance the problem exists no evidence against 50 0 50% chance the problem exists no evidence against 0 100 100% chance the problem is ruled out no evidence for 0 80 80% chance the problem is ruled out no evidence for 0 50 50% chance the problem is ruled out no evidence for 80 30 80% chance the problem exists 30% chance the problem is ruled out 60 60 60% chance the problem exists 60% chance the problem is ruled out 90 90 90% chance the problem exists 90% chance the problem is ruled out This indicates probable incorrect answers First you should notice that the number do not have to add up to 100. If there is evidence both for and against each problem the sum of the probabilities may exceed 100. If the probability for and against are both high then there is a chance one of the questions was answered wrong. Secondly low probabilities both for and against cancel each other out. For example if there is a probability for of 30% and a probability against of 30% there is probably just circumstantial evidence both way and means about the same as 0% probability for and 0% probability against. On the other hand if there is a probability for of 80% and a probability against of 80% you probably answered one or more of the questions wrong or the system was set up poorly. HOW THE PROBABILITES ARE CALCULATED For example suppose the problem "poor physical shape" has the following rules : 1 Can you run 5 miles 1-yes 2 no NA=1 -70 2 Can you swim 2 miles 1-yes 2 no NA=1 -60 3 How many times a week do you exercise NA<3 50 4 How for can you walk in miles NA<3 60 The "NA" Stands for no answer. Suppose that you answer question three that you exercise zero times per week and question four that you can walk only one mile. Now, question three has probability for of 50 and question 4 has a proability for of 60. You might think that we should add up the 50 and 60 which equals 110. However you cannot have a probability of 110%. If you remember back to your days in probability and statistics when adding two probabilities you have to subtract the probability of their intersection. Assuming that the probabilities are independent the probability of an intersection is .5 times .6 which is .3 . 110% - .3 = 80% . An easier way to calculate the probability assuming independent events is merely to multiply the difference between the current probability from one hundred, multiply that by the probability that you are adding, then add to the old probability. For example 50% old probability + 60 % 100 - 50 old probability ---- + 30 50 x 60 = .30 -- 80 new probability The computer does all the above calculations. The examples are just provided to show you what the computer is doing. All the subproblems of a problem assume the probability against of all the branches that it belongs to. This is because if there is evidence that you are not crazy then the same evidence and probability applies to you not being psychotic or neurotic. However, note that subproblems do not assume the probability for of the branches they belong to. This is because if you are crazy it does not indicate that you are psychotic as you could be another subproblem of crazy. NOTES ON USING THIS EXPERT SYSTEM First of all this expert system or any expert system has no common sense. Any expert system knows only the rules, questions, problems and solutions that it has been programmed with. An expert system does not know anything outside of the area it has been programmed in. This expert system was designed to be used as an aid, not the sole authority in arriving at problems and solutions. The subproblems, rules, and probabilities are displayed most of the times. Computers are good at keeping track of hundreds of rules, questions, and answers. However the computer does not have any common sense therefore it is up to you to provide the common sense. Secondly any application is only as good as the rules, questions, problems, and solutions with which it was set up. The sample application should demonstrate this point. No one is perfect and even experts disagree on many things. The point is just because an expert system is run on a computer is no indication that the results it gives are correct. **************************************************************** HOW TO SET UP YOUR EXPERT SYSTEM This section provides the information necessary to set your own expert system. It is not necessary to read or understand this section if you are only going to be using an expert system that someone else set up. The first thing you have to decide is whether this expert system can handle your application. This expert system is limited by the number of questions, problems, and solutions that can be processed. The way the system is currently set up is for a maximum of 3000 questions, 1000 problems and an unlimited number of solutions. Your expert systems may be limited by the memory addressable by your BASIC language and the storage space on your floppy disks. You can always modify the program to read both drive A and B or a hard disk or you could split your expert system into several expert systems with the same introductory questions. There are a lot of applications that are better solved by algorithmic programs. For example chess programs and operation research programs are best designed by algorithmic programs. If you do not know much about expert systems you may want to read a book or two on expert systems before you try to design an expert system. Unfortunaltly most of the books on expert systems are expensive and none that I have read were that good so I do not have any to recommend. Any expert system requires that the area of expertise have: 1. a finite and known number of problems 2. definable rules that support or deny each problem 3. a finite number of known solutions For example, it is presently impossible for an expert system to design a house because there is an infinite number of combinations of rooms, dimensions, materials, etc. and there are no definable rules that indicate when to use which materials, colors etc. On the other hand it is possible to design an expert system to diagnosis fixing a car because the number of problems is finite and there are known rules to determine if a part of the car is broken. Obviously it helps if you are an expert or get help from an expert to get the correct rules, problems and solutions otherwise you could end up with an application as incorrect as my sample application. Since this program is written in BASIC and you are supplied with the source code you can easily modify it to add extra features you may need for your expert system. The program REM.BAS on disk 4 contains remarks on almost every line of the program. The remarks program will not run. If you are going to modify the program you should load the program REM.BAS then list it out on paper. SYSTEM STRUCTURE The expert system uses three files QUESTION, PROBLEMS, SOLUTION. The files are set up and maintained using the database program MAIN.EXE . Read the Database manual for instructions on how to use the database. Use disk 4, the expert system disk, for the program data disk. QUESTION FILE The question file has the following four fields : 1 Question String with maximum length 50 2 Always Asked Integer 3 Continued on Record Integer 4 Dummy Integer The question is the question that you want asked. If you want the question always asked as an introductory question then enter number 2 in field 2. If you can not fit the question in on 50 characters you may continue it by entering the record number the question is continues on in field 3. Enter 0 or 1 in the continued on record number if you do not want to continue the question. If you are on an a continued record enter -1 if the question is not further continued or -X , X being the record number the question if further continued on. PROBLEMS The problem file contains the following fields : 1. Description String with maximum length 50 2. Subproblem to Integer 3. Priority Integer 4. Primary Solution Integer 5. Continued on Record Integer 6. Dummy Integer 7. Rule-Type 1 Integer 8. Question-Rule 1 Integer 9. Fact Value 1 Single Precision 10. Probability 1 Single Precision 11. Rule-Type 2 Integer 12. Question-Rule 2 Integer 13. Fact Value 2 Single Precision 14. Probability 2 Single Precision 15. Rule-Type 3 Integer 16. Question-Rule 3 Integer 17. Fact Value 3 Single Precision 18. Probability 3 Single Precision 19. Rule-Type 4 Integer 20. Question-Rule 4 Integer 21. Fact-Value 4 Single Precision 22. Probability 4 Single Precision 23. Rule Type 5 Integer 24. Question-Rule 5 Integer 25. Fact Value 5 Single Precision 26. Probability 5 Single Precision The "description" is the name of the problem. The description is limited to 50 characters and may not be continued. The "subproblem to" number is the number the problem is a subproblem to. Enter 0 it is a start node and has no subproblems. Enter 5000 if this record is a continuation of another problem. The "priority" is the search pattern priority. The range is from 1 (lowest) to 9 (highest). The numbers with the highest priority are searched first. The "primary" solution is the record number of the solution that is the most recommend solution for the problem. The "continued" on record number is the record number the problem is continued on. Only the rules may be continued. Enter 1 or zero if the problem is not continued. Use -X, x being the record number the problem is continued on if the record is already continued. Enter -1 if the record is the last record that the problem is continued on. The dummy variable is not used. It may be used for writing special features into the system. On each record the problem may have five rules. Each rule has four parts to it : Rule Type : 1 =, 2 <, 3 >, 4 >< Question-Rule : The question that corresponds to the rule Fact Value : The value the answer is compared against Probability : positive for probability for negative for probability against SOLUTION FILE The solution file contains the following fields : 1. Description String with maximum length 50 2. Continued on Record Integer 3. Dummy Integer 4. Solves Problem 1 Integer 5. Success Rate 1 Integer 6. Solves Problem 2 Integer 7. Success Rate 2 Integer 8. Solves Problem 3 Integer 9. Success Rate 3 Integer 10. Solves Problem 4 Integer 11. Success Rate 4 Integer 12. Solves Problem 5 Integer 13. Success Rate 5 Integer The description is the name of the solution. The description may not be continued. It is limited to 50 characters. The continued on record number is the number the solution is continued on . Enter 0 or 1 if the solution is not continued. Enter -x, x being the number the continued on record number if the solution is already continued. Enter -1 if entering a continued record that is not being further continued. The dummy variable is not used. It may be used in writing modifications to the system. Enter any number you want. Each record stores up to five solutions. Solves Problem - the record number of the problem it solves Success Rate - the success rate of the solution on this problem You can enter a negative success rate if the solution has a negative impact on certain problems that you want to point out. You may want to list out the files PROBLEMS, SOLUTION and QUESTION for the sample application to see how they are set up and how they affect the way the system runs. Use the database program MAIN.BAS to print out the files. NOTES ON DESIGNING YOUR EXPERT SYSTEM We would recommend that you design and review your system on paper before you start typing the data in to the files. We recommend the following steps in designing your expert system. 1. Write down on paper all the possible problems. 2. Group the problems as subproblems of other problems. Keep in mind that people work best with 7 or less alternatives so you might want to try to limit the number of subproblems to 7. Also there is only 25 rows on computers of which the prompts and other information takes up several lines so you should try to keep the number of subproblems to less then 10. 3. Choose the questions. If possible it is best to have 5 or fewer questions. You may have up to 20 questions. If possible chose 2 or 3 easy to answer questions that give the highest probability for and 2 or 3 questions that will give the highest probability that the highest probability against. If there are questions that are easy to answer that will virtually confirm or deny the existence of the problem do not waste your our your users time on questions that provide circumstantial evidence. You should also try to use the same question for more then one problem if possible to lower the number of questions the user must answer. Also remember that all questions must be answered with a number so you are limited to multiple choice questions or asking for numerical data. 3. Choose the solutions. It is best, if possible, to list two or more solutions for each problem. This is because there may be one solution that will solve several of the problems. 4. Enter the questions, problems and solutions onto the files using the database program MAIN. Use disk 4 as the program data disk 5. Test and debug your application. You can modify any of your files using the database program MAIN. Some applications may not need to use the solution feature of this expert system. You have the source code so you can remove the solution options rather easily if you know BASIC. (end of Expert System Manual, last update 11/8/84)