Re: [eclipse-clp-users] Maximal count of constraints

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Wed, 8 May 2019 10:00:58 +0100
On 04/05/2019 18:58, Jan Drozen wrote:
> Hi,
> 
> In the Eclipse CLP, how many constraints or variables can I define?

There is no specific limit on the number or variables or constraints.


> I am currently remodeling my scheduling problem - I need to replace a single 
> |alldifferent| constraint with many |atmost| constraints. But since I've 
> introduced this change, my ecl script is not working anymore. By "not working" I 
> mean the Eclipse CLP - eclipse.exe or the TkEclipse GUI - just shuts down. 
> Without any error message, comment or saying goodbye. Just nothing.
> 
> If I try to comment-out some constraints, the script at least gets compiled.
> 
> Has someone already bothered with this issue?


It turned out that Jan was working with large, generated source files with 
clauses of thousands of subgoals. Because ECLiPSe uses a recursive descent 
parser, such files can cause an OS stack overflow, in particular on Windows 
(code worked fine on Linux).  Quick remedies include increasing the Windows 
stack limit, see https://docs.microsoft.com/en-us/cpp/build/reference/stack), or 
breaking up the generated code into smaller clauses, and call these in conjunction.

Generally, however, generating textual source code isn't a great idea: it must 
be created, written, read, parsed, compiled, and is then executed just once. The 
preferable technique is to generate a pure data file that contains only things 
like arrays/lists of numbers, but _no_variables_. One can then have a small 
generic ECLiPSe program that reads these data and uses them to create variables 
and constraints, usually in several loops.

For a very simple example, compare 
https://eclipseclp.org/examples/transport1.pl.txt (where all the data is 
explicit in the flat model) with 
https://eclipseclp.org/examples/transport_arr.pl.txt where the model is generic 
and all data comes from the data/3 fact at the end (this would correspond to the 
generated data file).


Cheers,
Joachim
Received on Wed May 08 2019 - 09:01:09 CEST

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