www.amzi.com


Contents

  • Notes on new newsletter, website, release, packaging & pricing
  • Domain-specific languages & Prolog
  • Notes from the forum - permutation

New Newsletter

Welcome to the first edition of a new Amzi! newsletter. Hopefully you want to receive this and will enjoy the articles on applications of Prolog, Expert Systems and AI, but if not click here: Unsubscribe

Read on the Web

Sign up at the reworked Web site: www.amzi.com


New Release

Amzi! Prolog + Logic Server 9.4.4 is now available for download and/or purchase.

New features include:

  • Fixes to the source code debugger,
  • Support for the new free student edition, and
  • Removal of limited-feature versions of the software.

Domain-Specific Languages

Prolog is exceptionally well suited for developing domain-specific languages (DSL).

In a DSL, the knowledge representation is very close to the way the domain experts express it. This has significant advantages:

  • It can be more easily maintained and/or vetted directly by those experts.
  • Reliability is increased due to a smaller gap between the way the knowledge is expressed and how it is coded.
  • Turn around time for new knowledge is decreased, due the efficiency of having the experts code the knowledge directly with minimal or no need of programmer assistance.

Implementing a DSL in Prolog has three steps:

  • Design Prolog structures to represent the knowledge,
  • Implement a reasoning engine that uses that knowledge appropriately, and
  • Design an API so the DSL can be accessed from a host language for deployment.

The steps for builing DSLs will be covered in future issues of this newsletter, using as an example a prototype recently developed for a bank wishing to automate decision tree knowledge from a policy manual.

Prolog is well suited for building DSLs due to:

  • The structure and list notation that makes it easy to represent complex concepts,
  • The backtracking search execution that makes it easy to define how to reason over the structures and lists,
  • Amzi!'s Logic Server API that makes it easy to deploy the DSL in any application environment.

Amongst Amzi! customers, DSLs have been used by:

  • Major banks to allow changes to mortgage packages be maintained and deployed by the mortgage experts (Java & Prolog),
  • Health care providers to allow pediatricians to update the constantly changing rules for vaccinations (Delphi & Prolog),
  • Manufacturing companies to allow marketing and sales people to maintain product configuration knowledge for cost estimation software (VB & Prolog).

If you have any suggestions for this newsletter or topics you would like to see covered, contact us: Contact

 

2010-11-07


New Pricing & Packaging

Amzi! packaging is now simplified into three options:

  • Student -- Amzi! Prolog with the full Eclipse-based IDE, including the source code debugger that makes it easy to understand Prolog execution behavior. Does NOT include the Logic Server or runtime distribution.
  • Full -- Amzi! Prolog with Logic Server, including the Logic Server for embedding and/or extending Prolog in/with other application environments, and unlimited royalty free runtime distribution. (This was previously called the 'Professional Edition'.)
  • Evaluation -- Like Full, but for a limited time and without runtime distribution.

Amzi! pricing is available either on an individual or site-wide basis. For individuals:

  • Student -- Free.
  • Full -- $298.
  • Evaluation -- Free.

All site-wide licenses allow anyone in the licensed domain, including students and faculty in academic institutions, to download and run the 'Full' edition of Amzi! Prolog + Logic Server.

  • Academic Institutions -- $895.
  • Commercial/Government -- $5,000

Download and/or Purchase


From the Forum
Permutations

Question: Hi, I was wondering how could i generate all possible permuations of a given list

ie. given a list [a,b,c] it would return me a list of all possible permutations

Answer: Typically one uses an intermediate predicate that extracts a member from a list and returns the shortened list of remaining entries:

extract([H|T],H,T).
extract([H|T],X,[H|L]) :- extract(T,X,L).

That code snippet keeps the order of list entries stable. We can use it to concisely define a permutation generator:

permute([],[]).
permute(L,[X|T]) :- extract(L,X,S), permute(S,T).

Because extract/2 allows (by design) backtracking over all the entries in a list, permute/2 will not permit the tail-recursion optimization (because in general backtrack points will be open when permute invokes itself).

The approach above is suitable for classroom exercises. A more careful implementation is required to manage the stack efficiently for permuting long lists. However no amount of care can optimize away the combinatorial explosion in time required to generate all permutations of a long list, so perhaps this is suffiicient.

If you Google for "Prolog code permutations" you will see that a permutation generator is often used with generate-and-test approaches to combinatorial problems, such as the 8 Queens problem (where the ranks of the chess queens must be a permutation of their files).

Finally once you have a nondeterministic predicate that can produce all the "solutions" (permutations in this case), and you wish to realize them as a single list of those solutions, there is a built-in predicate findall/3 which will do this for you. There's a brief discussion and link to the Amzi! Prolog documentation of this predicate in a recent thread in this forum begun by Torsten Pietrek.


Chip Eastham

 

 

The Amzi! Newsletter is sent periodically to Amzi! inc. customers and subscribers.
Click here if you do not want to receive future Amzi! Newsletters: Unsubscribe
If you wish to contact us click here: Contact Us