A production system (or production rule system) is a
computer program
A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
typically used to provide some form of
artificial intelligence
Artificial intelligence (AI) is the capability of computer, computational systems to perform tasks typically associated with human intelligence, such as learning, reasoning, problem-solving, perception, and decision-making. It is a field of re ...
, which consists primarily of a set of rules about behavior, but also includes the mechanism necessary to follow those rules as the system responds to states of the world. Those rules, termed productions, are a basic
knowledge representation
Knowledge representation (KR) aims to model information in a structured manner to formally represent it as knowledge in knowledge-based systems whereas knowledge representation and reasoning (KRR, KR&R, or KR²) also aims to understand, reason, and ...
found useful in
automated planning and scheduling
Automated planning and scheduling, sometimes denoted as simply AI planning, is a branch of artificial intelligence that concerns the realization of strategies or action sequences, typically for execution by intelligent agents, autonomous robots ...
,
expert systems
In artificial intelligence (AI), an expert system is a computer system emulating the decision-making ability of a human expert.
Expert systems are designed to solve complex problems by Automated reasoning system, reasoning through bodies of knowl ...
, and
action selection
Action selection is a way of characterizing the most basic problem of intelligent systems: what to do next. In artificial intelligence and computational cognitive science, "the action selection problem" is typically associated with intelligent ...
.
Productions consist of two parts: a sensory precondition (or "IF" statement) and an action ("THEN"). If a production's precondition matches the current
state
State most commonly refers to:
* State (polity), a centralized political organization that regulates law and society within a territory
**Sovereign state, a sovereign polity in international law, commonly referred to as a country
**Nation state, a ...
of the world, then the production is said to be ''triggered''. If a production's action is
executed
Capital punishment, also known as the death penalty and formerly called judicial homicide, is the state-sanctioned killing of a person as punishment for actual or supposed misconduct. The sentence (law), sentence ordering that an offender b ...
, it has ''fired''. A production system also contains a database, sometimes called
working memory
Working memory is a cognitive system with a limited capacity that can Memory, hold information temporarily. It is important for reasoning and the guidance of decision-making and behavior. Working memory is often used synonymously with short-term m ...
, which maintains data about the current state or knowledge, and a rule interpreter. The rule interpreter must provide a mechanism for prioritizing productions when more than one is triggered.
Basic operation
Rule interpreters generally execute a
forward chaining
Forward chaining (or forward reasoning) is one of the two main methods of reasoning when using an inference engine and can be described logically as repeated application of ''modus ponens''. Forward chaining is a popular implementation strategy f ...
algorithm for selecting productions to execute to meet current goals, which can include updating the system's data or
beliefs
A belief is a subjective Attitude (psychology), attitude that something is truth, true or a State of affairs (philosophy), state of affairs is the case. A subjective attitude is a mental state of having some Life stance, stance, take, or opinion ...
. The condition portion of each rule (''left-hand side'' or LHS) is tested against the current state of the working memory.
In idealized or data-oriented production systems, there is an assumption that any triggered conditions should be executed: the consequent actions (''right-hand side'' or RHS) will update the agent's knowledge, removing or adding data to the working memory. The system stops processing either when the user interrupts the forward chaining loop; when a given number of cycles have been performed; when a "halt" RHS is executed, or when no rules have LHSs that are true.
Real-time and expert systems, in contrast, often have to choose between mutually exclusive productions—since actions take time, only one action can be taken, or (in the case of an expert system) recommended. In such systems, the rule interpreter, or
inference engine
In the field of artificial intelligence, an inference engine is a software component of an intelligent system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems ...
, cycles through two steps: matching production rules against the database, followed by selecting which of the matched rules to apply and executing the selected actions.
Matching production rules against working memory
Production systems may vary on the
expressive power of conditions in production rules. Accordingly, the
pattern matching
In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually must be exact: "either it will or will not be a ...
algorithm that collects production rules with matched conditions may range from the naive—trying all rules in sequence, stopping at the first match—to the optimized, in which rules are "compiled" into a network of inter-related conditions.
The latter is illustrated by the
Rete algorithm
The Rete algorithm ( , , rarely , ) is a pattern matching algorithm for implementing rule-based systems. The algorithm was developed to efficiently apply many rules or patterns to many objects, or facts, in a knowledge base. It is used to dete ...
, designed by
Charles L. Forgy in1974, which is used in a series of production systems, called OPS and originally developed at
Carnegie Mellon University
Carnegie Mellon University (CMU) is a private research university in Pittsburgh, Pennsylvania, United States. The institution was established in 1900 by Andrew Carnegie as the Carnegie Technical Schools. In 1912, it became the Carnegie Institu ...
culminating in
OPS5
OPS5 is a rule-based or production system computer language, notable as the first such language to be used in a successful expert system, the R1/XCON system used to configure VAX computers.
The OPS (said to be short for "Official Production Sys ...
in the early 1980s. OPS5 may be viewed as a full-fledged programming language for production system programming.
Choosing which rules to evaluate
Production systems may also differ in the final selection of production rules to execute, or ''fire''. The collection of rules resulting from the previous matching algorithm is called the ''conflict set '', and the selection process is also called a ''
conflict resolution strategy
Conflict resolution strategies are used in production systems in artificial intelligence, such as in rule-based expert systems, to help in choosing which production rule to fire. The need for such a strategy arises when the conditions of two or ...
''.
Here again, such strategies may vary from the simple—use the order in which production rules were written; assign weights or priorities to production rules and sort the conflict set accordingly—to the complex—sort the conflict set according to the times at which production rules were previously fired; or according to the extent of the modifications induced by their RHSs. Whichever conflict resolution strategy is implemented, the method is indeed crucial to the efficiency and correctness of the production system. Some systems simply fire all matching productions.
Using production systems
The use of production systems varies from simple
string
String or strings may refer to:
*String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects
Arts, entertainment, and media Films
* ''Strings'' (1991 film), a Canadian anim ...
rewriting
In mathematics, computer science, and logic, rewriting covers a wide range of methods of replacing subterms of a formula with other terms. Such methods may be achieved by rewriting systems (also known as rewrite systems, rewrite engines, or reduc ...
rules to the modeling of human cognitive processes, from term rewriting and reduction systems to
expert system
In artificial intelligence (AI), an expert system is a computer system emulating the decision-making ability of a human expert.
Expert systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as ...
s.
A simple string rewriting production system example
This example shows a set of production rules for reversing a string from an alphabet that does not contain the symbols "$" and "*" (which are used as marker symbols).
P1: $$ -> *
P2: *$ -> *
P3: *x -> x*
P4: * -> null & halt
P5: $xy -> y$x
P6: null -> $
In this example, production rules are chosen for testing according to their order in this production list. For each rule, the input string is examined from left to right with a moving window to find a match with the LHS of the production rule. When a match is found, the matched substring in the input string is replaced with the RHS of the production rule. In this production system, x and y are ''variables '' matching any character of the input string alphabet. Matching resumes with P1 once the replacement has been made.
The string "ABC", for instance, undergoes the following sequence of transformations under these production rules:
$ABC (P6)
B$AC (P5)
BC$A (P5)
$BC$A (P6)
C$B$A (P5)
$C$B$A (P6)
$$C$B$A (P6)
*C$B$A (P1)
C*$B$A (P3)
C*B$A (P2)
CB*$A (P3)
CB*A (P2)
CBA* (P3)
CBA (P4)
In such a simple system, the ordering of the production rules is crucial. Often, the lack of control structure makes production systems difficult to design. It is, of course, possible to add control structure to the production systems model, namely in the inference engine, or in the working memory.
An OPS5 production rule example
In a toy simulation world where a monkey in a room can grab different objects and climb on others, an example production rule to grab an object suspended from the ceiling would look like:
(p Holds::Object-Ceiling
-(physical-object ^on <O1>)
-->
(write (crlf) Grab <O1> (crlf))
(modify <object1> ^on NIL)
(modify <monkey> ^holds <O1>)
(modify <goal> ^status satisfied)
)
In this example, data in working memory is structured and variables appear between angle brackets. The name of the data structure, such as "goal" and "physical-object", is the first literal in conditions; the fields of a structure are prefixed with "^". The "-" indicates a negative condition.
Production rules in OPS5 apply to all instances of data structures that match conditions and conform to variable bindings. In this example, should several objects be suspended from the ceiling, each with a different ladder nearby supporting an empty-handed monkey, the conflict set would contain as many production rule instances derived from the same production "Holds::Object-Ceiling". The conflict resolution step would later select which production instances to fire.
The binding of variables resulting from the pattern matching in the LHS is used in the RHS to refer to the data to be modified. The working memory contains explicit control structure data in the form of "goal" data structure instances. In the example, once a monkey holds the suspended object, the status of the goal is set to "satisfied" and the same production rule can no longer apply as its first condition fails.
Relationship with logic
Both
Russell and
Norvig's ''
Artificial Intelligence: A Modern Approach'' and
John Sowa's ''Knowledge Representation: Logical, Philosophical, and Computational Foundations'' characterize production systems as systems of
logic
Logic is the study of correct reasoning. It includes both formal and informal logic. Formal logic is the study of deductively valid inferences or logical truths. It examines how conclusions follow from premises based on the structure o ...
that perform reasoning by means of forward chaining. However,
Stewart Shapiro
Stewart Shapiro (; born 1951) was O'Donnell Professor of Philosophy at the Ohio State University until his retirement, and is also distinguished visiting professor at the University of Connecticut. He is a leading figure in the philosophy of mat ...
, reviewing Sowa's book, argues that this is a misrepresentation. Similarly,
Kowalski
Kowalski (; feminine: Kowalska, plural: Kowalscy) is the second most common surname in Poland (140,471 people in 2009). ''Kowalski'' surname is derived from the word ''kowal'', meaning " lackmith".
" Jan Kowalski" is used as a placeholder name ...
and Sadri argue that, because actions in production systems are understood as imperatives, production systems do not have a logical semantics. Their logic and computer language Logic Production System
(LPS) combines logic programs, interpreted as an agent's beliefs, with reactive rules, interpreted as an agent's goals. They argue that reactive rules in LPS give a logical semantics to production rules, which they otherwise lack. In the following example, lines 1-3 are type declarations, 4 describes the initial state, 5 is a reactive rule, 6-7 are logic program clauses, and 8 is a causal law:
1. fluents fire.
2. actions eliminate, escape.
3. events deal_with_fire.
4. initially fire.
5. if fire then deal_with_fire.
6. deal_with_fire if eliminate.
7. deal_with_fire if escape.
8. eliminate terminates fire.
Notice in this example that the reactive rule on line 5 is triggered, just like a production rule, but this time its conclusion deal_with_fire becomes a goal to be reduced to sub-goals using the logic programs on lines 6-7. These subgoals are actions (line 2), at least one of which needs to be executed to satisfy the goal.
Related systems
*
Constraint Handling Rules
Constraint Handling Rules (CHR) is a declarative, rule-based programming language, introduced in 1991 by Thom Frühwirth at the time with European Computer-Industry Research Centre (ECRC) in Munich, Germany.Thom Frühwirth. ''Theory and Practice ...
: rule-based programming language.
*
CLIPS
CLIPS (C Language Integrated Production System) is a public-domain software tool for building expert systems. The syntax and name were inspired by Charles Forgy's OPS5. The first versions of CLIPS were developed starting in 1985 at the NASA Joh ...
: public domain software tool for building expert systems.
*
JBoss Drools: an open-source business rule management system (BRMS).
*
ILOG rules
ILOG S.A. was an international software company purchased and incorporated into IBM announced in January, 2009. It created enterprise software products for supply chain, business rule management, visualization and optimization. The main product ...
: a business rule management system.
*
JESS
Jess is a unisex given name, often a short form (hypocorism) of Jessica, Jesse, Jessie, Jessy, Jesswin and a surname. It may refer to:
Given name
* Jess Atkinson (born 1961), American football player
* Jess Cain (1926–2008), American radi ...
: a rule engine for the Java platform - it is a superset of the
CLIPS
CLIPS (C Language Integrated Production System) is a public-domain software tool for building expert systems. The syntax and name were inspired by Charles Forgy's OPS5. The first versions of CLIPS were developed starting in 1985 at the NASA Joh ...
programming language.
*
Lisa
Lisa or LISA may refer to:
People
People with the mononym
* Lisa (Japanese musician, born 1974), stylized "LISA"
* Lisa, stagename of Japanese singer Lisa Komine (born 1978)
* Lisa (South Korean singer) (born 1980)
* Lisa (Japanese musician, b ...
: a rule engine written in Common Lisp.
*
OpenL Tablets: business centric rules and open source BRMS.
*
Prolog
Prolog is a logic programming language that has its origins in artificial intelligence, automated theorem proving, and computational linguistics.
Prolog has its roots in first-order logic, a formal logic. Unlike many other programming language ...
: a general purpose logic programming language.
*
ACT-R
ACT-R (pronounced /ˌækt ˈɑr/; short for "Adaptive Control of Thought—Rational") is a cognitive architecture mainly developed by John Robert Anderson and Christian Lebiere at Carnegie Mellon University. Like any cognitive architecture, ACT ...
,
Soar,
OpenCog
OpenCog is a project that aims to build an open source artificial intelligence framework. OpenCog Prime is an architecture for robot and virtual embodied cognition that defines a set of interacting components designed to give rise to human-equiva ...
: cognitive architectures based on a production system.
References
* Brownston, L., Farrell R., Kant E. (1985). ''Programming Expert Systems in OPS5'' Reading, Massachusetts: Addison-Wesley.
* Klahr, D., Langley, P. and Neches, R. (1987).
Production System Models of Learning and Development'. Cambridge, Mass.: The MIT Press.
* Kowalski, R. and Sadri, F. (2016).
Programming in logic without logic programming'. Theory and Practice of Logic Programming, 16(3), 269-295.
* Russell, S.J. and Norvig, P. (2016). ''
Artificial Intelligence: A Modern Approach''. Pearson Education Limited.
* Sowa, J.F. (2000).
Knowledge representation: logical, philosophical, and computational foundations' (Vol. 13). Pacific Grove, CA: Brooks/Cole.
* Waterman, D.A., Hayes-Roth, F. (1978). ''Pattern-Directed Inference Systems'' New York: Academic Press. {{ISBN, 0-12-737550-3
See also
*
Action selection mechanism
*
Expert system
In artificial intelligence (AI), an expert system is a computer system emulating the decision-making ability of a human expert.
Expert systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as ...
*
Learning Classifier System
Learning classifier systems, or LCS, are a paradigm of rule-based machine learning methods that combine a discovery component (e.g. typically a genetic algorithm in evolutionary computation) with a learning component (performing either supervised ...
*
Logic programming
Logic programming is a programming, database and knowledge representation paradigm based on formal logic. A logic program is a set of sentences in logical form, representing knowledge about some problem domain. Computation is performed by applyin ...
*
Inference engine
In the field of artificial intelligence, an inference engine is a software component of an intelligent system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems ...
*
L-system
An L-system or Lindenmayer system is a parallel rewriting system and a type of formal grammar. An L-system consists of an alphabet of symbols that can be used to make strings, a collection of production rules that expand each symbol into some ...
*
OPS5
OPS5 is a rule-based or production system computer language, notable as the first such language to be used in a successful expert system, the R1/XCON system used to configure VAX computers.
The OPS (said to be short for "Official Production Sys ...
*
Production Rule Representation The Production Rule Representation (PRR) is a proposed standard of the Object Management Group (OMG) that aims to define a vendor-neutral model for representing production rules within the Unified Modeling Language (UML), specifically for use in for ...
*
Rete algorithm
The Rete algorithm ( , , rarely , ) is a pattern matching algorithm for implementing rule-based systems. The algorithm was developed to efficiently apply many rules or patterns to many objects, or facts, in a knowledge base. It is used to dete ...
*
Rule-based machine learning
Rule-based machine learning (RBML) is a term in computer science intended to encompass any machine learning method that identifies, learns, or evolves 'rules' to store, manipulate or apply. The defining characteristic of a rule-based machine learn ...
*
Term rewriting
In mathematics, computer science, and logic, rewriting covers a wide range of methods of replacing subterms of a formula with other terms. Such methods may be achieved by rewriting systems (also known as rewrite systems, rewrite engines, or reduc ...
Logic programming
Expert systems