Hi there, I've been trying to use the #=> and #<=> constraints in Eclipse but keep getting a syntax error which I don't understand. The code I've written is to use channeling constraints to enforce a permutation on a set of variables: channelling(N,X) :- % Primal Model dim(X, [N]), X[1..N] :: 1..N, % Dual Model dim(R, [N]), R[1..N] :: 1..N, (for(I,1,N), param(N,X,R) do (for (J,1,N), param(I,X,R) do X[I] #= J #=> R[J] #= I, R[J] #= I #=> X[I] #= J ) ), X =.. [_|Vars], writeln("Setup complete..."), labeling(Vars). I keep getting an error from Eclipse: | file testing.ecl, line 17: syntax error: postfix/infix operator expected | X[I] #= J #=> R[J] #= I, | ^ here Also, I would have expected to be able to be able to write the above code using the #<=> constraint as follows: channelling(N,X) :- % Primal Model dim(X, [N]), X[1..N] :: 1..N, % Dual Model dim(R, [N]), R[1..N] :: 1..N, (for(I,1,N), param(N,X,R) do (for (J,1,N), param(I,X,R) do X[I] #= J #<=> R[J] #= I, ) ), X =.. [_|Vars], writeln("Setup complete..."), labeling(Vars). When I tried the following code using "=>" instead: channelling(N,X) :- % Primal Model dim(X, [N]), X[1..N] :: 1..N, % Dual Model dim(R, [N]), R[1..N] :: 1..N, (for(I,1,N), param(N,X,R) do (for (J,1,N), param(I,X,R) do X[I] #= J => R[J] #= I, R[J] #= I => X[I] #= J ) ), X =.. [_|Vars], writeln("Setup complete..."), labeling(Vars). I got the desired result but I don't think that semantically this correct since it is the logical implies rather than the constraint implication. I also tried: channelling(N,X) :- % Primal Model dim(X, [N]), X[1..N] :: 1..N, % Dual Model dim(R, [N]), R[1..N] :: 1..N, (for(I,1,N), param(N,X,R) do (for (J,1,N), param(I,X,R) do X[I] = J #=> R[J] = I, R[J] = I #=> X[I] = J ) ), X =.. [_|Vars], writeln("Setup complete..."), labeling(Vars). ...but I get the same syntax error as above. If anyone could shed some light on this for me I would be grateful. Thanks, Mark.Received on Wed Sep 29 19:49:18 2004
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:30 PM GMT GMT