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

From: Giuseppe Di Guglielmo <giuseppe.diguglielmo_at_...95...>
Date: Thu, 16 Oct 2008 16:37:39 +0200
Dear all, 
I found the attached solution for my problem.

I assume to have this situation:
1. X and Y bit_vectors of size 8
2. constraint 
   X[2] == '1' & X[3] == '1' & Y[1] == '1' & Y[1] == X[4]

Do you have more suggestions? Is it correct?

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.


> -----Messaggio originale-----
> Da: Giuseppe Di Guglielmo [mailto:giuseppe.diguglielmo_at_...95...]
> Inviato: giovedė 16 ottobre 2008 14.12
> A: eclipse-clp-users_at_...105...
> Oggetto: [eclipse-clp-users] How to access to single bit in ECLiPSe ?
> 
> 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.
> 
> 
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users




Received on Thu Oct 16 2008 - 14:49:01 CEST

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