Infinite looping in hierarchy_minimize

Hello Tiago.

There is the example code which cause the same infinite looping:

*import numpy as np*
*from graph_tool.all import **
*gg =['football']*
*dummy_type = np.array(map(lambda x: int('state' in x.lower()),
*dummy_weights = gg.new_edge_property('double')*
*dummy_weights.a = edge_endpoint_property(gg, gg.vp.value, "source").a -
edge_endpoint_property(gg, gg.vp.value, "target").a*
*test = minimize_nested_blockmodel_dl(gg, deg_corr=False, b_min =
dummy_type, B_max = 50, B_min=5,*
* state_args=dict(clabel =
dummy_type, *
* recs =
* rec_types =
* ), **

My investigation showed that the issue occurs only if I have simultaneously
two things:
*clabel constraint* and *real-normal covariates* for edges. If I remove one
of them - everything is fine, If I change the covariates type from normal
to any other -- again, no looping. This specific *clabel* forces for
bisection search degenerated bounds (min_state = max_state), and normal
covariates some how affects on entropy calculus.

As I understand, the problem is in potentially wrong entropy calculation
As we saw from outputs, code is trying to replace (N=2, B=1) with (N=2,
B=2) and is getting lower entropy.
I found that only in case of normal covariates you have subtraction for
entropy, hence potentially smaller entropy
for more sophisticated model.

Hope, it helps.
Thank you,

attachment.html (7.26 KB)

Please try again with the current git version; it should be working.