Re: Re: Reading a file and converting the input to integers...

From: Mark A. Hennessy <m.hennessy_at_4c.ucc.ie>
Date: Thu 21 Oct 2004 09:41:14 AM GMT
Message-ID: <4177843A.60600@4c.ucc.ie>
   Thank you for your input. This now works fine. Now that I have the 
data I have run into a problem of dynamically setting up the domains of 
the variables. My code is as follows:

% Setup the Quasigroups With Holes Problem
qwh_setup(Order,Holes,LatinSquare) :-
   NumVars is Order * Order,
   dim(LatinSquare, [NumVars]),
   get_qwh(Order,Holes,IntegerDomains),
   writeln(IntegerDomains),
   (for(I,1,NumVars), param(Order) do
       (Domain == -1 ->
           LatinSquare[I] :: 1..Order
        ;
           LatinSquare[I] :: Domain..Domain
       )
   ),
   writeln(LatinSquare).

When I try to do this I get the following error:

instantiation fault in LatinSquare[1] :: Domain .. Domain

This seems strange so I did a little test to see if it was possible to 
setup the Variable domains conditionally:
         Domain is 4,
       (Domain == -1 ->
           LatinSquare[1] :: 1..Order
        ;
           LatinSquare[1] :: Domain..Domain
       )

and

       Domain is -1,
       (Domain == -1 ->
           LatinSquare[1] :: 1..Order
        ;
           LatinSquare[1] :: Domain..Domain
       )

and I get the expected result. That is LatinSquare[1] is set to 4 and 
{1..Order} respectively.

Any light on this would be appreciated.

Thanks in Advance,
Mark.
Received on Thu Oct 21 10:45:55 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT