[metslib] Problem with random_shuffle
Mirko Maischberger
mirko.maischberger at gmail.com
Tue Nov 9 21:35:48 EST 2010
Hello,
Thank you for debugging and for having tracked the error down.
I'm aware of some compatibility issues/bugs in the tr1/random libraries. I
will look into the problem in the next few days and I hope to release a fix
real soon.
Mirko
On Tue, Nov 9, 2010 at 1:01 AM, Shahin Gelareh <shahin.gelareh at gmail.com>wrote:
> Hi everybody,
>
> It seems like there have been a lot of changes from 4.3 to 5. Thanks for
> the efforts.
> The code I had in 4.3 does not work anymore with 5, it is of course
> migratable but now the main concern is regarding the suffleing algorithm of
> STL.
> The results in windows and using MSVC (MSVS2010)compiler is not what one
> expects. This is for example the case for qap example.
> I personally cannot run it. It reports exception and exits.
>
> One only needs to trace the code until:
> template<typename random_generator>
> void random_shuffle(permutation_problem& p, random_generator& rng)
> {
> #if defined (METSLIB_HAVE_UNORDERED_MAP) && !defined
> (METSLIB_TR1_MIXED_NAMESPACE)
> std::uniform_int<> unigen(0, p.pi_m.size());
> std::variate_generator<random_generator,
> std::uniform_int<> >gen(rng, unigen);
> #else
> std::tr1::uniform_int<> unigen(0, p.pi_m.size());
> std::tr1::variate_generator<random_generator,
> std::tr1::uniform_int<> >gen(rng, unigen);
> #endif
> std::random_shuffle(p.pi_m.begin(), p.pi_m.end(), gen);
> p.update_cost();
> }
>
>
> The output of this "std::random_shuffle(p.pi_m.begin(), p.pi_m.end(),
> gen);" is the original permutation where some of the cells are swapped BUT
> there are some strange numbers among the numbers. large positive values
> specifically. I searched a lot with no success about how to overcome.
>
> I was wondering if anyone has any idea?
>
>
> _______________________________________________
> metslib mailing list
> metslib at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/metslib
>
--
Mirko Maischberger
@ | mirko.maischberger at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/metslib/attachments/20101109/b7577d32/attachment.html
More information about the metslib
mailing list