I've tried to alternate a bit algorithm with my poor understanding of it by changing function Wave::set to accept true values:
bool Wave::set(unsigned index, unsigned pattern, bool value) noexcept
{
bool old_value = data.get(index, pattern);
// If the value isn't changed, nothing needs to be done.
if (old_value == value)
{
return false;
}
// Otherwise, the memoisation should be updated.
data.get(index, pattern) = value;
if(!value){
memoisation.plogp_sum[index] -= plogp_patterns_frequencies[pattern];
memoisation.sum[index] -= patterns_frequencies[pattern];
memoisation.log_sum[index] = log(memoisation.sum[index]);
memoisation.nb_patterns[index]--;
memoisation.entropy[index] = memoisation.log_sum[index] - memoisation.plogp_sum[index] / memoisation.sum[index];
}else{
memoisation.plogp_sum[index] += plogp_patterns_frequencies[pattern];
memoisation.sum[index] += patterns_frequencies[pattern];
memoisation.log_sum[index] = log(memoisation.sum[index]);
memoisation.nb_patterns[index]++;
memoisation.entropy[index] = memoisation.log_sum[index] - memoisation.plogp_sum[index] / memoisation.sum[index];
}
// If there is no patterns possible in the cell, then there is a
// contradiction.
if (memoisation.nb_patterns[index] == 0)
{
is_impossible = true;
//todo: print imposible pattern
}
return is_impossible;
}
Idea is after removing some wave patterns manually, to be able to add some waves patterns, if needed.
But no matter what i do, even if I call this before propagate, algorithm always fails.
Can this work at all? Maybe someone can point or give a hint why this wont work?
I've tried to alternate a bit algorithm with my poor understanding of it by changing function Wave::set to accept true values:
Idea is after removing some wave patterns manually, to be able to add some waves patterns, if needed.
But no matter what i do, even if I call this before propagate, algorithm always fails.
Can this work at all? Maybe someone can point or give a hint why this wont work?