info-gnuprologjava
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Info-gnuprologjava] PrologCode.SUCCESS_LAST ¿bug?


From: Daniel Thomas
Subject: Re: [Info-gnuprologjava] PrologCode.SUCCESS_LAST ¿bug?
Date: Sat, 02 Jun 2012 15:27:14 +0100

Hello Juan,

Sorry for the delay in getting back to you about this. Having looked
into it, it does seem that this is definitely a problem that is
occurring. However I am not sure whether this is a bug or not, it
depends whether prolog should be able to tell that there are more
possible solutions or not. I think I get the same behaviour in SWIProlog
so perhaps this is what is supposed to happen.

Unfortunately working out exactly where GPJ thinks there are more
solutions when there are none is difficult as this is all done inside
the Warren abstract machine by the InterpretedByteCode class which is
rather hairy and which I don't understand fully. I tried stepping
through it but it is hard to see the wood from the trees.

Sorry I can't be more helpful.

Daniel

On Wed, 2012-05-09 at 12:08 +0200, Juan Galán Páez wrote:
> Hi
> 
> Congrats again por the project.
> I wrote here last year, but my project has been stopped until now. I
> took it again in the last weeks and the first alpha version is relesed
> (http://www.cs.us.es/~fsancho/NetProLogo/?p=about). It is a extension
> por NetLogo (a popular agent based modeling platform), your library
> was really helpful for this task.
> 
> I have the following problem.
> 
> I need somehow to know if there are reminning solutions to read when
> executing a query. I think it would be possible to solve this in a
> tricky way by previously computing and storing the solution to be
> returnet in a future call, but i preffer to avoid this.
> I have been playing a bit with the codes returned by 'execute' and i
> never get 'PrologCode.SUCCESS_LAST' (1). I just get
> 'PrologCode.SUCCESS' (0) and when there aren't more solutions
> 'PrologCode.FAIL' (-1). So, am I doing something wrong? or is it a
> bug? is there any alternative?, i suppose it does'nt exist something
> like '<boolean> hasMoreSolutions(goal)'.
> 
> To show an example, here is a simple case: 
> 
> PROLOG CODE:
> 
> permutation([],[]).
> permutation(L1,[X|L2]) :-
>              select1(X,L1,L3),
>              permutation(L3,L2).
>              
> select1(H,[H|T],T).
> select1(X,[H|T],[H|T1]) :- select1(X,T,T1).
> 
> PROLOG CALL:
> 
> permutation([a,b,c],L)
> 
> OUTPUT(last lines):
> 
> 4 Code: 0
> [c,a,b]
> 5 Code: 0
> [c,b,a]
> 6 Code: -1
> L
> 
> Thank you
> Juan Galan

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]