rules 101 understanding production systems

23
Rules 101 Understanding Production Systems Charles Young Solidsoft Ltd, UK

Upload: others

Post on 25-Mar-2022

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rules 101 Understanding Production Systems

Rules 101 Understanding Production

Systems

Charles Young

Solidsoft Ltd, UK

Page 2: Rules 101 Understanding Production Systems

Production Systems

• Emil Post

– 'Canonical' System

• pattern-matching

• string-rewriting

• basis for BNF (Backus-Naur Form)

• Turing-complete

• Production rules

Page 3: Rules 101 Understanding Production Systems

Production Systems

• Extended Post system

– Facts, not just strings

– Assertion of new facts

– Retraction of existing facts

Page 4: Rules 101 Understanding Production Systems

Why Production Systems?

• Artificial Intelligence

– Knowledge-based processing

– Mimicking human cognitive processes

• What is knowledge?

– Expertise based on experience and understanding

– Justified beliefs

– Facts, truths, principles

Page 5: Rules 101 Understanding Production Systems

Why Production Systems?

• Just another Turing machine...

– Rules programming

– Declarative (?)

– Knowledge-based

– Logic programming (?)

– 'impure' model

Page 6: Rules 101 Understanding Production Systems

Why Production Systems?

• Commercial value?

– not in the engine...

– in the tooling that exploits the engine.

• Capture, analyse, verify and apply knowledge

• Align run-time logic to business view

• Separate and externalise declarative rules from procedural logic

• Deploy logic across distributed environments

Page 7: Rules 101 Understanding Production Systems

Why Production Systems?

• Expert systems

• Business rules processing

• Process automation

• Complex event processing

• Cognitive and learning systems

Page 8: Rules 101 Understanding Production Systems

Facts

• Relational tuples

– Collection of attribute values

– May be ordered or unordered

– May be triplets

• May map to non-relational data

– XML/Xpath

– OO / POJO / POCO

• Fact Identity

Page 9: Rules 101 Understanding Production Systems

Production Rules

• <conditions> <actions>

• IF/WHEN/WHERE <conjunction of logical expressions> THEN / DO <list of actions>

• Flexible

• Imprecise

Page 10: Rules 101 Understanding Production Systems

Production Systems

Knowledge

Facts Rules

Page 11: Rules 101 Understanding Production Systems

Knowledge

Facts Rules

Data Sources

Event Sensors

Systems & Applications

Production Systems

Page 12: Rules 101 Understanding Production Systems

Knowledge

Facts Rules

RulesRepository

Rule Composition, Verification

& Testing

Data Sources

Event Sensors

Systems & Applications

Production Systems

Page 13: Rules 101 Understanding Production Systems

Production Systems

Production System

Knowledge

Facts Rules

WorkingMemory

Pattern Matcher

Conflict Set

RulesRepository

[Match]

[Resolve]

[Act]

Rule Composition, Verification

& Testing

External Systems & Data

Data Sources

Event Sensors

Systems & Applications

Situated Reasoning Agent

Page 14: Rules 101 Understanding Production Systems

Matching

• Filter

– by type

– by attribute value

– by time (CEP)

• Aggregate

– Cartesian products

– joins

– quantification

Page 15: Rules 101 Understanding Production Systems

Matches and Activations

RulesRule ActivationsMatched FactsAvailable Facts1 11∞ ∞ ∞

Update Match Resolve and Act (declare)

assert, retract or modify

assert

Working Memory Rete Agenda

Page 16: Rules 101 Understanding Production Systems

Resolving

• Problem Spaces

– Search strategies

– MEA / LEX / Depth-First/ Breadth-First / Random

• Salience

Page 17: Rules 101 Understanding Production Systems

Agenda

Agenda

Rule Activations

Resolve

Act

1

23

‘firing’

new cycle

Systems

Page 18: Rules 101 Understanding Production Systems

Inference & Chaining

• Basic Inference

– May be possible in single step (rule)

– IF age < 18 THEN set status = minor

• Chained Inference

– Multiple, interim steps

– Enabled through recursive match-resolve-act

– Supports non-monotonic reasoning

Page 19: Rules 101 Understanding Production Systems

Forward & Backward Reasoning

• Forward Reasoning

– IF value > $1,000 THEN set discount = 10%

• Backward Reasoning

– IF GOAL = 10% discount THEN send order of value > $1,000

Page 20: Rules 101 Understanding Production Systems

Forward & Backward Chaining

• Chained Inference

– Forward & Backward reasoning

• Same Match-Resolve-Act cycle

• Sub-goaling

• Hybrid models

Page 21: Rules 101 Understanding Production Systems

The Rete Algorithm

• An algorithm for efficient pattern matching

– Dr. Charles Forgy

– Small, incremental changes between M-R-A cycles

– Eliminate redundancies

– Recalculate delta changes to conflict set

Page 22: Rules 101 Understanding Production Systems

The Rete Algorithm

Page 23: Rules 101 Understanding Production Systems

Other Issues

• Discrete vs. Continuous Execution

• Temporal Logic

• Truth Maintenance

• Justification

• Debugging and Tracing