Javalanche: An Avalanche Predictor

This article introduces a prototypical avalanche-predicting software package implemented with a Fuzzy Logic algorithm.
A Sample Calculation

To see how a Fuzzy Logic algorithm works, we'll make an example calculation. Of course, such calculations are done by the program, but hand calculations are essential for understanding and for debugging the program. The steps we'll go through are:

  1. Start with three crisp input values.

  2. Fuzzify those three values.

  3. Evaluate the appropriate rules from the 36 available, obtaining fuzzy outputs.

  4. Defuzzify the outputs to obtain a crisp output.

Let's say we have measured/estimated the three input variables to be Slope_Pitch = 17 degrees, Water_Equiv = 5 centimeters, and Current_Temp = 3 Celsius. These are the crisp values.

To fuzzify an input variable means finding its doms in all its fuzzy sets. Using Figure 2, we find that Slope_Pitch has these doms in its fuzzy sets:

  • Novice dom = 0.3

  • Intermediate dom = 0.7

  • Advanced dom = 0.0

  • Expert dom = 0.0

Similarly, from Figure 3, the Water_Equiv values are

  • Small dom = 0.0

  • Medium dom = 1.0

  • Big dom = 0.0

Last, from Figure 4, the Current_Temp values are:
  • Below_Freezing dom = 0.0

  • Near_Freezing dom = 0.5

  • Above_Freezing dom = 0.5

This completes the fuzzification process.

After fuzzification, the rules are evaluated. Not all the rules will apply in each instance. In particular, if any of the three inputs has a dom = 0.0, then that rule does not apply. From the preceding dom calculation we see that two fuzzy sets for Slope_Pitch, one fuzzy set for Water_Equiv, and two fuzzy sets for Current_Temp have nonzero dom values. Consequently, four ( = 2x1x2) rules apply; namely, the first two in the middle row of Figure 7 and the first two in the middle row of Figure 8.

We'll continue our sample calculation by evaluating only one of the four rules. Let's consider the rule that has a consequence of Moderate Avalanche_Danger, from Figure 7: “If Water_Equiv is Medium AND Slope_Pitch is Intermediate AND Current_Temp is Near_Freezing, then Avalanche_Danger is Moderate.”

To evaluate this rule, we combine the doms of the antecedent fuzzy sets by forming their product:

  • Slope_Pitch has Intermediate dom = 0.7

  • Water_Equiv has Medium dom = 1.0

  • Current_Temp has Near_Freezing dom = 0.5

The product = 0.35 is then assigned to the output, i.e., the Avalanche_Danger value has a dom of 0.35 in the Moderate fuzzy output set. Using the product of the doms to combine the fuzzy sets joined by the AND conjunction is called the “product AND”. Fuzzy Logic allows other choices (see Cox's book).

The other three rules which apply in our case must also be evaluated. We won't do those calculations here—they are quite similar to the evaluation of the first. Note that of the four rules that apply, two have a consequence of Moderate and two have a consequence of Low. We choose to combine the dom values for the Low fuzzy set by adding them together, thus allowing each rule that fires to have an effect. We do the same thing for the Moderate doms. This is often done in decision-making problems, but is not the only option possible (again, see Cox's book). Hence, we now have these dom values for Avalanche_Danger:

  • Low = 0.3

  • Moderate = 0.7

  • High = 0.0

  • Spontaneous = 0.0

These dom values are then “defuzzified”, as in Figure 5. After looking at the figure with these dom values, it seems reasonable to conclude that the resultant number will be between 10.0 and 20.0, and because the Moderate dom is stronger, it ought to be closer to 20.0 than to 10.0. In practice, we use a weighted average known as the “center of gravity”, and it yields 19.0 for this case. We won't do the detailed calculation here.

Thus, for our sample calculation, the input values of Slope_Pitch = 17 degrees, Water_Equiv = 5 centimeters, and Current_Temp = 3 have led to an output value of Avalanche_Danger = 19.0, a value mostly in the Moderate region, but with some membership in the Low region.

An Overview of the Software

The software is available via anonymous FTP from ftp://turing.sirti.org/pub/ras/fuz3.tar.gz. When unzipped and unarchived, it will produce a directory tree with fuz3 as the top node. The top node contains a README file, enabling a user to both use and modify the package. To execute the software, it is assumed that the user's machine has Java properly installed. We used JDK1.1.1.

In the lowest subdirectory, io_n_sets, three files contain the fundamental classes chosen for the model, as follows:

  • ioput.java contains a class for input and output variables.

  • fz_set.java contains a class for the fuzzy sets.

  • cond_rule contains a class for the conditional rules.

These classes contain no information specific to the avalanche prediction model.

The parent directory of io_n_sets is init_n_run which contains two source files of interest: make_init_file.java and run_eng.java. The first of these creates an initialization file, fz_init.dat, which is read by run_eng.java to initialize its Fuzzy Logic “engine”. Only make_init_file.java contains the model for the avalanche predictor. Hence, it may be modified to apply the software to other decision-making problems. As expected, after initializing itself, run_eng.java requests the input variable selection from the user, then runs the Fuzzy Logic engine and produces an output result.

The software can be executed from a terminal window in the X Window System environment by entering the command:

appletviewer run_eng.html
______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix