To jest stara wersja strony!
Opis
Spotkania
20090402
kategoryzacja przykładów, opis, ile reguł, atr, etc, czego dotyczą
20090326
20090319
20090312
20090225
Zapoznanie z działaniem Drools.
Projekt
1. Przykłady systemów ekspertowych w Drools
Zastosowanie w zarządzaniu
www.ibm.com/developerworks/java/library/j-drools
The problem to solve
An XYZ computer can serve multiple functions. Four functions are currently defined: DDNS Server,
DNS Server, Gateway, and Router.
The tests performed on each machine depend on each machine's type and functions. Currently, five tests are defined: Test1, Test2, Test3, Test4, and Test5.
XYZ has automated much of the process for executing the tests using an internally developed software application that can determine a machine's type and functions. Then, based on these properties, the application determines which tests to execute and their due date.
Własności
10 reguł
5 jedno-atrybutowych
5 dwu-atrybutowych
rule "Tests for type1 machine"
salience 100
when
machine : Machine( type == "Type1" )
then
Test test1 = testDAO.findByKey(Test.TEST1);
Test test2 = testDAO.findByKey(Test.TEST2);
Test test5 = testDAO.findByKey(Test.TEST5);
machine.getTests().add(test1);
machine.getTests().add(test2);
machine.getTests().add(test5);
insert( test1 );
insert( test2 );
insert( test5 );
end
rule "Tests for type2, DNS server machine"
salience 100
when
machine : Machine( type == "Type2", functions contains "DNS Server")
then
Test test5 = testDAO.findByKey(Test.TEST5);
Test test4 = testDAO.findByKey(Test.TEST4);
machine.getTests().add(test5);
machine.getTests().add(test4);
insert( test4 );
insert( test5 );
end
rule "Tests for type2, DDNS server machine"
salience 100
when
machine : Machine( type == "Type2", functions contains "DDNS Server")
then
Test test2 = testDAO.findByKey(Test.TEST2);
Test test3 = testDAO.findByKey(Test.TEST3);
machine.getTests().add(test2);
machine.getTests().add(test3);
insert( test2 );
insert( test3 );
end
rule "Tests for type2, Gateway machine"
salience 100
when
machine : Machine( type == "Type2", functions contains "Gateway")
then
Test test3 = testDAO.findByKey(Test.TEST3);
Test test4 = testDAO.findByKey(Test.TEST4);
machine.getTests().add(test3);
machine.getTests().add(test4);
insert( test3 );
insert( test4 );
end
rule "Tests for type2, Router machine"
salience 100
when
machine : Machine( type == "Type2", functions contains "Router")
then
Test test3 = testDAO.findByKey(Test.TEST3);
Test test1 = testDAO.findByKey(Test.TEST1);
machine.getTests().add(test3);
machine.getTests().add(test1);
insert( test1 );
insert( test3 );
end
rule "Due date for Test 5"
salience 50
when
machine : Machine()
Test( id == Test.TEST5 )
then
setTestsDueTime(machine, 14);
end
rule "Due date for Test 4"
salience 40
when
machine : Machine()
Test( id == Test.TEST4 )
then
setTestsDueTime(machine, 12);
end
rule "Due date for Test 3"
salience 30
when
machine : Machine()
Test( id == Test.TEST3 )
then
setTestsDueTime(machine, 10);
end
rule "Due date for Test 2"
salience 20
when
machine : Machine()
Test( id == Test.TEST2 )
then
setTestsDueTime(machine, 7);
end
Rule "Due date for Test 1"
salience 10
when
machine : Machine()
Test( id == Test.TEST1 )
then
setTestsDueTime(machine, 3);
end
Przykład systemu dla firmy
Przykład systemu dla firmy
Własności
8 reguł
1 jedno-atrybutowa
5 dwu-atrybutowych
2 trój-atrybutowe
rule "Age verification"
when
Borrower(age < 18)
$loanApp : LoanApplication()
then
$loanApp.addFeedbackMessage(FeedbackMessages.MIN_AGE);
end
rule "Credit score"
when
Borrower(creditScore <= 600)
$loanApp : LoanApplication()
then
$loanApp.addFeedbackMessage(FeedbackMessages.MIN_CREDIT_SCORE);
end
rule "Loan Amount limits"
when
$loanApp : (LoanApplication(loanAmount <= 100000.0) or
LoanApplication(loanAmount >= 400000.0))
then
$loanApp.addFeedbackMessage(FeedbackMessages.LOAN_AMOUNT_LIMITS);
end
rule "Maximum Loan-to-value ratio"
when
$loanApp : LoanApplication(loanToValueRatio > 80.0)
then
$loanApp.addFeedbackMessage(FeedbackMessages.LTV);
end
rule "Income multiples"
salience -3
when
Borrower( $grossIncome : grossIncome )
Property( value > (new Double($grossIncome.doubleValue()*3)))
$loanApp : LoanApplication()
then
$loanApp.setAffordabilityFlag(Flag.NOT_AFFORDABLE);
end
rule "Affordability Model"
salience -4
when
Borrower( $affordableLoanAmount : affordableLoanAmount )
Property( value > (new Double($affordableLoanAmount.doubleValue())))
$loanApp : LoanApplication()
then
$loanApp.setAffordabilityFlag(Flag.NOT_AFFORDABLE);
end
rule "Property type"
when
Property(purpose != Flag.OWNER_OCCUPIED)
$loanApp : LoanApplication()
then
$loanApp.addFeedbackMessage(FeedbackMessages.PROP_TYPE);
end
rule "Property age"
when
Property(yearBuilt < 1965)
$loanApp : LoanApplication()
then
$loanApp.addFeedbackMessage(FeedbackMessages.PROP_YEAR_BUILT);
end
Przykład reguł biznesowych
Bilety
Sprawozdanie
Prezentacja
Materiały