JUDCon India 2012 Drools Expert

Embed Size (px)

Citation preview

The SkyNet funding bill is passed.

The system goes online on August 4th, 1997.

Human decisions are removed from strategic defense.

SkyNet begins to learn at a geometric rate.

It becomes self-aware at 2:14am Eastern time, August 29th

In a panic, they try to pull the plug.

And, Skynet fights back

Mark ProctorProject Lead

Wumpus World

Wumpus World

Wumpus World

Cell

int row

Int col

Hero

int row

Int col

Wumpus

int row

Int col

Pitt

int row

Int col

Gold

int row

Int col

Wumpus World

Wumpus World

Wumpus World

demonstration

Drools Books

Sample Industries and Users

Investment

Millennium Investment Group (MIG)

Logistics

Fedex

Airline

Sabre

Mortgage

Franklin American

Healthcare

OSDE

Boot Camps

San Francisco 2009 (40+ attendees)

Sponsored by Third Pillar

Sun, FAMC, OSDE, Kaseya, Fedex, TU Group, Intermountain Healthcare, Gap, Sony Pictures, Lockheed Martin, Kaiser, HP, Wells Fargo, US Navy Research, FOLIOfn, Boeing .....

San Diego 2010 (80+ attendess)

Sponsored by US Navy

5 day event, with 2 days focus on the healthcare industry

OSDE, AT&T, SAIC, US Navy Research, Kaiser, Clinica, Intermountain Healthcare, GE Healthcare, VA, Boeing, Nationwide ....

Integrated Systems

Semantic
OntologiesRulesEventProcessesWorkflowsRules Workflows

EventProcesses

Semantic
Ontologies

Rules and processes

loosely coupledtightly coupledspecificgenericDecisionServicesProcessRulesSCOPECOUPLING?

Integrated Systems

Drools
Grid

Drools
Planner

Drools
Semantics

Drools
Chance Business Logic integration System

Drools
Guvnor

Drools
Fusion

JBPM5(Drools Flow)

Drools
Expert

Declarative Programming

Production Rule Systems PRD (forward chaining)

Reactive

when Alarm( status == alert )
then send( warning )

Logic Programming LP (backward chaining)

Query

descendant( mary, jane)

Functional Programming FP

Map,Fold, Filter

avg([12, 16, 4, 6])Returns single value 9.5

round([10.3, 4.7, 7.8] )Returns List [10, 5, 8]

Description Logic

Person Has Name and
LivesAt Address

Classes

rule increase balance for AccountPeriod Credits when ap : AccountPeriod() acc : Account( $accountNo : accountNo ) CashFlow( type == CREDIT, accountNo == $accountNo, date >= ap.start && = ap.start and cf.date = ap.start && = ap.start && Everything is ok

Executing

Fire kitchenFire = new Fire( name2room.get( "kitchen" ) );Fire officeFire = new Fire( name2room.get( "office" ) );

FactHandle kitchenFireHandle = ksession.insert( kitchenFire );FactHandle officeFireHandle = ksession.insert( officeFire );

ksession.fireAllRules();

> Raise the alarm> Turn on the sprinkler for room kitchen> Turn on the sprinkler for room office

Executing

ksession.retract( kitchenFireHandle );ksession.retract( officeFireHandle );

ksession.fireAllRules()

> Turn off the sprinkler for room office> Turn off the sprinkler for room kitchen> Cancel the alarm> Everything is ok

rule "Status output when things are ok" when not Alarm() not Sprinkler( on == true ) then println( "Everything is ok" );end

not Bus( color = red )

Conditional Elements

exists Bus( color = red )

forall ( $bus : Bus( floors == 2 ) Bus( this == $bus, color == red ) )

forall ( $bus : Bus( color == red ) )

Accumulate CE

rule "accumulate"when $sum : Number( intValue > 100 ) from accumulate( Bus( color == "red", $t : takings ) sum( $t ) )then print "sum is + $sum;end

Decision Table

Decision Table

rule "Pricing bracket_10"

when Driver(age >= 18, age = 16 )then insert(new AdultBusPass( $p ) );end

Couples the logicWhat happens when the Child stops being 16?

TMS and Inference

Bad

Monolithic

Leaky

Brittle integrity - manual maintenance

TMS and Inference

A rule logically inserts an object

When the rule is no longer true, the object is retracted.

when $p : Person( age < 16 )then logicalInsert( new IsChild( $p ) )endwhen $p : Person( age >= 16 )then logicalInsert( new IsAdult( $p ) )end

de-couples the logicMaintains the truth by
automatically retracting

TMS and Inference

rule "Issue Child Bus Pass"when $p : Person( ) IsChild( person =$p )then logicalInsert(new ChildBusPass( $p ) );endrule "Issue Adult Bus Pass"when $p : Person( age >= 16 ) IsAdult( person =$p )then logicalInsert(new AdultBusPass( $p ) );end

The truth maintenance cascades

TMS and Inference

rule "Issue Child Bus Pass"when $p : Person( ) not( ChildBusPass( person == $p ) )then requestChildBusPass( $p );end

The truth maintenance cascades

TMS and Inference

Good

De-couple knowledge responsibilities

Encapsulate knowledge

Provide semantic abstractions for those encapsulation

Integrity robustness truth maintenance

Questions?

Questions?

Dave Bowman: All right, HAL; I'll go in through the emergency airlock.

HAL: Without your space helmet, Dave, you're going to find that rather difficult.

Dave Bowman: HAL, I won't argue with you anymore! Open the doors!

HAL: Dave, this conversation can serve no purpose anymore. Goodbye.

Joshua: Greetings, Professor Falken.Stephen Falken: Hello, Joshua.Joshua: A strange game. The only winning move is not to play. How about a nice game of chess?

CashFlow

dateamounttypeaccountNo

12-Jan-07100CREDIT1

2-Feb-07200DEBIT1

18-May-0750CREDIT1

9-Mar-0775CREDIT1

???Page ??? (???)04/05/2011, 12:38:29Page / CashFlow

dateamounttype

12-Jan-07100CREDIT

9-Mar-0775CREDIT

???Page ??? (???)04/05/2011, 12:38:29Page / CashFlow

dateamounttype

2-Feb-07200DEBIT

???Page ??? (???)04/05/2011, 12:38:29Page /

Click to edit the title text format

Click to edit the outline text format

Click to edit the title text format

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level

This is the title
Second line of the title

Click to edit the outline text formatSecond Outline LevelThird Outline LevelFourth Outline LevelFifth Outline LevelSixth Outline LevelSeventh Outline LevelEighth Outline LevelNinth Outline Level

Click to edit the title text format

Click to edit the text format

AccountingPeriod

startend

01-Jan-0731-Mar-07

???Page ??? (???)04/05/2011, 12:38:30Page / Account

accountNobalance

10

???Page ??? (???)04/05/2011, 12:38:30Page / Account

accountNobalance

1-25

???Page ??? (???)04/05/2011, 12:38:30Page /