Hans Chalupsky | 25 Mar 2010 22:18
Picon
Favicon

Re: Powerloom, a first stab...

Gerard,

in principle that should be possible.  Given the right logical
descriptions of your programs which can make use of recursive rules,
PowerLoom should be able to enumerate all solutions for a particular
output constellation.  There are two issues which I guess are what
your question is about:

(1) If you found a solution such as, for example, 
(output ?p/prog-2 ?o1/a-2 ?o2/b-3 ?o3/c-19), you also need to know
what inputs prog-2 needed, how it obtained those, etc.  If you wanted
to do that purely in logic, you basically have to "cons up" some
result structure which you pass along everytime a program is applied
(assuming programs are represented by one or more rules).  That means
"output" predicates would also have an argument that represents all the
inputs required to generate that output.  The way that can be done is
with function terms where the functions are declared as total (look
for example at the append demo).  You can declare a function such as
`input-values' that is total and variable-arguments and in the
antecedent of a rule collect the various values you want to collect
and pass its output to the consequent, and so on.

But that might be a bit messy and requires you to later on parse
complex function terms to get at the information.  Another way would
be to programmatically walk the proof/explanation structure for the
solution and collect all the information from its leaf and rule
application nodes.  This is possible, unfortunately there isn't any
good API support available right now (look towards the end of
logic/justifications.ste for inspiration).  For example, there is a
`consify' method you can apply to a justification object which gives
you a cons-tree representation of the whole proof which you then can
walk fairly easily (even in Java).

(2) minimality: you can do a "retrieve all" and PowerLoom will try to
generate all possible solutions.  If you have some kind of cost
function, you'd compute that cost for each solution and then select
the one with the smallest one (e.g., make the cost an output argument
and do a :sort-by :values in the retrieve).  However, if there is a
potentially large number of solutions, you might want to do something
smarter than that by cutting off partial solutions that can't improve
on what you already have.  That, however, you would have to do in
code.  You might also have more complex subsumption relationships
between solutions which might require a somewhat more sophisticated
approach.

Hope that helps,

Hans

>>>>> Gerard Toonstra <toonstge <at> hotmail.com> writes:

> Hi there,

> I'm currently evaluating powerloom for research in the context of an agent platform.

> I've read through all documentation of powerloom so far and I think it's certainly powerful enough
> to use it for our purposes, certainly for all the standard logic. 
> I do have a question however on producing solutions and alternatives. The only recursion 
> example I found in Powerloom used transitivity rules (parent/ancestor example and the RCC8 KB).
> Unfortunately, my problem cannot be used with transitivity.

> The problem I have is:

> - Someone states input need X.
> - Programs provide one single output
> - In order to produce the output, a program may have 0-n input needs, which need to be resolved
>   with outputs from other programs.
> - Those programs providing these outputs in their turn may have 0-n input needs themselves.

> The required output is a list of acceptable solutions that, in their combination, can provide
> the output. I imagine that the only way to do this properly is through recursion somehow.
> I do however have two alternatives there: 
> - I can do this in Java and just maintain the tree myself
> - I may be able to rely on Powerloom to produce these alternatives, but I don't know what to look for.
>    (many instances of programs may exist, so including a similar instance is actually a different solution).

> So that's the question basically. Can powerloom produce a list of entities that together form the solution,
> based on some constraints that are set on the production of this list and present each acceptable, but
minimal 
> solution individually?  I'm not asking for a piece of code, just what I need to look for to realize this.

> Rgds,

G> 
 		 	   		  
> _________________________________________________________________
> Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_2

Gmane