| Applying science to business management |
  
Building an AHP Script
In the Tree Window, highlight the root node. This will display
the root nodes
formula in the Definition Window. To build an AHP script, only a
single basic formula is required.
Root:={
var ahp=new AHP("Table");
ahp.run();
}
This formula calls a function named AHP, which is defined in
the library file AHPlib.dsb. You can find this file in the
DecisionScript program directory. Experienced users may want to
modify the library file to suit a specific purpose. However, the
script will run correctly as is. To include this library file (or
any other library file) in your script, click Script Options in
the Tools menu, choose Include library files, and
enter the library file name.
The statement
var ahp=new AHP("Table");
creates an AHP object by passing the name of the table that
contains the input information to the AHP constructor.
The statement
ahp.run();
calls the run method of the AHP object.
Note: If you have never programmed using
JavaScript or any other object-oriented programming language, you
may be confused right now. The concepts you need to know to build
object-oriented programs using JavaScript are actually quite
simple; but they are not presented here. Refer to the DScript
Language Guide for detailed information about using
DecisionScript's object-oriented programming features.
All that is required to build the AHP script is a single node
definition for Root as presented above, and the input data
table. All of the more complex components of this script are in
the library file.
When you run the script, it asks the user to rate the relative
importance of all of the phone features.
After the user has answered each question, the script displays
a sorted table containing each phone and its feature list. The
user can re-sort the list by any feature simply by clicking on
the appropriate heading.
The AHP script found in the Examples directory is a
little more complex than presented here in that it sets
additional properties in the AHP object. These additions should
be easy to understand when you look at the example.
|