Program is running, but looks like melodic difficulty is seen as constant in mixed model.
Added missing bit to melody entries, but still only getting result for first entry, it seems.
Logging has shown problem with mixed model. Key and chord together are just too unreliable. Will try pretending key is always major to see how likely that is...
Found the cause of over-correction. Shouldn't add rests if the last element goes outside the measure (as it does in case of ties).
Logging code to see why the training procedure is halted and how long it takes before this happens.