| Samples > Rule-Based Programming > How to Measure Execution Performance with Academic Benchmarks |
How to Measure Execution Performance with Academic Benchmarks |
PREVIOUS NEXT |
This sample contains the implementation of the following academic benchmarks:
The sample also shows how to tune the performance of the rule engine in RetePlus mode using some of the optimization techniques provided with ILOG JRules.
Key features include:
To import the academic sample:
samples > engine > academic sample.
If one or more files already exist in your workspace, a warning message is displayed indicating that the corresponding file(s) were not re-imported.
The imported sample project files are displayed in the Rule Explorer.
Make sure you are in the Rule perspective before running this sample.
To run the benchmark sample projects:
PuzzleBenchmark: This runs the Puzzle benchmark, showing results without optimizations and results with the useJIT optimization.
TournBenchmark: This runs the Tourney benchmark, showing results without optimizations and results with hashers and the useJIT optimizations.
WordBenchmark: This runs the Word benchmark, showing results without optimizations and results with hashers and the useJIT optimizations.
MannerBenchmark: This runs the Manners benchmark, showing results without optimizations and results with several optimizations (including useJIT, hashers, static agenda and iterated rules) for 16, 32, 64, 128 and 256 guests.
WaltzBenchmark: This runs the Waltz benchmark, showing results without optimizations and results with several optimizations (including useJIT, hashers, static agenda and iterated rules) for half-sized and full-sized problem.
JIT optimization are already done). Each run is divided into several phases:
By default, the only statistic displayed is the average rules fired per second. To get more information, you can uncomment a line at the end of the BenchmarkRunner class.
This sample allows you to assess the impact of different optimization techniques on performance. You can compare execution times between the raw version and the optimized version of different sets of rules.
A shared project, called benchmark, contains the benchmark infrastructure:
Benchmark interface that is implemented by the actual benchmarks. This interface describes the contract of a rule-based benchmark. It contains a name, a description, a method to configure a benchmark object from a map of properties, the ruleset key (or path), the contents of the working memory at the beginning of execution, the map of input ruleset parameters, and a test method to check that the output ruleset parameters and number of rules fired are as expected.
BenchmarkSequence interface and the EngineSequence implementation. This interface describes the execution sequence of a rule-based benchmark. It contains methods for each benchmark phase, preparation, working memory declaration, checking of input data against ruleset signature, execution, reset.
BenchmarkRunner that orchestrates a Benchmark and a BenchmarkSequence together. This will typically resemble the following pseudo code:
Each benchmark is provided as a set of related projects, as shown below (where xxx is the name of the benchmark in question):
xxx-benchmark is the implementation for the benchmark, responsible primarily for providing the ruleset path and the input data. This project also provides the launch configuration to start the execution.
xxx-xom contains the classes for the objects manipulated by the rules.
xxx-rules contains the rules without optimization.
xxx-optim-rules contains either the same rules rewritten with optimizations or some optimization on top of the xxx-rules project
The puzzle consists in finding a digit for a letter to meet the following addition:
GERALD: 197485 + DONALD: 526485 ---------------- = ROBERT: 723970
The solution found by JRules is printed next to the letters.
In a simple approach to this problem, there are 10 digits and 10 different letters, so there are 100 different letter-digit combinations. The rules choose 10 combinations among those 100 such that the formula holds. This program tests how a rule engine handles combinatory problems.
This program deals with the scheduling of a bridge tournament. There are 16 people who are playing bridge over 5 nights. Each player must play with another player exactly once over the five nights.
Intuitively, for a specific player, the 15 other people can be divided into 5 groups of 3, each group of 3 forming a table with the player for one night. There are many solutions, but the rules are written so that only one solution can be found. This program uses rule chaining and builds long-chain conditions.
This program generates 4 letter words according to a set of rules. Some sequences of letters are allowed, and others are not. The rules are simple, but the number of objects matching a condition can be high.
This program handles the problem of seat assignments for guests at a dinner. It places the people having at least 2 common hobbies next to each other, while keeping people of the opposite sex alternated.
This program uses a data file as input. This file may contain 16, 32, 64, 128 or more guests. The data files are in the data directory.
This program is presented with a collection of lines such as might be found by an edge detector in a computer vision system. It applies a set of constraints to the lines and creates labels for them. The labels indicate how the lines correspond to edges in a three-dimensional space. This process is known as Waltz labeling.
The rule conditions in this program are more complex than the conditions used in Manner.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |