On 13/10/2012 09:57, Anshu Shankar Prasad wrote: > while compiling the below program I get an error like this > instantiation fault in +(_593, 1, _597) > what is this mean and what should I do to remove this.Help me asap.. > here is my program > :-lib(ic). > :-lib(branch_and_bound). > solve(N,X):- > dim(X, [N]), > X[1..N] :: 1..49, > %Z :: 1..49, > ( > 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 > ) > ) > ), > X =.. [_|Vars], > labeling(Vars). When you compile this code, you get several "singleton" warnings, which you should not ignore: *** Warning: Singleton local variable I in do-loop, maybe param(I) missing? File prasad.ecl, line 15: Singleton variable I *** Warning: Singleton local variable N in do-loop, maybe param(N) missing? *** Warning: Singleton local variable I in do-loop (not used in loop body) File prasad.ecl, line 13: Singleton variable N prasad.ecl compiled 616 bytes in 0.02 seconds The param's are needed because every do-loop has its own namespace for variables. If you want a variable from outside a loop to be visible inside, you must "pass it in" as a param. You forgot to pass the N into the 2nd loop, and the I into the 3rd loop, viz. ( for(I,1,N),param(X,N) do ( for(J,I,N),param(X,I,N) do ( for(K,J+1,N),param(X,I,J) do X[K]-X[I]-X[J]#\=0 ) ) ), > one more I query i have tha If a optimization problem has more than one solution how could I get > all of its solution. Till now for getting multiple solution of a COP I am doing that by > converting the problem it into a CSP.please tell me the other way to doing this.Expalin with example. > So please tell me if there is an nother method See these earlier postings on the subject: http://eclipseclp.org/archive/eclipse-clp-users/1524.html http://eclipseclp.org/archive/eclipse-clp-users/0468.html Cheers, JoachimReceived on Sat Oct 13 2012 - 14:10:37 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST