ProDec - procedures for decision making

Model Elements Functions How to... Function keys Dialogs Data format About ProDec

Decision procedures for emergency situations

It is known from human experience that proper actions taken in the emergency situation (e.g. flood wave or dangerous pollution) may save human lives and property. Unfortunately, we usually do not know exactly which actions are proper in a specific situation. Emergency situations are unpredictable, or at least are not fully predictable. We may not know the place, the time and the scale of these dangerous events. Because of this, decision making in emergency situations is quite a difficult task. People responsible for decision making are under very strong stress and can easily make errors that cost too much. To avoid this, the detailed procedures for each situation should be prepared based on knowledge and experience of decision makers and experts.

ProDec is a decision support tool for constructing procedures in the form of a decision tree.  Assuming that we know the values of parameters important for the decision making process, we may determine, which action should be taken, depending on the parameter values.

  Model

In ProDec the decision tree is defined as a collection of rules. The first rule is the starting point of the decision tree design and analysis. Each rule is a collection of:

In fact any rule is a decision subtree whereas the first rule represents the whole tree. The decision tree can be defined as a single, even if quite complex, rule, but it might be convenient to define more rules if the same subtree appears more than once. The typical decision tree structure with few rules is shown below:

The Conditional expression (IF state THEN actions) has two parts:

e.g. if it is raining, then open the umbrella. Such conditional expression defines actions that should be taken if some state occurs. Each condition is described in ProDec by a single state name but the state entering the condition may be composite. It is defined as a simple fuzzy logical expression given in a readable, linguistic form:
IF water level is very high OR water level is high AND the rain forecast is high THEN ...
The text "water level is very high" in the above example represents the fuzzy value "very high" related to the "water level" parameter. All fuzzy values are described by 4 parameters necessary to define the trapezoidal membership function.

The action part of the conditional expression is a collection of:

Using this model the complex decision trees can be defined and presented in a clear, well structured and readable form.

  Elements

The basic elements of ProDec decision tree model are listed and described below:

Parameter - measurable data significant for the decision making process. The parameter is described by its name, current value, unit of measure,  range of values and, if necessary, longer description in the form of HTML page. Examples: water level, temperature,..

Value (fuzzy) - a pre-defined precise ("crisp") or fuzzy number being the (possible) value of a parameter; a fuzzy (trapezoidal) value is a fuzzy subset of the set of values of the parameter; in defining the rules we strive at defining the fuzzy parameter values, which can be assigned a linguistic expression like "low", "medium", "very high" etc. Example below shows a fuzzy value of the parameter "height of water level", this fuzzy value being "high water level":

The membership function of the fuzzy water level value illustrated ("high water level") equals 1 for the range 315..360 of water levels. Any specific value from this range is classified as "high water level". Value below 300 and above 410 are definitely not "high water levels" (in the latter case they might belong to the value of "very high water level"). Water levels in the ranges 300..315 and 360..410 belong to the fuzzy border of the "high water level" value.
In general, a fuzzy value represents some range of values (with fuzzy border) rather than an exact value. Linguistic equivalents of fuzzy values are quite frequently used in natural language, thus decision tree definition with fuzzy values can be easily understood.

State - a value of the parameter, which enters the rule, usually in terms of a condition (a threshold or a specific value, for which a consequence is defined). State is a subset of parameter space, involving one or more parameters.  Because fuzzy value is defined as some parameter range (with fuzzy border), state can be defined as some logical expression with fuzzy values, e.g. "heavy rain forecast and very high water level", defining the "alarming state". This type of definition is very close to natural language descriptions of states at which some actions are recommended. In ProDec only simple logical expressions are used, in order to be easily understood, namely disjunction of conjunctions of fuzzy values.

Action - specification of the consequence resulting from the satisfaction of a condition (attainment of a definite state by a parameter value). Action defines what must be done or is recommended to be done when some state occurs e.g. "IF alarming state THEN announce evacuation". Optional description, in the form of HTML file, can be supplied for each action to cover technical aspects of the action, responsibility issues etc.

Rule - collection of conditional expressions, actions and references to other rules. Basic component of a rule is an "IF... THEN ..." expression, relating satisfaction of a condition ("IF...") to an action ("THEN...").

  Functions

ProDec editor is a tool for decision procedures development. It supports two basic functions:

All editing can be done in interactive mode.  In this mode you can add new elements to the decision tree, set all parameters, edit names and define relations to other elements.

  How to...

Create new project
No function key is assigned to this function. Open the default starting file named "start.xml" using Open function key (load existing project)  and then save it with the new name using Save as function key (save existing project).

Load existing project
Press Load function key. The standard "open file" dialog will appear and let you browse through directories for XML file with project data (parameters, values, states, actions, rules and tests).

Save updated project
Press Save function key. The standard "save file as" will appear and let you browse through directories. You can override the original file or, if you prefer to save the old file contents, you may save the file with a new name or in some other directory.

Upload project
Press Save function key with right mouse button. The dialog will appear and let you set upload parameters: user login, user password, URL address of Transcat Data Access Service and relative path to the main project file. After pressing Upload button the main project file and all related files will be uploaded.  Uploading may last few minutes. Wait for the message "Upload finished". To avoid project file mixing and overwrites it is recommended to keep all project files in separate directories. The path defined in dialog parameters must not be identical to the current project path. Upload and download feature is useful for information exchange between partners working in different places.

Download project
Press Load function key with right mouse button. The dialog will appear with same parameters as for upload. The only difference is the Download button in place of Upload button. After setting parameters press Download button to download main project file and all related files. 

Add new decision tree element
In the view with Parameters, Values, Actions and Tests a simple list of elements is displayed on the left side of the screen.  To add a new element click right mouse button on the existing element to start dialog. In the bottom part of the dialog window a short list of elements is displayed with the name of selected item in the middle. You may add a new element before or after the existing element selecting one of elements with "..." name.  Edit the new element name in combo box window and click on Add button (with + sign) to finish. Example:



In the above dialog the parameter named "Water level H-14 at Lądek" will be added before the parameter "Water level H-11 at Bystrzyca".
In the view with Rules the list of elements is more complex.  It is hierarchical and contains elements of different type.  Short list of elements displayed in the bottom part of the dialog window is more complex, too. Depending on your selection of an element with "..." name you may add the new element before or after the existing element on same level of hierarchy or on the lower level, after an existing element.

Set element details
Some of element details can be edited directly in the main view of an element. In this way you can edit the ranges and units of parameters. In the view with tests you can change parameter values set for each test. Other element details can be edited in the dialog started after the right mouse button click on the selected element. Look at Dialogs description in this help for more information.

Delete decision sub tree or element
Select decision sub tree or element in the list displayed on the left side. Click with right mouse button on it to start dialog and then click on Delete button in the top bar of the dialog. If Delete button is inactive it means that the element you want to delete is currently in use and can not be deleted. You must edit first those elements that are using the element you want to delete and remove all unnecessary dependencies.

Duplicate or move decision sub tree or element
In ProDec editor the clipboard operations (copy, cut and paste) are implemented and can be used for duplication or moving of elements and sub trees. First, you should select an element (or sub tree) and click with right mouse button on it to start the dialog. Then you may copy selected element to the clipboard with Copy or Cut button from the top bar in the dialog. Using Cut button will remove the selected element from the old place, thus only clipboard copy will remain after this operation. Element from the clipboard can be pasted into any new place or several places in subsequent operations. To do this, look at description Add new decision tree element in this help, but use Paste button instead of the Add button.

Add, change and edit the parameter and action description
Optional description of parameter or action in the form of HTML file can be defined within the dialog started after the right mouse button click on the selected item. Example:



In the above picture "h11.html" is the name of the file with optional description of parameter "Water level H-11 at Bystrzyca".  You can edit this file name. Click with left mouse button on the small button with "<" sign to browse through directories for the file name.  Click with right mouse button on the small button with "<" sign to edit description with WYSIWYG HTML editor.

Create test
To create a new test click on Tests function key to display the Tests view. Click with right mouse button on the selected test name in the list of tests to start the dialog for test edition. In this dialog you can add a new test before or after a selected test. Look at Dialogs description in this help for details.

Run test
To run test you must first display Tests view with Tests function key and select the test to run. Each test is defined by the parameter values set. You can edit these values and run a test with a new set of values, but good practice is to create many tests with different names so that they can be demonstrated to other people in future. To run test use Run function key. Right mouse button click on Run function key will display the detailed result of the decision tree evaluation.

  Function keys

Main screen function keys:

