Tag Archives: Prolog

Prolog ASLDICN Event Calculus Planner

23 Nov

The event calculus planner used within my thesis was based on Dr. Murray Shanahan’s ASLDICN (Abductive SLD with Integrity constraints and proof by Negation) planner with compound action support. This planner is an adaptation from one published in one of Dr. Shanahan’s research papers

http://casbah.ee.ic.ac.uk/%7Empsha/planners.html

The original planner only supports the generation of a single plan. I needed to support conditional planning. I wanted the planner to generate multiple plans representing the different ways of reaching the goal. The problem was how to convert the planner to generate all possible plans. Importantly ensuring that this does not cause infinite looping and no redundant plan solutions are generated.

My version of the planner add the following features:

  • Conditional Planning
  • Impossible Predicate
  • Occured And NotOccured predicates

(more…)

Running Prolog as CGI

23 Nov

Prolog can be run as CGI by using a PHP wrapper script which invokes the Prolog engine from within PHP. Prolog can be invoked indicating Prolog files to load and goals to initially achieve once loaded.

Prolog Functioning As CGI

Executing the following in PHP can spawn a process which runs Prolog.

$cgiOutput = `sicstus --goal $goal. -l "$cgiPrologScriptToLoad"`;

This specific example is for Sicstus but most Prolog command lines have a similar format. Another possiblity is to setup Prolog as CGI, since any langauge can be CGI. I was running my code on a windows box and found it impossible for Prolog to direct the content to the command line and capture it for returning. If you’re going the unix route you may want to look at PiLLoWs guide.

For form postings you can catch the post in PHP or a scripting language and create a prolog formated file which is passed to the prolog script when invoked.

You may want to have Prolog maintain state. This can be achieved through using a database. The database that I have used is Berkeley DB which SICStus has built in support for.

Intelligent workflow management System

22 Nov

Download PDF Thesis http://www.doc.ic.ac.uk/teaching/projects/Distinguished04/JosephWilk.pdf

This project took the HTML form systems as a model and built a Workflow Management System that uses artificial intelligence planning methodologies and Event Calculus workflow specifications to try to overcome some of the problems of Workflow Management Systems. Logic, server side languages and planning all rolled into one.

iWFMS admin interface

The development of the Workflow Management System with AI uncovered interesting issues in modelling situations in the Event Calculus and the
problems that need to be overcome to use AI with workflow. The problems and
solutions developed in the project cover a wide spectrum of domains, looking at logic
programming, server-side languages and getting the two to talk to each other. Areas
covered include such interesting topics as typing of HTML to new frameworks for
Prolog running as CGI.

Achievements

  • Workflow specification language
    Using the Event Calculus and extensions to specify workflow.
  • [HTML form typing | HTML typing in Prolog]
    A typing engine for ensuring that the HTML form element specifications are
    correct when used in workflow specifications.
  • A Visualisation tool for Event Calculus plans
    A tool that generates Scalable Vector Graphic graphs for Event Calculus
    plans.
  • A HTML/PHP iWFMS engine
    Using the plans generated from the workflow specifications to support the
    running and management of a system.
  • A JavaScript plan execution engine
    Facilitates the following of workflow plans in a scripting language that runs
    while the user is viewing and interacting with a web page.
  • Logic programming running as Common Gateway Interface (CGI)
    A framework for the use of high-level declarative programming languages
    functioning as CGI.
  • [Logic programming and server-side language interaction model | Interaction support between PHP and Prolog]
    An Interaction model allowing server-side languages used for generating web
    pages to interact with logic programming languages.
  • A Hospital model working example
    An example of how the specification can be utilised for a real world scenario in
    a hospital. Providing the full functionality within the iWFMS to run and manage
    this system.