Re: [eclipse-clp-users] instantion error

From: Wit Jakuczun <wit.jakuczun_at_...6...>
Date: Wed, 5 Sep 2012 12:14:19 +0200
Dear Anshu,
1) You are missing N2 in param:

( for(I,1,N), param(X,N) do



    X[I]#> 0,

    X[I+1]#> X[I],

    X[N]#< N2

 ),
2) I think you should add N to second param. The same with next set of
loops.

 ( for(I,1,N),param(X,N) do

   (for(J,I,N),param(X,I) do

    (for(K,J+1,N),param(X,J) do
I hope that helps

Best regards
-- 

[ Wit Jakuczun  http://www.linkedin.com/in/jakuczunwit  ]


2012/9/5 Anshu Shankar Prasad <anshu.sprasad.che10_at_...339...>

> :-lib(ic).
>
> :-lib(branch_and_bound).
>
>  solve(N,X):-
>
>  N2 is N*N,
>
>  dim(X,[N]),
>
>  X[1..N] :: 1..N2,
>
>  Z :: 1..N2,
>
>  ( for(I,1,N),param(X,N) do
>
>    (for(J,I,N),param(X,I) do
>
>     (for(K,J+1,N),param(X,J) do
>
>     X[K]-X[I]-X[J]#\=0
>
>      )
>
>     )
>
>   ),
>
>  ( for(I,1,N),param(X,N) do
>
>    ( for(J,I+1,N),param(X,I) do
>
>      ( for(K,J,N),param(X,J) do
>
>        ( for(L,K+1,N),param(X,K) do
>
>          X[L]+X[I]-X[J]-X[K]#\=0
>
>         )
>
>       )
>
>      )
>
>     ),
>
> ( for(I,1,N),param(X,N) do
>
>    ( for(J,I,N),param(X,I) do
>
>      ( for(K,J,N),param(X,J) do
>
>        ( for(L,K+1,N),param(X,K) do
>
>          X[L]+X[I]-X[J]-X[K]#\=0
>
>         )
>
>       )
>
>      )
>
>     ),
>
> ( for(I,1,N), param(X,N) do
>
>
>
>     X[I]#> 0,
>
>     X[I+1]#> X[I],
>
>     X[N]#< N2
>
>  ),
>
>
>
>
>
>    Z#=X[N],
>
>
>
> X =.. [_|Vars],
>
> minimize(labeling(Vars),Z),
>
> writeln('value of Z':Z),nl.
>
> The program written above compile with no error  but when I run this
> program and give the value of N it says "instantiation error".Please help
> me in this.Reply me  as soon as possible.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>
>
Received on Wed Sep 05 2012 - 10:14:58 CEST

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