Press Help function key to display help file, you are now looking at. Press once more to hide it.
Info key will split the main window to two parts. In the bottom part additional information related to the selected item (parameter or action) is displayed.
Press Load function key to find and load a new XML file containing all program data (parameters, values, states, actions, rules and tests)
Press Save function key to save XML file in a new or existing file containing all program data (parameters, values, states, actions, rules and tests)
Press Parameters function key to display parameters view with the list of parameters on the left side and selected parameter details in the center. In this view you can edit parameter ranges and units. Details of the selected parameter are displayed as a top item, below this item are displayed fuzzy values related to this parameter. They are displayed in graphical form as colored bars showing current range and fuzziness settings. These settings can be changed by dragging the fuzzy border with the mouse in the bar or below the bar to change fuzziness. Use Info function key to view optional information related to the selected parameter.
Press States function key to display states view with the list of defined states on the left side and the selected state definition in the center.
Press Actions function key to display actions view with the list of defined actions. Use Info function key to view optional information related to the selected action.
Press Rules function key to display the rules view. In this view the hierarchical structure of decision tree is shown.
Press Tests function key to display the tests view with the list of defined tests on the left side and the list of parameter values of selected test in the center. In this view you can select test to be executed and you can set parameters values for selected test.
Run function key is active after test selection in tests view. If you press this key with left mouse button, results of decision tree evaluation, for parameter values set in selected test, will be displayed.  If you press this key with right mouse button, detailed results of decision tree evaluation will be displayed.
Press Install function key to install ProDec decision system on a server. Program will create all neccessary database tables and will fill it with data (definitions of parameters, values, states, actions and rules) from the last test run. Before executing this function user will be prompt to define some  parameters - path, server name, user login, database name, database password. ProDec do not access database directly. Simple tcdb.php program supports interface to MySQL database in this version of ProDec. The path parameter is the url address of tcdb.php program.
In dialog displayed, use Add button to install additional language version - ProDec database tables are not created in this case but only filled with additional data.
Press Exit function key to quit the ProDec program.

Function keys used in dialogs:

Copy button is used to copy a selected item (together with all child items) to the clipboard. You can then put the copied item(s) from the clipboard into some other places with Paste button.
Cut button is used to cut a selected item (together with all child items) to the clipboard. You can then put the cut item(s) from the clipboard into some other places with Paste button.
Paste button is used to put an item (together with all child items) from the clipboard to the location marked by cursor or selection.
Delete button is used to delete a selected item (together with all child items). The removed items are lost.
Add button is used to insert a new item into the decision tree. The added item is inserted into the place marked earlier with the right mouse button.
Edit button is used to call edit item dialog.
OK (Update) button is used to close dialog and save all changes.
Remove button removes selected item from the list.
Insert button inserts the selected item in reference list, before selected item in edited list.
Append button appends new item to the list.
Or button inserts "or" operator before selected item in the list.
Remove button removes selected item from the list.

  Dialogs

In ProDec the standard File Open and File Save as dialogs are used for project file operations. Using these dialogs you can browse through directories searching for files with decision tree definition in XML format.

Specialized dialogs were designed in ProDec for decision tree items editing. The dialog appears after right mouse click on an item of the left side view showing decision tree elements. For different types of decision tree elements (parameters, values, actions, rules) the respective dialogs are slightly different. An example of the dialog for parameter item editing is shown in the picture below:


There are function buttons in the upper part of the dialog: Copy, Cut, Delete, Edit and Update (OK). Below, there is the editable field with item name and the field with file name that contains parameter description (HTML file name or relative path if file is in a separate directory or full internet address starting with http:// ). In the bottom part of the dialog a short list of elements is displayed with the name of selected item in the middle. Use this list if you need to add or paste some element.  After selecting one of "..." elements in this list you will see new buttons in the upper part of the dialog: Add and Paste.

In most cases clicking on a dialog button will complete the operation and will close dialog. Clicking on Edit button (with pen icon) will display the new dialog that lets you build the list of elements composed of already existing elements. An example of the dialog of this type is given below:

In above dialog the list of already defined values is given on the left and on the right there is the list of values selected for the currently edited parameter. In this dialog you can edit both lists. You can add new value names from the edit field on the right, copy value names from the left to the right list and remove elements from both lists. Top button on this example is grayed because it is currently inactive as no item from the right list was selected.

  Data format

Information given below is auxiliary and is not necessary for using the ProDec editor; it may help, however, to understand how ProDec works.

In ProDec editor two data files in XML format are used:

The first file name is fixed. ProDec editor reads this file at the start to set the global parameters and resources related to the program localization. An example of prodec.xml file is given below:

<?xml version="1.0" encoding="utf-8" ?>
- <emproc lang="en" help="ProDecHelp.html" open="project.xml" name="Procedures for Decision Editor">
- <tooltips>
  <tooltip name="butHelp" text="Help" />
  <tooltip name="butShow" text="Contex help" />
  <tooltip name="butLoad" text="Open" />
  <tooltip name="butSave" text="Save" />
  <tooltip name="butCopy" text="Copy" />
  <tooltip name="butPaste" text="Paste" />
  <tooltip name="butAdd" text="Add" />
  <tooltip name="butDelete" text="Delete" />
  <tooltip name="butParameters" text="Parameters" />
  <tooltip name="butStates" text="States" />
  ...
</tooltips>
- <items>
  <item name="events" text="events" />
  <item name="event" text="event" />
  <item name="parameters" text="parameters" />
  <item name="parameter" text="parameter" />
  <item name="states" text="states" />
  <item name="group" text="group" />
  ...
</items>
</emproc>

The second line of prodec.xml file contains parameters:

The tooltips group and the items group contain the list of names together with the text in selected language that will be displayed to the user. To create a new language version of ProDec editor only the values of text parameter should be changed.

The second file (project.xml) contains all data used in a project. An example of project.xml file is given below:

<?xml version="1.0" encoding="utf-8" ?>

- <emproc text="Local Flood Protection System for Kłodzko" file="lsop.html">
- <parameters>
  <parameter id="p1" text="Water level H-14 at Lądek" value="10" range="0,160" units="cm" values="v11,v12,v13,v14" file="h14.html" />
  <parameter id="p2" text="Water level H-11 at Bystrzyca" value="100" range="0,200" units="cm" values="v21,v22,v23,v24" file="h11.html" />
  <parameter id="p3" text="Water level H-4 at Szalejowo" value="100" range="0,200" units="cm" values="v31,v32,v33,v34" file="h4.html" />
  ...
  </parameters>
- <values>
  <value id="v1" text="No rain" inrange="1,2,3,4" />
  <value id="v2" text="Light rain" inrange="1,2,74,140" />
  <value id="v3" text="Moderate rain" inrange="80,140,200,250" />
  ...
  </values>
- <states>
  <state id="s1" text="Emergency state" when="p4:v43,p6:v4,or,p6:v5,p7:v5" />
  <state id="s2" text="Alarm" when="p4:v44,p6:v3,or,p4:v43,p1:v14,p2:v24,or,p4:v43,p6:v5,p7:v5" />
  <state id="s3" text="Alarm call-off" when="p4:v43,or,p4:v44,p6:v2,p7:v2" />
  ...
  </states>
- <actions>
  <action id="a1" text="Preparations for expected flood" file="lsop1.html" />
  <action id="a2" text="Evacuation of Klodzko" file="lsop2.html" />
  <action id="a3" text="Evacuation downstream Klodzko" file="lsop3.html" />
  ...
  </actions>
- <rules>
- <rule id="r1" text="State checking">
- <if state="s1">
  <do action="a1" />
  </if>
- <if state="s2">
  <check rule="r2" />
  </if>
  </rule>
- <rule id="r2" text="Flood alarm">
- <if state="s5">
  <do action="a2" />
  </if>
- <if state="s6">
  <do action="a3" />
  </if>
  </rule>
  </rules>
- <tests>
  <test id="t1" text="Average state" rule="r1" set="p1:70,p2:80,p3:40,p4:100,p5:80,p6:5,p7:0" />
  <test id="t2" text="High water level" rule="r1" set="p1:100,p2:120,p3:70,p4:170,p5:120,p6:0,p7:0" />
  <test id="t3" text="Heavy rain" rule="r1" set="p1:120,p2:150,p3:70,p4:170,p5:160,p6:150,p7:180" />
  ...
  </tests>
  </emproc>

You may have many project files for different projects or different versions of the same project but you can load and edit with ProDec only one project file at a time. In general this file should be edited only with ProDec editor, as some relations between data items are important and it is quite difficult to make changes in this file and keep it free of errors.

  About ProDec

ProDec - procedures for decision making (editor & tester)
Version: 1.0
Developed in the framwork of TransCat project

Contact: Andrzej Ziolkowski
A.Ziolkowski@wit.edu.pl