users-prolog
[Top][All Lists]
Advanced

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

creating choice points without Pl_Query_Begin


From: Bowie Owens
Subject: creating choice points without Pl_Query_Begin
Date: Fri, 31 Oct 2003 14:24:28 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007

Hi everyone,

I was wondering if there is a way to create choice points without using the Pl_Query_ functions. I have been trying to implement backtracking search within Java using nested queries. However, I hit the limit on the query stack size.

// create a choice point to which I can undo everything underneath
gprolog.Pl_Query_Begin(gprolog.TRUE);
int[] arg = { };
gprolog.Pl_Query_Call(gprolog.Find_Atom("true"), 0, arg);

// some code which posts some constraints cutting after each post, may succeed or fail

if (success)
   gprolog.Pl_Query_End(gprolog.PL_CUT);
   // continue
else {
   gprolog.Pl_Query_End(gprolog.PL_RECOVER);
   // goto try next value
}
Create_Choice_Point and Delete_Choice_Point look like just the thing. Except I don't know what to pass for the codeptr and how to do the cut. Any help would be appreciated.

FYI gprolog 1.2.17, swig 1.3, java 1.4.2.

--
Bowie Owens

CSIRO Mathematical & Information Sciences
phone  : +61 3 9545 8055
fax    : +61 3 9545 8080
mobile : 0425 729 875
email  : address@hidden







reply via email to

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