Commit e499a192 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

optimizer: show complete population at end

parent 3f1e8e76
......@@ -190,6 +190,18 @@ public:
sort();
}
void show_population(const context_ptr& ctx) const
{
info(ctx, " Population {}:\n", m_indices.size());
for (int i = 0; i != m_size; ++i)
info(ctx,
" - {}: value {} constraints {} hash {}\n",
m_indices[i],
m_data[m_indices[i]].value,
m_data[m_indices[i]].remaining_constraints,
m_data[m_indices[i]].hash);
}
void insert(const bit_array& x,
const std::size_t hash,
const int remaining_constraints,
......@@ -365,7 +377,7 @@ public:
m_data[first].value);
} else {
int first = m_indices[choose_a_solution(rng)];
init_with_random(m_random, rng, x.size(), 0.5);
init_with_random(m_random, rng, x.size(), 0.1);
m_data_reader lock_data_1{ m_data_mutex[first] };
crossover(rng, x, m_data[first].x, m_random);
......@@ -634,6 +646,11 @@ struct best_solution_recorder
}
}
void show_population() const noexcept
{
m_storage.show_population(m_ctx);
}
const raw_result<Mode>& get_worst() const noexcept
{
return m_storage.get_worst();
......@@ -930,6 +947,8 @@ optimize_problem(const context_ptr& ctx, const problem& pb)
} break;
}
best_recorder.show_population();
if (ctx->finish)
ctx->finish(r);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment