Re: fd_vector_max/1

Daniel Diaz <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hello Nicolas,

The current implementation of FD variables uses of a bit-vector to 
represent sparse values. This vector is used as soon as "holes" appear 
in the domain of a variable.
The current implementation uses a fixed-length vector whose length is 
controlled via the fd_vector_max/1 predicate.
This choice has been done for efficiency reasons. Other representations 
are possible but 1) imply a lot of code rewriting in the solver and 2) 
will penalize efficiency.

In your case (IP addr) it is obviously not a good idea to use a 
bit-vector for 2^32 values (and in fact you cannot define a so big 
length) !
Use instead 4 different variables ranging in 0..255 (or 2 variables in 
0..65535) and "link" them by constraints.

Daniel

Le 22/02/2011 08:12, Nicolas Pelletier a écrit :
> Hello,
>
> I would like to know how difficult it would be to lift the restriction
> that the maximum length for vector representation of FD variables is
> fixed, and what the expected impact on general performance would be. I
> am generating the configuration of a network equipment based on
> constraints on the functions that must be activated (and some other
> constraints on their respective configurations as well). Parts of the
> configuration constrain the domains of the variables used in other
> parts as some functions cannot be used together, or reserve some
> resources, such as IP address ranges. Some of my FD variables
> represent such ranges, and can sometimes span a big chunk of IP
> addresses. I am reluctant to split these into several FD variables,
> each spanning only 256 addresses or so, as this would make the program
> more complex and error-prone, but I am also concerned by the waste of
> memory I would incur if I were to set fd_vector_max to a huge value;
> hence my question.
>
> Thank you in advance for any answers.
>


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.