Question

We have to solve the liars problem in prolog, in several environments with constraints (ECLiPSe ic, ECLiPSe fd, SWI-prolog, GNU-prolog, NaxosSolver, etc.). I have used tail recursion (I think) and as many cuts as I could think of(that way I guess the resolution tree is not getting as big as it could be. If requested, I can post my code.

When the data number becomes 10000-50000, I receive a stack overflow in fd and ic in ECLiPSe and in SWI-prolog the program runs forever. So I would like to increase the size of the stack in ECLiPSe, but I can not see how. I tried to write in the 1st line of my code this:

:-set_flag(local_stack_allocated, 512).

, but it says out of range.

See what eclipse says, which might be helpful: * Overflow of the global/trail stack in spite of garbage collection! You can use the "-g kBytes" (GLOBALSIZE) option to have a larger stack. Peak sizes were: global stack 128832 kbytes, trail stack 5312 kbytes

Était-ce utile?

La solution

First, from error message text I'm assuming that you mean ECLiPSe constraint logic programming system, not Eclipse IDE.

Second, how do you start ECLiPSe? How do you load your code into ECLiPSe?

Try this (you said you are on Windows):

  1. Open command line from the folder where your ECLiPSe source file (say, 'myprogram.ecl') exists. For instructions look at this page: http://www.techsupportalert.com/content/how-open-windows-command-prompt-any-folder.htm
  2. In the command line put eclipse -g 512000 and press ENTER.
  3. Load your program using [myprogram]. (put name of your ECLiPSe source file instead of 'myprogram').
  4. Execute queries as usual.

But I suspect that your program just runs forever and eats all memory, so all this probably won't help in the end.

EDIT. Updated instructions for TkECLiPSe:

  1. In TkECLiPSe in menu choose Tools -> TkECLiPSe Preference Editor.
  2. In preference window find option "Global/trail stack size (in megabytes)" and set it to 512.
  3. Save preferences and close TkECLiPSe.
  4. Next time you run TkECLiPSe stack size will be set to 512 Mb.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top