Detailed Design

Michael Wales - NeedMoreHP@yahoo.com
EEL 5874 - Expert Systems and Knowledge Engineering



Version History:
DocumentDateDescription
Detailed Design V1.0March 20, 2002Initial Document
Detailed Design V2.0April 17, 2002Knowledge Diagram updated to reflect final design


Table of Contents


Overall design of system

The system consists of two separate applications that talk to one another over a TCP/IP socket. Both applications are console based Java applications, but the ComputerAdvice application could possibly be changed to a web-based Java applet or a Java Swing based GUI. JESS is purely text based and is only meant to run in the background.

ComputerAdvice:

Computer advice is the application that should be started first. The first thing it does, is open a server socket connection for JESS to connect to. When it finally gets a connection from JESS, it sets up the input and output streams to JESS, and goes into a loop that consists of the following:

  1. Wait for JESS to send a command.
  2. Analyze the command, and decide what part of the ComputerAdvice application needs to process the command.
  3. Process the command.
  4. Decide whether to continue to read commands from JESS (did JESS say to quit)
  5. Go back to #1

A large portion of ComputerAdvice is the HardwareCosts class. This class is responsible for developing a list of hardware for JESS to purchase, taking purchase requests from JESS, and keeping track of what JESS has ordered already. This application in the final design will probably gather the hardware cost information from a flat file. This class could be created to gather the information from a database, but that isn't necessary.

JESS:

JESS runs a script file (computer.clp) that establishes all the rules for the application, and asserts the startup fact. The script also tells JESS to open a socket (a built in feature for JESS) to ComputerAdvice. As the rules fire, they will send messages back and forth between JESS and ComputerAdvice. Here is the basic order of how the script is processed:

  1. Startup rule fires, this rule asks the user (through the socket connection to ComputerAdvice) what their needs of the computer system are. For every yes reply by the user, JESS will assert a corresponding fact. Last, the startup rule asserts a very low priority rule to ask the user about their budget.
  2. Each rule asserted by the startup rule, about the user's systems needs is a higher priority than the budget rule. They all fire, and assert facts about what kind of specific hardware components should be purchased.
  3. There are 2 rules that eliminate redundant rules that may also fire at this time. If there was a rule that the CPU should be max, and a rule that the CPU should be med, it would eliminate the med rule since the CPU has to be max anyway.
  4. There will probably be some rules that compress multiple hardware components into a single hardware component. For instance, if the user wants a video capture card and a nice graphics card, the user can save money by purchasing an ATI All-In-Wonder Radeon 8500 because it incorporates both pieces of hardware. Any rules of this nature would now fire.
  5. The next rule to fire is the one that asks the user how much money they want to spend on their new system.
  6. The next rules to fire are for purchasing the standard hardware. Right before any hardware is purchased, the amount of money JESS has to spend is stored in a variable. After this rule fires, the next rules will fire in a loop. That loop will terminate when nothing is purchased (the amount of money to spend stays the same) for the entire loop.
  7. The hardware labeled max is purchased. This is the first purchasing state of the purchase loop.
  8. The hardware labeled med is purchased. This is the second purchasing state of the purchase loop.
  9. The hardware labeled max is purchased. This is the third purchasing state of the purchase loop. This state allows the max hardware to be upgraded twice as fast as the med hardware is.
  10. The next rule to fire determines if the loop should occur again. If money was spent on the last loop, the amount of money left is stored in the same temporary variable, and the loop is restarted. If no money was spent, you quit the loop.
  11. This is the rule that fires when the loop is quit. This rule tells ComputerAdvice to print out the info of the system that JESS has purchased. It then tells ComputerAdvice that JESS is now finished, that the socket should be closed, and that the ComputerAdvice application should be exited.


Network protocol for the system

JESS controls the network. ComputerAdvice simply does what JESS tells it to do. Here is a list of the commands sent to ComputerAdvice. When ComputerAdvice starts, it waits and listens for JESS to connect to it on port number 8034.

Command NameDescription
JESS-FINISHEDThis tells ComputerAdvice that JESS has finished execution and will no longer be sending anything else to ComputerAdvice. When ComputerAdvice gets this message, it closes the socket connection and exits back to the DOS prompt.
JESS-HWCDBThis tells ComputerAdvice that JESS wants to purchase a new piece of hardware. The command also passes parameters. Here is the format of the entire message: JESS-HWCDB:Item:Money The Item is the one word description of the item to be purchased. The money is the amount of money the user has left over for the system. ComputerAdvice upgrades the user to the next piece of hardware (if they can afford it), and deducts the amount of the item, and then sends the new amount of money they have left back to JESS over the socket.
JESS-PRINT_SYSTEM_INFOThis tells ComputerAdvice to print out the list of the hardware purchased by JESS, and what the total amount of system will come to. ComputerAdvice keeps track of what JESS has purchased so far, so ComputerAdvice can print out the entire list with nothing more required of JESS.
JESS-PROMPT_USERThis tells ComputerAdvice to ask the user a question, and to send back what the user inputted.


Difference between production version and prototype

The initial prototype turned out very well for this project. It took many revisions to get a working prototype, so the final version worked pretty well. So I will not need to perform a paradigm shift or throw away the initial prototype. The initial prototype will be simple expanded on to include more computer system uses.

The HardwareCosts class in ComputerAdvice will be modified to read the information out of a flat text file. Right now it simply has a dumb algorithm for the hardware costs, but in the final version it will be a more real world portrayal of hardware costs.

For the final production system, the knowledge will be documented in the computer.clp file, and in an HTML document as tables.


Knowledge Diagram of Final System: