====== Expert system design ====== ===== ARD design ===== * For theoretical introduction and other information, read the following article: [[http://ai.ia.agh.edu.pl/wiki/hekate:ardplus|ARD]] * The ARD design is supported by tools: * [[http://ai.ia.agh.edu.pl/wiki/hekate:varda|VARDA]] * [[http://ai.ia.agh.edu.pl/wiki/hekate:hjed|HJed]] * During this lab classes the VARDA tool will be used. ===== VARDA ===== * The VARDA-based design requires a knowledge of Prolog language. * The most convenient way of design is to prepare a separate file, which contains an ARD model. Then such a file can be loaded into VARDA. The simple example of VARDA file can be found here: {{:hekate:cases:hekate_case_thermostat:hekate_case_thermostat-mdl.pl|}} * VARDA provides a dedicated interface (predicates) that facilitate the ARD design: * Adding a new attribute:ard_att_add('Attribute_name')Creates an attribute with the specified name. In order to use an attribute, it must be previously defined with the help of this predicate. * Adding a new property:ard_property_add(['Attribute_name'])Creates the //property// containing one attribute called //Attribute_name//. This predicate is usually used on the first stage of designing for creation of the first, most general model of the system. * Model finalization:ard_finalize(property,[list_of_attributes])Finalization allows for creation a more detailed description of the system. In practice, it replaces a property containing one conceptual attribute with other property containing a several attributes, which more precise describe the system than the conceptual one i.e.:ard_finalize(['Time'],['Date', 'Hour', season, operation])In this example the property containing the attribute //Time// is replaced with the property containing attributes //Date//, //Hour//, //season// and //operation//. These attributes more precise define the concept of //Time//. The finalization causes the following changes on a ARD diagram. \\ Before: \\ {{http://ai.ia.agh.edu.pl/wiki/_media/hekate:cases:hekate_case_thermostat:hekate_case_thermostat-7-ard.png?w=&h=&cache=cache}} \\ and after: \\ {{http://ai.ia.agh.edu.pl/wiki/_media/hekate:cases:hekate_case_thermostat:hekate_case_thermostat-6-ard.png?w=&h=&cache=cache}} * //Split// operation allows for division of one property containing the several attributes into several properties. During the split operation, the dependencies between new properites must be defined: ard_split(complex_property, list_of_properties, list_of_dependencies_between_properties) * //complex_property// - is in the form //[att1, att2, att3]// * //list_of_properties// - list of new properites: * //[ [att1], [att2], [at3] ]// * //[ [att1, att2], [at3] ]// * //[ [att1], [att2, at3] ]// * //list_of_dependencies_between_properties// a list of pairs that defines a list of dependencies between //properties//. In example:[[[att1], [att2]], [[att1], [att3]]]defines the following dependencies: * //property [att2]// depends on //property [ att1]// * //property [att3]// depends on //property [att1]// * [[[att1, att2], [att3]]]defines the following dependencies: * //property [att3]// depends on //property[att1, att2]// * [[[att1], [att2, att3]], [[att2,att3], [att4]]]defines the following dependencies: * //property [att2, att3]// depends on //property[att1]// * existing //property [att4]// depends on //property [att2, att3]// * The complete code can be as follows: ard_split([att1, att2, att3], [[att1], [att2, at3]], [ [[att1], [att2, att3]], [[att2,att3], [att4]] ]) For the above example, the split operation in the form: ard_split(['Date','Hour',season,operation], [['Date','Hour'],[season,operation]], [[['Date','Hour'],[season,operation]],[[season,operation],['Temperature']]]), causes the following changes on a ARD diagram. \\ Before: \\ {{http://ai.ia.agh.edu.pl/wiki/_media/hekate:cases:hekate_case_thermostat:hekate_case_thermostat-6-ard.png?w=&h=&cache=cache}} \\ and after: \\ {{http://ai.ia.agh.edu.pl/wiki/_media/hekate:cases:hekate_case_thermostat:hekate_case_thermostat-5-ard.png?w=&h=&cache=cache}} ===== Exercise ===== * In this exercise the model of the Cashpoint system will be designed. The design starts with the highest ARD level and TPH diagram: \\ {{http://ai.ia.agh.edu.pl/wiki/_media/hekate:cases:hekate_case_cashpoint:hekate_case_cashpoint-tph.png?w=&h=&cache=cache}} * The details can be found here: [[hekate:cases:hekate_case_cashpoint:ard_design|]] * The first step is to create a VARDA file, which describes the above system. * Then the file can be loaded into VARDA:./varda filename.pl * All the errors should be fixed. * Use the following template: varda_model_desc :- write('Cashpoint FirstName LastName'). varda_model_cashpoint :- % model definition :- varda_model_cashpoint. * Po poprawnym wczytaniu modelu mamy do dyspozycji następujące polecenia: * When the model is loaded successfully, the following commands can be used: * **shl.** start interactive shell, * **sar.** show the ARD diagram, can be used sar(File), * **shi.** show the ARD history (TPH), can be used shi(File), * **sha.** show the TPH and ARD combined, with can be used sha(File), * **hic.** ARD history collapse, one level up, * **tic.** TPH/ARD history collapse, one level up, can be used tic(File), * **gax.** generate XTT, * **sxt.** show the XTT diagram, can be used sxt(File), * **pxt.** print the XTT diagram, * **xop.** optimize XTT, * **kid.** kill all displays, * **axg.** write ARD model in XML (HML2), can be used axg(File), * **xxg.** write XTT model in XML (MHL2), can be used xxg(File), * **arp.** write ARD model in Prolog, can be used arp(File), The file can be subsequently consulted to recreate the model, * **pur.** purge the entire model. * **pux.** purge the XTT model. * **gen.** run the experimental ARD generator. * **hlp.** get help, * **hlt.** go "bye, bye!". * Using these commands the ARD and TPH diagrams of the more general levels can be displayed. * The last step is to create a //hml// file containing a XTT model schema. This file is a starting point for the next lab classes. ===== Komentarze ===== Z braku lepszego miejsca tutaj studenci wpisują komentarze natury ogólnej do tego lab. 8-)