proDEX features through an example of use

proDEX is a tool for qualitative multi-attribute modelling in basic and extended DEX methodology. The most important new features with respect to other tools for this methodology are the use of general hierarchies, numerical inputs and probabilistic utility functions. As the development of these features and some other specific functionalities was initiated by the needs of environmental modelling, the example of use for a more elaborate demonstration of use is from this domain.

Example model

The example model waqNUM2prob.py is a model for assessment of impact of farm-level cropping systems onto the water quality. This is a part of an actual model described in the literature, but the utility functions are altered and serve for demonstration purposes only. The model is designed to assess the differences among the cropping systems, which include particular type of genetically modified (GM) crops and the ones that do not. The structure of the model's concepts looks like this:


We can see that the structure is a general hierarchy - it has the form of a directed acyclic graph. The concepts in the lowest level of the hierarchy are inputs to the model. They influence the concepts on the next level of hierarchy (their ancestors) and these futher influence their ancestors. This continues up to the top of the hierarchy. The influences among particular concepts are depicted by connection lines in the structure and are defined with qualitative utility functions. These functions have the form of if-then rules and are usually given in tabular form. An example of utility function for the concept "runoff water" might be defined like this:

soil state pesticide use runoff water
compact high very low
compact medium low
compact low medium
compact none high
non compact high very low
non compact medium very low
non compact low low
non compact none high

The utility functions in proDEX can also be defined as probabilistic, so that the result of a function is not a single goal value, but a probabilistic distribution of values. Each rule can also be given a parameter named "CONFIDENCE", which is used to express the modeler's confidence in the correctness of provided rules. Using these options, the utility function for the concept "runoff water" can be defined like this:

soil state pesticide use runoff water
compact high { high:0.0 medium:0.0 low:0.1 very low:0.9 CONFIDENCE:0.9 }
compact medium { high:0.0 medium:0.1 low:0.8 very low:0.1 CONFIDENCE:0.9 }
compact low { high:0.1 medium:0.6 low:0.3 very low:0.0 CONFIDENCE:0.9 }
compact none { high:1.0 medium:0.0 low:0.0 very low:0.0 CONFIDENCE:1.0 }
non compact high { high:0.0 medium:0.0 low:0.05 very low:0.95 CONFIDENCE:1.0 }
non compact medium { high:0.0 medium:0.0 low:0.3 very low:0.7 CONFIDENCE:0.9 }
non compact low { high:0.0 medium:0.2 low:0.6 very low:0.2 CONFIDENCE:0.8 }
non compact none { high:1.0 medium:0.0 low:0.0 very low:0.0 CONFIDENCE:1.0 }

The outcomes of alternatives assessment in a model with probabilistic utility functions is a probability distribution of top concept's values. If "CONFIDENCE" is defined in the model, it is also calculated and provided for each alternative.

The input variable "fertilization" (intended fertilizer use in kg/ha) is a numeric one and has to be categorized prior to its use in qualitative rule functions. proDEX allows the categorization to be a part of model definition. This allows the intrinsically numeric values to be entered as numeric (not pre-categorized), what in practice keeps the user's focus on alternatives, rather than on categorization. Another minor benefit is in the fact that the numeric inputs are saved as such in the alternatives and preserve all the information, although the model might require only its qualitative representation.
Since the native proDEX model definition is written in Python, categorizations are defined as very simple programming functions of prescribed form. In our case, the function looks like this:
	def func1(fertilizerVal):
		result = None
		if fertilizerVal <= 120:
			result = {"very_low":1.0, "low":0.0, "medium":0.0, "high":0.0, "CONFIDENCE":1.0}
		elif (fertilizerVal > 120) and (fertilizerVal <= 160):
			result = {"very_low":0.0, "low":1.0, "medium":0.0, "high":0.0, "CONFIDENCE":1.0}
		elif (fertilizerVal > 160) and (fertilizerVal <= 200):
			result = {"very_low":0.0, "low":0.0, "medium":1.0, "high":0.0, "CONFIDENCE":1.0}
		elif fertilizerVal > 200:
			result = {"very_low":0.0, "low":0.0, "medium":0.0, "high":1.0, "CONFIDENCE":1.0}
		return result
	fertilizer_use.generalFunction = func1
Although written in Python code, the essence of function is not hard to understand because of its simple if-then structure. Such a low-level definition might be unfriendly to a modeller without programming experience, but it allows great flexibility in defining categorizations. We could, for instance, define a smooth categorization that would not transform a numeric value into a single qualitative value (as in the above example), but into a corresponding probability distribution of all the possible values (using a Gaussian kernel in their calculation for instance).
Of course, such a definition of categorizations is optional and a user, who is not comfortable with it, can avoid it by defining the model with only categoric variables and taking care for categorizations of numeric variables outside the model.

Basic model exploration

After importing the model in proDEX, we can explore its structure, behavior and utility functions in the Viewer component. The first tab of this component consists of:
  • Basic information about the model (name, number of attributes, nodes).
  • Checkbox for showing or concealing the "CONFIDENCE" parameter in the widgets using current model.
  • Button for graphical preview of the model structure.
  • Button for saving the model in the native (Python) format. This option is used when the model is imported from program DEXi.
The graphical preview of the model is shown in a new window. The right side of the window contains a sketch of the model structure, the controlling options are on the left. The option "Gap width" is used to increase or decrease the initial gap among the nodes in the sketch. This is used to increase readability of complex models.
The next option is "Plot mode", which defines the sketch plotting algorithm. Both sketching algorithms are very simple and have some deficiencies. The "Level-based" mode plots the hierarchy in a bottom-up fashion and is usually a better choice, the "Recursive" mode is experimental and results in very nice plots of some models, but also some very bad ones (like in the case of our water quality model).
As the plotted model structure is just a rough sketch, it is useful for a quick preview. But when working with a model, we usually want to show it in the presentations, articles or web pages. For this purpose, the plotting window has a button "Export GML", which allows the user to export the model structure to a GML format file. Files in this format can be used by various advanced graph drawing packages (such as the free graph editor YeD for instance).
Window with a graphical preview of model structure:



The second tab of Viewer component is used for what-if analysis. This is a simple analysis of model behavior, where the user changes the model input values and observes the changes in the final outcome. It is used for testing the global response and sensitivity of the model. The tab consists of selectors for the values of each input variable, the button that triggers evaluation and the result:



The third tab offers preview of all the utility functions in the imported model. It has a selector of concepts and for each of them, it shows its utility function in a table:


Work with alternatives

The work with alternatives is an essential part of simulations and decision analysis with hierarchical rule-based models. An alternative is an option (situation, scenario) that we wish to assess and compare to other alternatives.
proDEX offers tools for work with alternatives in the "AlternativesEditor" component. Its functionality is demonstrated separately for each of the task groups:

- managing

In the basic view of the "AlternativesEditor":


we can define, save, load and generate the alternatives. The left side of the window contains the controls for these operations. Alternatives are shown in the table on the right (central) part of the window.
An example of an alternative is already given when "AlternativesEditor" in opened. Its values can be changed and it can be given a name or description by selecting it and pressing the "Rename" button. Additional alternatives can be added by pressing the button "Add". They can be defined and renamed like the first one. An alternative can also be deleted by selecting it and pressing the button "Delete".
Definition of a bigger number of alternatives for a particular problem is a time-consuming task. To avoid this every time we shut down the proDEX, the alternatives can be saved to a file and later loaded using the "Save" and "Load" buttons. This way we can also generate sets of alternatives for different assessments on the same model.
Alternatives can also be automatically generated. For very small models (like the "Car" model from Introduction), we can generate all the possible alternatives by pressing the button "Generate All". However, this is dangerous when we work with bigger models. The number of all the possible alternatives equals the product of the number of values across all the input variables, which easily exceedes the number of alternatives that can be stored in memory of a computer...or even memory of all the computers on the world. To avoid this combinatorial explosion, we can use the interactive generator of alternatives. This useful tool is invoked by pressing the button "Generate some":


In the interactive generator, we can select only the values of input variables that are relevant in a particular setting. The alternatives, generated from the selected values, are inserted in the table of alternatives by pressing the buton "To table". At the bottom, there is also a line with information about the current number of alternatives. If this number exceeds 1000, a warning is issued before the alternatives get generated. Besides the problems of storing and representation of large number of alternatives, it is also very questionable whether it is possible to properly analyze large number of alternatives.

- assessment

To see the evaluation of an alternative, we must select it and open the "Compare" tab. Many alternatives can be compared simultaneously by selecting them together (press and hold Ctrl). The imaginary three alternatives:


result in this comparison:


In the comparison view, we can observe the evaluations of the goal and all the other compound concepts. Each alternative is now given in a column. The values of input variables are in the blue cells and the corresponding evaluatins of the compound concepts are in grey cells. The values with highest probability are printed in bold to stand out of distributions.
We can see, that the alternatives differ with respect to their impact on the overall quality of water. The evaluations of middle-layer attributes help us in understanding the results and differences among the given alternatives.

- ranking

Profound comparison of alternatives is a demanding and time-consuming task, especially if we have to deal with a large number of them. When we do not have particular alternatives, but want to simulate a large number of situations, the alternatives generator helps us in efficiently defining a large number of alternatives. But as we can only profoundly analyse a couple of them, we need also tools to refine our search, usually to find best or worst possible options (and their features) in a given setting. proDEX offers some help in that by alternative ranking option.
The alternatives can be ranked (sorted) by pressing the "Sort selected" or "Sort all" button in the "AlternativesEditor" window. We can also select ranking method: by average distribution value or by probability of best/worst value. The "Sort selected" button triggers ranking of only the selected alternatives, whereas the "Sort all" ranks all the defined alternatives. Both show results in a new window:


In ranking results window, the alternatives values are shown, but the most important are the last two grey columns. One of them holds the goal evaluation of each alternative and the other the value of ranking criterion (this criterion also depends on model definition, in this example bigger is worse in contrast to the definiton of "water quality" values). The true value of the ranking tool is shown in cases of ranking tens or hundreds of alternatives, where we can easily see the best or worst few. Ranking tool is currently in experimental phase and will probably be further developed in the future, to facilitate selection of the defined percent of best or worst alternatives and to enable such a selection to control the contents of the table of alternatives in "AlternativesEditor".