Re: [eclipse-clp-users] Constraints on structures

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Thu, 04 Dec 2014 01:28:34 +0000
On 04/12/14 01:06, Edgaonkar, Shrirang wrote:
> Dear Joachim,
>
> Thanks for the answer. It worked.
>
>
> I have one more issue. I am trying the following.
>
> search([A[year of book], B[year of book]],0,input_order,indomain_split,complete,[]).

This specific case can be written as

   search([A,B], year of book, input_order, indomain_split, complete, []).

i.e. you give a list of books [A,B], and search on all the year-fields.

But generally, when you have more than one type of variable (e.g. year and 
cost), you should indeed first extract all those variables from your data 
structures into a big list, and use this list for search/6.


 > Since I need to generate clp code, it demands ...

Stop right there!  Do not generate "clp code".  Generate only the input *data* 
you need, and use a *fixed* piece of ECLiPSe code to read that data and set up 
the constraints accordingly.

See for example http://eclipseclp.org/wiki/uploads/Examples/knapsack_ic.ecl


-- Joachim
Received on Thu Dec 04 2014 - 01:28:44 CET

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