Skip to content
  • Robert Ricci's avatar
    Fix dynamic pclasses, and make them the default for virtual nodes · c7e2d29e
    Robert Ricci authored
    again.
    
    One of the fixes changes the way in which we iterate through pclasses
    in find_pnode(). We used to treat the vector like a ring buffer, and
    start (randomly) someplace in the middle. This turns out to give some
    bad statistical properties when doing dynamic pclasses, since long
    chains of disabled pclasses will cause some pclasses to be selected
    more often. My old hack of just hopping around randomly in the
    disabled-pclass case was bad, because it's hard to tell when you've
    actually tried all the pclasses - so, we were getting false negatives
    where it was looking like there was no place available where we could
    map a vnode, which turned out to have worse effects than I had
    thought.
    
    So, now, we make a list of all the indices and randomize the order,
    then just iterate through that list.
    
    We also now count the number of pclasses that are enabled at every
    temperature step, and adjust the neighborhood size to remove them.
    This makes dynamic pclasses quite a bit faster - it cuts the time
    by 30% - 50% for my test case.
    
    Cleaned up find_pnode() by removing some #ifdef's that we don't use,
    and probably will never want to again - this makes the function almost
    readable!
    c7e2d29e