molpopgen / fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations
http://fwdpp.readthedocs.io
GNU General Public License v3.0
27 stars 11 forks source link

Metapopulation bug #2 #6

Closed molpopgen closed 9 years ago

molpopgen commented 9 years ago

When a copy of the parents is made, the current code in master reads (diploid_functions_ind_based.tcc, metapop version of sample_diploid):

decltype(_diploids) parents(_diploids);

It looks like this was a failed attempt at being clever, resulting in the type of parents being a non-const reference to diploids, meaning that updating the diploids updates the parents, too.

molpopgen commented 9 years ago

To replicate the bug using the (current) dev code (https://github.com/molpopgen/fwdpp/commit/bf746146142f44dccccf8a5721acfd607cb76842):

  1. compile example program migsel_ind without NDEBUG, so that assertions are enabled.
  2. ./migsel_ind 10000 100 1 5 100 0.001 0.5 0 0 80000 10 output.test 4653767

The output will be: migsel_ind: ../fwdpp/internal/recombination_common.hpp:70: void KTfwd::fwdpp_internal::recombine_gametes(const double_vec_type&, gamete_cont_iterator&, gamete_cont_iterator&, gamete_type&, gamete_type&) [with double_vec_type = boost::container::vector; gamete_type = KTfwd::gamete_base<KTfwd::mutation, boost::container::list<KTfwd::mutation, boost::pool_allocator > >; gamete_cont_iterator = boost::container::container_detail::iterator<boost::intrusive::list_iterator<boost::intrusive::bhtraits<boost::container::container_detail::list_node<KTfwd::gamete_base<KTfwd::mutation, boost::container::list<KTfwd::mutation, boost::poolallocator > >, void>, boost::intrusive::list_nodetraits<void>, (boost::intrusive::link_mode_type)0u, boost::intrusive::default_tag, 1u>, false>, false>]: Assertion `std::is_sorted(new_gamete1.mutations.begin(),new_gamete1.mutations.end(),std::cref(am_I_sorted))' failed.

molpopgen commented 9 years ago

Fixed upstream in dev, and fix will be part of 0.2.8 release.