Home > Archive > Prolog > February 2005 > Prolog as program generator using planning systems
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Prolog as program generator using planning systems
|
|
| tmp123 2005-02-09, 8:57 am |
| Hi,
I'm trying to write a program that does my work and allows me not to
work any more.
Well, being serious, I'm trying to write a Prolog program that
generates an OCAML(functional) program. Planning theory is the base of
the prolog algorithm.
The example I'm working is an "echo" program: for each message it
receives from a TCP channel, it must answer sending same message for
the same channel.
The precondition is to have an open tcp channel : tcp_channel(s).
The librarian of actions has three actions:
- read a message(M) received in the channel(S): read(S,M).
- write a message(M) in a channel(S): write(S,M).
- link some statements(P) to a channel(S): link(S,P). After linking,
each time a message is received in channel S, the statements P are
executed.
The poscondition(target) is: for all message received in channel s,
then it must exist another message sended in s with same data:
forall(M, msg(M) /\ received(S,M) -> sent(S,M) ). [This rule is the
input of the prolog program]
My analisis goes to a two step activity:
The first step seems easy: precondition is "a message has been received
at s", postcondition is "same message has been sent". For a planning
system it should be easy to decide the necessary actions: read(s,M);
send(s,M).
The second step is the complex one for me: precondition is "s is a
tcp_channel" (tcp_channel(s)), postcondition is the target already said
(forall message ... ). The resulting plan should be:
link(s,(read(s,M);write(s,M))). This result is the target OCAML
program.
The dificulty in this step is that one of the parameters of "link" is,
in fact, a plan, result from previuos step.
Please, has some sugestions or references? Are planning systems good
for this subject? Which kind of planning systems? ...
Sorry for the long post, and thanks a lot for your time.
| |
|
| If You are willing to provide examples of I/O (as ground facts)
of the program you want,
an ILP system may try to do trick for you.
N.
links:
http://www-ai.ijs.si/ilpnet/
http://www.cs.bris.ac.uk/~ilpnet2/
tmp123 ha scritto:
> Hi,
>
> I'm trying to write a program that does my work and allows me not to
> work any more.
>
> Well, being serious, I'm trying to write a Prolog program that
> generates an OCAML(functional) program. Planning theory is the base of
> the prolog algorithm.
> The example I'm working is an "echo" program: for each message it
> receives from a TCP channel, it must answer sending same message for
> the same channel.
>
> The precondition is to have an open tcp channel : tcp_channel(s).
> The librarian of actions has three actions:
> - read a message(M) received in the channel(S): read(S,M).
> - write a message(M) in a channel(S): write(S,M).
> - link some statements(P) to a channel(S): link(S,P). After linking,
> each time a message is received in channel S, the statements P are
> executed.
> The poscondition(target) is: for all message received in channel s,
> then it must exist another message sended in s with same data:
> forall(M, msg(M) /\ received(S,M) -> sent(S,M) ). [This rule is the
> input of the prolog program]
>
> My analisis goes to a two step activity:
>
> The first step seems easy: precondition is "a message has been received
> at s", postcondition is "same message has been sent". For a planning
> system it should be easy to decide the necessary actions: read(s,M);
> send(s,M).
>
> The second step is the complex one for me: precondition is "s is a
> tcp_channel" (tcp_channel(s)), postcondition is the target already said
> (forall message ... ). The resulting plan should be:
> link(s,(read(s,M);write(s,M))). This result is the target OCAML
> program.
> The dificulty in this step is that one of the parameters of "link" is,
> in fact, a plan, result from previuos step.
>
> Please, has some sugestions or references? Are planning systems good
> for this subject? Which kind of planning systems? ...
>
> Sorry for the long post, and thanks a lot for your time.
>
|
|
|
|
|