.. Copyright ÂŠ 2007 Bruce Frederiksen
.. Permission is hereby granted, free of charge, to any person obtaining a copy
.. of this software and associated documentation files (the "Software"), to deal
.. in the Software without restriction, including without limitation the rights
.. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
.. copies of the Software, and to permit persons to whom the Software is
.. furnished to do so, subject to the following conditions:
.. The above copyright notice and this permission notice shall be included in
.. all copies or substantial portions of the Software.
.. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
.. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
.. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
.. THE SOFTWARE.
section-pages: , overview/index, installing_pyke, using_pyke, krb_syntax/index, examples, logic_tricks, PyCon2008-paper
Welcome to Pyke
Pyke is a knowledge-based inference engine (expert system) written in
100% python that can:
- Do both forward-chaining (data driven) and
backward-chaining (goal directed) inferencing.
- Pyke may be embedded into any python program.
- Automatically generate python programs by assembling individual python
functions into complete call graphs.
- This is done through a unique design where the individual python
functions are attached to backward-chaining rules.
- Unlike other approaches to code reuse (e.g. Zope adapters and generic
functions), this allows the inference engine to ensure that all of the
function's requirements are completely satisfied, by examining the entire
call graph down to the leaves, before **any** of the functions are
- This is an optional feature. You don't need to use it if you just
want the inferencing capability by itself.
The knowledge engine supports:
- Multiple *fact bases*, each with its own list of facts.
- Both *forward-chaining* rules and *backward-chaining* rules.
- Multiple *rule bases*, each with its own list of forward-chaining
and/or backward-chaining rules.
- Rule base inheritance -- *activating* the derived rule base
includes the rules from the parent rule base.
- The inference rules are compiled into python functions, allowing
python code snippets to be used within the rules.
This greatly enhances the expressiveness of the rules.
Automatic program generation:
- Calls the generated python programs *plans*.
- Plans may be run multiple times without needing to rerun the inference
- Plans may be pickled and cached to disk to be used by other programs or
in later runs of the same program.
- No pyke modules are required to run the plans.
Potential pyke applications:
- Complicated decision making applications.
- The back-end (code generation and optimization) of compilers.
Pyke is used as the back-end of its own
compiler that translates rules into python code.
- Automatic SQL statement generation.
- Automatic HTML generation and automatic HTML template processing.
- Automatic program builder to reuse a common set of functions for many
different specific situations. This could also easily
incorporate a new custom function into a much larger program, where the use
of the custom function might influence the choice of other standard
functions in other parts of the program.
- The control module for a web framework tool.
- A high-level planner to automatically distribute the
modules of a large system over several computers in a distributed system
to meet specific performance and capacity goals. This could be used to
automatically scale the same system code from a small one program,
one computer system
to much larger distributed systems to meet a wide range of performance
- Diagnosis systems, including automated customer service systems.
- Program or library customization for specific uses.
- In addition to being able to build programs, pyke can instantiate,
configure and interconnect a network of objects to meet a specific need