- Code: Select all
do
{
for(std::size_t i = 0; i < max_iterations; ++i)
{
std::vector<int> swapped_order = bnl::random_swap_order(top_order);
double swapped_score = bnl::log_score(swapped_order, ds, local);
double order_ratio = exp(swapped_score - original_score);
double min = std::min(1.0, order_ratio);
if(min == order_ratio)
{
if(bnl::random::random_int(0,1) < order_ratio)
{
top_order.clear();
top_score = 0.0;
top_order = swapped_order;
top_score = swapped_score;
}
}
total_score += swapped_score;
std::cout << swapped_score << '\n';
swapped_score = 0.0;
swapped_order.clear();
order_ratio = 0.0;
min = 1.0;
system_time += get_wall_time();
}
}
while(system_time < max_time);
This error continues to occur: *** Error in `./output': double free or corruption (out): 0x00000000025730c0 ***
I made some modifications and improved the likelihood of the program running successfully but cannot successfully run the program multiple times without that error occuring at least once.