[eclipse-clp-users] Constraints on list

From: Edgaonkar, Shrirang <Shrirang.Edgaonkar_at_...390...>
Date: Sat, 24 Jan 2015 01:06:16 +0000
Dear Eclipse-clp users,



  Following is my problem. I have searched through the forum archives for this solution but in vain. I have encountered dynamic structures but not list. I need to add constraints on List through indexed elements as below. The resultant List should be evaluated based on the constraints. In the eclipse samples diaz_pool.pl at_most_one is what i mean to create. Instead of at_most_one it will be at_most_N in my case. It is just a thought though. I have mentioned the desired output too.



:- lib(ic).

solve(A,B) :-

 B :: 1 .. 10,

 length(A, B),

 A[4] #= 1,

  A[6] #= 2,

 search([B],0,input_order,indomain_split,complete,[]).







Output

?- solve(A, B).
A = [_,_,_,_,1,_2]
B = 6
Yes (0.00s cpu, solution 1, maybe more)





Thanks and Regards,

Shrirang Edgaonkar

______________________________________________________________________
Disclaimer: This email and any attachments are sent in strictest confidence
for the sole use of the addressee and may contain legally privileged,
confidential, and proprietary data. If you are not the intended recipient,
please advise the sender by replying promptly to this email and then delete
and destroy this email and any attachments without any further use, copying
or forwarding.
Received on Sat Jan 24 2015 - 01:26:37 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST