ZX Review #7-8-9-10
08 ноября 1997 |
|
reader-reader - With 'Light'. Spectrum and expert system.
The Reader - Reader Music by ZET (C) Group 'Light', Serpukhov SPECTRUM AND EXPERT SYSTEM We want to immediately respond to a question - why and why needed and where it is used? A most importantly - is it really possible to realize on the Spectrum? Respond immediately - you can, even at 48K. But first, let's immediately define what an expert system. Under the expert system means a computer system that can offer reasonable advice or carry out a reasonable solution to the problem with some of the available source data. An example of expert systems for Spectrum can be, first and foremost, strategic games, and even more chess programs. This assertion is based on the definition of an expert system, which is endorsed by committee specialist group on expert systems of the British Computer Society. Of course, this article does can not claim complete coverage of this section, but We hope that it will, at least piqued your interest this region, which borders artificial intelligence. In this paper we consider an expert system which suggests a human presence in the initial decision-making process, ie, in learning the system. Considered here an expert system can be simplified represented as follows algorithm: Input > Variables v Application current decisive Rules v Assumption the possible outcome All is good, but at an early stage in such an expert system does not provide data on the program could give assumption about the possible outcome. And here on the stage by a man who acts role of the teacher. Entered into the computer those variables for which accurate the outcome is known, teaches people him. Thus, initially, ie at the training stage, the algorithm expert system might look as follows: Input > Variables < v Application current decisive Rules v Assumption the possible outcome v Yes This is true v No Modification decisive Rules As can be seen from the algorithm, simple expert system is easy to implement on the Spectrum. In proof of this on the algorithm composes a program in BASIC, as a matter of common language. If desired, this program is easy to translate into any other language, even in assembler. For simplicity, assume that there are only two possible outcomes: for example, tomorrow it will rain tomorrow and will not be rain. If you enter and run this program, it asks the question about the number of variables involved. Number of the variable variable name 1 Pressure rises 2 Pressure drops 3 Wind is 4 No wind Clearly, the choice of variables lies entirely on your knowledge and abilities. Then, in memory of the machine created three arrays. Array R - must contain the rules of inference judgments (which is developing a computer), the array V - values of the variables presented in this case, the array V $ - used for storage variable names. The program asks for the names after the launch of these variables. It also asks for the names of variables and O $ B $ - two possible outcomes. Further clarified details of a specific example (for This program requires answers to yes / no). Having collected all the necessary information, the program makes assumptions about possible outcome. When you agree with the system, enter Y, or N - if you do not agree. Then move on to another example. So way the process of machine learning. It should be noted that the machine is gradually improve their predictions about the possible outcome, though how much better - depends on what information you have entered at the beginning. (Editor's note. - Training System will much better if we introduce it REALLY facts have occurred - and whether there was actually rain - and not their agreement or disagreement with its decision). And now he is listing the program. 10 CLS 20 INPUT "Enter the number of VARIABLES"; VAR 30 DIM V (VAR): DIM R (VAR): DIM V $ (VAR) 40 FOR I = 1 TO VAR 50 V (I) = 0 60 R (I) = 0 70 NEXT I: PRINT 80 PRINT "Name these variables' 90 FOR I = 1 TO VAR 100 INPUT "variable name:"; V $ (I) 110 NEXT I: PRINT 120 PRINT "Name the possible outcomes:" 130 INPUT "FIRST EXODUS:"; O $ 140 INPUT "SECOND EXODUS:"; B $ 150 PRINT 160 FOR I = 1 TO VAR 170 V (I) = 0 180 PRINT "VARIABLE:"; V $ (I) 190 INPUT "IS THIS VARIABLE <Y/N>"; A $ 200 IF A $ = "Y" OR A $ = "y" THEN LET V (I) = 1 210 NEXT I 220 DC = 0 230 FOR I = 1 TO VAR 240 DC = DC + V (I) * R (I) 250 NEXT I 260 PRINT "possible outcome -"; 261 IF DC> 0 THEN PRINT O $ 262 IF DC <0 THEN PRINT B $ 270 INPUT "It is true <Y/N>"; A $ 280 IF A $ = "Y" OR A $ = "y" THEN GOTO 150 290 IF DC> 0 THEN FOR I = 1 TO VAR: R (I) = R (I)-V (I): NEXT I 291 IF DC <0 THEN FOR I = 1 TO VAR: R (I) = R (I) + V (I): NEXT I 300 GOTO 150 Once you decide that have trained their expert system around the world, can be safely deleted from the program training block (do not forget only to keep the arrays with data) and to include this program in part any more programs, or use it independently (eg for the prediction of rain for days to come). Imagine, however, that we included the expert system into a strategic game, and computer on the basis of this system manages a kind of fighting robots having very little protection and the weakest means of attack. We also assume that in our system is embedded rule destroy all enemy targets within sight. And now may come a time when This weak robot heroically climb into your rocket launcher, and as a consequence, about her and left. Here we have two choices: the first - is to describe all possible situations (that not very realistic) and the second - entered into the system the opportunity oriented with minimal and maximum values of the variables. In simple terms - make sure that our hypothetical robot with the protection of, say, in 1 unit is not useful in a fight with the robot, with protection in 20 units. Then a block diagram of the expert system will be as follows: Home < v Request variables v Selecting the most > Probable outcome v Yes Can set nye minimal nye and maxi mum value of influence the choice of excitation ble outcomes v No DECISION I must say that this block diagram is not perfect, but due to the fact that minimum and maximum values of the variables tested only when necessary, algorithm is obtained fairly performance. I must say that speed is not the last role. Of course, when you build an expert system which puts medical diagnoses, the then performance is not very crucial. Another thing - computer games. Here even You can donate some intelligence for speed program. But the point here is this: There are two types of decision-making - a parallel and consistent. Here's their blokshemy: Variables v v v v Outcome Parallel solution Request variable < v Can I predict some initial NO v YES Possible outcome Consistent solution Certainly consistent solution is faster, as the parallel solution requires the input of all known variables, and consistent can conclude, using only part of them. By the way, there is speculation that it is acts as the human brain in decision-making. There is no doubt that in general the parallel procedure to obtain a more accurate solution than consistent. However, in this case agree that we are more interested in speed of calculation than correctness of the decision. Algorithm calculation in this case is as follows: Home < v Request variable v Selecting the most > Probable outcome v Yes Can set nye minimal nye and maxi mum value expressions for the remaining variables affect choice of excitation can proceed v No DECISION Thus, we have fast algorithm, describing the action of an expert system in reaching a decision. Naturally, the material This article does not describe all possible solutions and algorithms for this issue, because the problem of artificial intelligence has not been solved until now. However, the simplest algorithms can be applied even when programming on the Spectrum. But implementation of these algorithms for you. So what? You undertake Speccy create intelligent programs? Those who liked this idea, can write their thoughts on the following address: 142214 Serpukhov, ul.Podolskaya, d.107, kv.57 *
Other articles:
Similar articles:
В этот день... 21 November