예제 #1
0
 def adjust_for_precedence(self, weights):
     prec = {pitch.pc(p):w for p,w in self.precedences.items()}
     
     for k in weights.keys():
         if k not in prec:
             prec[k] = 1
     
     for p in self.prev_picks:
         pcp = pitch.pc(p)
         if pcp in prec:
             prec[pcp] *= 0.5
     
     mult = {k: prec[pitch.pc(k)] for k in weights.keys()}
     mult = w.scale(mult, float(self.precedence) / self.left_to_select)
     return w.normalize(w.apply(mult, weights))
예제 #2
0
 def normalize(self):
     self.weighted_items = w.normalize(self.weighted_items)