[eclipse-clp-users] instantion error

From: Anshu Shankar Prasad <anshu.sprasad.che10_at_...339...>
Date: Wed, 5 Sep 2012 15:12:52 +0530
:-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.
Received on Wed Sep 05 2012 - 10:07:15 CEST

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