Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.cplire.ru/Lab144/start/e_jam.html
Дата изменения: Mon Sep 24 15:02:27 2007 Дата индексирования: Mon Oct 1 23:23:45 2012 Кодировка: Поисковые слова: ngc 891 |
We call expert systems that implement visualization of decision making procedure with the help of graphical diagrams the visual expert systems. The visualization provides transparency of decision making procedure and allows one to implement interactive problem solving. This possibility is very important in areas that are characterized by non-monotonic human reasoning and high level of subjectivity of decision making procedure. Actor Prolog is a powerful instrument of rapid prototyping and programming of visual expert systems, thanks to means of visual programming and graphical user interface development automation based on the SADT diagrams. In this chapter we will consider the Jam-E.A training example of visual expert system written on the Actor Prolog language (see the SADT\Jam-E directory). In this example the process of black rowan, apples, and strawberry home-made jam making is described with the help of SADT diagrams. Actor Prolog animates the graphical model, namely it colors diagrams and calculates some critical parameters of the jam-making procedure, depending on berries and fruits chosen by user. Let us remind for readers who are not familiar with the SADT technique that rectangles on the SADT diagrams designate functions (processes) evaluated by simulated system, arrows from the left designate inputs and source materials of given process, arrows from above designate control and rules of the process operation, arrows from the right designate outputs and results of process work, and arrows from below designate instruments and executors of the process. Here is the Context diagram of our SADT model: |
Fig. 1. The Context diagram.
Let us open the "Jam-making" block by left mouse click. The Top-Most diagram including the "Choose berries and fruits", "Sterilize jars and lids", "Prepare berries and fruits", "Boil berries and fruits with sugar", "Cool jam", and "Pour jam into jars" functions will appear. The destination of the "Analysis of model" block will be considered later. |
Fig. 2. The Top-Most diagram.
Note that the program has colored the "Prepare berries and fruits" and "Boil berries and fruits with sugar" blocks red. The user should choose berries and fruits for his jam to provide proper work of these blocks; we will select it later. Now let us open the "Sterilize jars and lids" block and read an instruction on heat sterilization of cooking battery. |
Fig. 3. Heat sterilization of jars and lids.
There is a detailed text description of every operation; one can read it in a comment window that is opened by the right mouse click. Actor Prolog prepares the comments for the blocks automatically on the base of comments supplied by the source SADT model. |
Fig. 4. A view of a comment.
Let us select the ingredients of jam before the consideration of the "Choose berries and fruits" block. Click on the "Choose berries and fruits" block by the left mouse button. Now the Prolog language begins its operation and a dialog box appears on the screen. |
Fig. 5. Selection of berries and fruits.
Let us select the black rowan and close the "Choose berries and fruits" block. |
Fig. 6. Preparation of berries and fruits.
Open the "Prepare sugar mixture" block. The expert system provides for three cases of sugar mixture preparation: one for hard berries (like black rowan), one for large fruits (like apples), and one for soft berries (like strawberry). The selected type of berries (black rowan) corresponds only for one of sugar mixture preparation algorithms. The expert system has discovered this fact and automatically colored corresponding block of the diagram green. On the implementation level a concurrent process of the program, corresponding to the block has switched to the "proven" state; this caused an automatic change of the block color. Another two blocks was painted colorless that means temporary cancellation of corresponding branches of the SADT model (the interpreter paints simple blocks read, but compound blocks like the blocks under consideration colorless).
The color of the "Prepare sugar mixture" upper level block was asserted according to the XOR rule regarding the status of the blocks considered above. Particularly, it was colored green because only a single block included in it corresponds to a proven process of the program. Note that the XOR coloring rule for the "Prepare sugar mixture" block is given explicitly with the help of the |
Fig. 7. Preparation of sugar mixture.
Open the "Prepare some mixture of hard berries and sugar" block. This block includes the following operations: "Boil some water in the saucepan", "Blanch berries", "Prepare some syrup", and "Put berries in syrup". Note that it is necessary to blanch the black rowan. |
Fig. 8. Preparation of sugar mixture with black rowan.
Another two cases of the algorithm, "Prepare some mixture of large fruits and sugar" and "Prepare some mixture of soft berries and sugar", are not suited for the black rowan. Therefore, if one opens these blocks s/he could see that the background of them is colored red. |
Fig. 9. Preparation of sugar mixture with large fruits (unused branch).
|
Fig. 10. Preparation of sugar mixture with soft fruits (unused branch).
Let us turn to the "Boil berries and fruits with sugar" block now. It also contains several cases, namely: "Boiling cycle for hard berries and fruits" and "Boiling cycle for soft berries and fruits". |
Fig. 11. Boiling cycles.
The "Boiling cycle for hard berries and fruits" branch is suitable for black rowan. |
Fig. 12. Boiling cycle for hard berries and fruits.
The "Boiling cycle for soft berries and fruits" branch was switched off. |
Fig. 13. Boiling cycle for soft berries and fruits (unused branch).
Open the "Heat the mixture" block by the left mouse click. Actor Prolog will output the recommended time for mixture heat, appropriated for chosen type of berries. |
Fig. 14. Recommended time of sugar mixture heat.
Let us return to the upper level diagram now and consider the "Analysis of model" block. |
Fig. 15. The total list of necessary cooking battery.
Let us open this block by the left mouse click. We will get a total list of cooking battery that is necessary for jam-making of the chosen berries and fruits. In the course of creation of this list a concurrent process corresponding to the "Analysis of model" block calculates a total list of SADT model blocks that are used for jam-making of black rowan. Then it accepts from every block a list of necessary cooking battery corresponding to this block. The total list of cooking battery necessary for jam-making was assembled on the base of these data. This function of expert system was implemented with the help of recursive processes, suspending ports, and residents. In the course of translation of an SADT model Actor Prolog provides necessary communications between processes corresponding to different blocks. The program guarantees correctness of computed results even in the case of modification of user-controlled parameters, because it is based on pure logical means. Particularly, if one changes selected berries and fruits, the logical reasoning carried by the expert system is modified and the list of cooking battery showed in the dialog box is updated. The recommended time of heat of sugar mixture considered above and the coloring of the SADT blocks also are modified automatically according to the user input. Select the apples as a source ingredient for jam-making and see the modification of the cooking battery list. |
Fig. 16. Automatic analysis of the model.
One can open several diagrams and arrange them by the "Window | Horizontal Tile" menu command to observe the switching of the SADT model branches during the modification of the input parameters. |
Fig. 17. Work with several diagrams.
Open the dialog box of the "Heat the mixture" block and watch the modification of recommended time of sugar mixture heat for various berries and fruits. |
Fig. 18. User interaction with the visual expert system.
Let us look at the source text of the expert system and note that the program is actually very simple. In fact, the development of the program has required no additional efforts of the programmer for implementation of visualization of decision making procedure. The visualization was obtained automatically due to the repeated proving of logical actors and translation of graphical diagrams into the Actor Prolog program. Compare the source text of the program with its full listing including the text created automatically in the course of translation of the SADT model. The definition of the dialog boxes of the expert system one can found here. |
Table of content |