[eclipse-clp-users] How to access to single bit in ECLiPSe ?

From: Giuseppe Di Guglielmo <giuseppe.diguglielmo_at_...95...>
Date: Thu, 16 Oct 2008 14:11:36 +0200
Dear all,
I am using the 'ic' library, and in particular I am exploiting ECLiPSe to
solve simple constraints like (X != 0 & Y > 0). 

As follow:
------ 
% load the library Interval Constraint
% see at ECLiPSe "Constraint Library Manual"
% in particular "IC: A Hybrid Finite Domain / Real Number Interval
Constraint Solver"
% http://87.230.22.228/doc/libman/libman016.html  

:- lib(ic).

% the PIs X and Y are 32 bit INTEGER SIGNED [ -2^31 , ]
%

p :-  L is -(2^31),
      R is (2^31)-1,
      write("Lower bound: "), writeln(L),
      write("Upper bound: "), writeln(R),
      X :: L..R,
      Y :: L..R,
      ( X #= 0 ) and ( Y #> 0),
      indomain(X, random),
      indomain(Y, random),
      writeln("X = 0  and  Y != 0"),
      write("X: "), writeln(X),
      write("Y: "), writeln(Y),
      writeln("----").
------

Now I'd like to define some variables as "bit vectors" and ask to the
constraint solver to solve constraints like:
X is bit_vector[7..0] % 8 bits vector
Y is bit_vector[7..0] % 8 bits vector

X[4] = 1 & Y[2] != 0

I expect as result, something like
X = --1----
Y = ----0--

Where - could be (randomly 0 or 1).

Is this possible in ECLiPSe? Does exist any workaround?

Best regards,
Giuseppe

----------------------------------------------------------------------------
Giuseppe Di Guglielmo       Dept. of Computer Science - University of
Verona 
                               Strada le Grazie, 15 - 37134 Verona - Italy

Phone Office:   +39 045 8027049         Fax:    +39 045 8027068
Phone Home:     +39 045 6152251         Mobile: +39 347 0493371

WWW: http://profs.sci.univr.it/~diguglielmo

email: giuseppe.diguglielmo_at_...95... 
email: diguglielmo_at_...96...          Skype: giuseppe.diguglielmo  

----------------------------------------------------------------------------


This e-mail message is intended for the addressee(s) only and may contain
confidential and or privileged information.  If you are not the intended
recipient of this e-mail message, you should not read, copy, forward or
otherwise distribute or further disclose the information in it. If you have
received this e-mail message in error, please contact the originator of this
e-mail message via e-mail and delete all copies of this message from your
computer or network, thank you.
Received on Thu Oct 16 2008 - 12:11:48 CEST

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