Re: [eclipse-clp-users] Order of constraints

From: Kish Shen <kisshen_at_...5...>
Date: Fri, 27 Feb 2015 19:33:06 +0000
On 27/02/2015 04:48, Edgaonkar, Shrirang wrote:

> My problem is I cannot control the sequence in which constrants appear in my script as it is autogenerated. Is there any other way to handle this.
>

There is a more general issue here: ECLiPSe is not designed as a 
constraint library with an API that you submit autogenerated API calls 
to solve your problem. Doing so has many problems: getting the syntax 
and semantics of your program correct (getting syntax correct with the 
right quotes will be particularly tricky if you are generating the code 
using anothe programming language), understanding what the program 
actually does (autogenerated program is normally very difficult to 
read), debugging such a program if a problem arises....

ECLiPSe is a programming language, and you should write and develop your 
programs in it. If you are auto-generating ECLiPSe programming code 
because you are reading data using another programming language, then 
instead of generating the code, you should send this data to an ECLiPSe 
program, which can then generate the constraints required from the data. 
In this case, you only 'generate' (in ECLiPSe itself) the parts that 
will change because of the actual data, rather than the whole program. A 
simple illustration of this approach is the example to solve Sudoku 
problems:

http://eclipseclp.org/examples/sudoku.ecl.txt

This is different from the 'generated' approach, where I assume you 
would generate the specific alldifferent constraints for your specific 
problem (plus the rest of the program). I think it is much more 
difficult to understand what such a program is actually trying to do, 
and to spot any problems in it.

(This simple example has the problem data as part of the program, but 
this data can be supplied from other sources, such as a program written 
in another programming language where you embed your ECLiPSe, or they 
can be written to a file that your ECLiPSe program reads)

Cheers,

Kish
Received on Fri Feb 27 2015 - 20:08:06 CET

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:30 CEST