Re: [eclipse-clp-users] Program Does not Load

From: Joachim Schimpf <joachim.schimpf_at_...44...>
Date: Wed, 03 Feb 2010 15:03:43 +1100
Amine Marref wrote:
> Dear Marco,
> 
> Thanks for your prompt answer. I noticed some issues using "Version 6.0
> #115 (i386_linux)" of Eclipse on my Ubuntu.
> 
> 1) I tried to reproduce the error. a) I used the GUI-mode to load my
> program (without your option) and it failed to load *silently*. b) I
> used the command-prompt mode and run "eclipse file.ecl "goal"" and it
> failed to load silently. c) I used the top-level-loop mode and I got a
> similar error [1] to yours. I wonder why it is explicit about the
> failure of loading in the loop mode and not as explicit in other modes?

The code invoking the compiler from the tkeclipse menu and from the -b option
incorrectly assumes that error messages have already been printed.
I have registered this as a bug.


> 
> 2) I used the command-prompt mode i.e. "eclipse -g 1000000 file.ecl
> "goal"" and it failed to load silently again.

The correct syntax is eclipse -g 1000000 -b file.ecl

> Finally, how do you use the option -g in loop/GUI mode?

You give a -g option when starting eclipse or tkeclipse from a commmand line.
Or, in tkeclipse, open the Preference Editor, set Global/trail stack size,
save Preferences, and restart.


> I noticed that I cannot grow the stack to 3Meg,

You mean 3GiB.  The limit depends on the operating system, see
http://sourceforge.net/mailarchive/message.php?msg_id=484429FF.8040308%40cisco.com


> do you know why my
> program is not loading? Is it the number of variables which is big? or
> constraints? or both?

The compiler isn't ideally suited for large generated source code.
But you should not generate source code anyway, see recommendations in
http://sourceforge.net/mailarchive/message.php?msg_id=4B42DDF7.8010002%40infotech.monash.edu.au

If you currently generate the source code using an ECLiPSe program, consider
modifying it and calling the constraints directly (instead of writing them to
a file, reading them back, compiling them and then executing).

If you generate the source code from a non-ECLiPSe program, consider writing
a data file (only numbers) and having a fixed ECLiPSe program to read that
data and set up the constraints dynamically, as in
http://www.eclipse-clp.org/examples/apc_lp.ecl.txt

Or: write a single setup clause (in your case, solve/2) to a file "model",
then interpret this clause as follows:

    execute_clause_from_file(File, Head) :-
        open(File, read, S),
        read(S, (Head :- Goals)),
        close(S),
        execute(1, Goals).

    execute(I, Goals) :-
        ( Goals = (G,Gs) ->
            writeln(I:G),
            call(G),
            I1 is I+1,
            execute(I1, Gs)
        ;
            writeln(I:Goals),
            call(Goals)
        ).

When called with execute_clause_from_file("model", solve(X,Y)), it
will read the model, execute the constraints one-by-one (printing
goal number and constraint first, so you can pinpoint failures more
easily), and deliver a result or fail.


-- Joachim
Received on Wed Feb 03 2010 - 04:02:50 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET