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

From: Wit Jakuczun <wit.jakuczun_at_...6...>
Date: Fri, 17 Oct 2008 19:16:05 +0200
2008/10/16 Giuseppe Di Guglielmo <giuseppe.diguglielmo_at_...95...>:
> 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?
>
I would do this in the same way. At least basing on what
you have written so far.

You can use also the following equation:
X=sum_i 2^{i-1} * x[i]
where x_i in {0,1} and i=1, 2, ... SIZE.

This equation binds binary and natural representation of X.

Best regards
-- 
[ Wit Jakuczun  w.jakuczun_at_...116... ]
[ WLOG Solutions http://wlogsolutions.com   ]
Received on Fri Oct 17 2008 - 17:16:09 CEST

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