[gecode-users] Value selection when branching

Lars Otten ottenl at student.chalmers.se
Tue Feb 7 18:16:05 CET 2006


Hi,

On 02/07/06 15:49, Christian Schulte wrote:
> It is all true what Guido says, but something more useful is the following:
> also random number generators are deterministic programs. The only problem
> is when you use the OS random number generator: here the state of the random
> number generator is hidden.

In principle it is hidden, yes. However upon initialisation with the same
seed, the same numbers should be produced. So the trick might lie in making
sure the seed is the same when performing recomputation...

> So what you can do is the following: look up a random number generator (such
> as in Knuth "Seminumerical Algorithms"). Store the state of the generator in
> the branching. Then your branching can guarantee that for the same state of
> the branching you will always return the same random values. 

Yeah, I had something similar in mind, but I had not yet thought it through
completely. Thanks for the pointer.

If I recall correctly there's a function rand_r(int*) that might be useful
for my purposes, as an alternative to implementing my own generator --
which, on the other hand, shouldn't be that much work after all (a basic one
is given in the manpage for rand() as well).

> This then also works with recomputation.

I've just put up an order for Knuth's book at our library, I will look into
this and let you know how it works out. Thanks for the hints so far. :)

/Lars




More information about the gecode-users mailing list