Added a setting for a maximum number of training blocks; even if
criterion is never achieved, training phase stops after this many
blocks.