Computational Playlist Optimization

Chris Stratton

New Member
Can anyone propose an algorithm for computationally optimizing a social playlist?

What I'd like to do is input a set of frequency coefficients, ie something like

W5 T4 V3 F5 Q4

And then have it randomly generate a list. That would be easy - just total, calculate an random number over that interval, assign anything in the first 5 to waltz, anything in the next 4 to tango, etc.

Except that it should also give some weight to how frequently that style was last played.

And it probably should not put Vw and Quickstep back to back.

I could do some kind of history decreases probability thing, but then it could still happen.

Or maybe I should just build in a "roll again" rule - roll again all the time if the dance was just played, and some fraction of the time if it was played recently - and half of that for Qs vs. Vw rather than themselves....

Or maybe some kind of genetic algorithm?

I wonder if a journal paper could be written by the end of the month...
 
I would try something like this:

Assume you have your lists with their weights.

Initialization: all flags are at 0.

Step 1: Choose random list. Flag it with its weight. Choose random song from that list. Flag it, cannot choose it again until all songs in the list are flagged.

Start loop

Step 2: Choose next list from the ones that are not flagged yet. Flag it with its weight + 1. Choose song, flag it.

Step 3: Decrease all non-zero flags by 1.

End loop

If at some point you get a list and all songs in it are flagged, clear flags in that list.

In this model the dances you want to show up less frequently should have higher weight.

Do you want to write a paper on this? :)
 
More suggestions:

If you do not want some dances show up back to back, if that list was chosen, and the other list is not flagged, so it may show up next, flag it as well with 2 (or how many dances you want to guarantee in between + 1), this way after the decrease its flag will be still positive and the list will not be considered on the next pass.

Also, consider adding "force" condition to some lists, i.e. if it did not show up for x dances, force it in.
 
I'm a little confused. Were you proposing to list all the tracks with a desireability weighting? I had been trying to come up with something that would generate a list of dances, and then I'd manually fill in tracks for dances (basically I want to use personal preferences to choose music, but keep the numbers and sequence 'fair'). But maybe I could use your method instead, if I can fully figure it out.

Specifcally, I'm a bit confused about what does and doesn't get flagged during the setup phase.

What is the meaning of "list" in your system - is it the list of dances, the list of tracks, or an individual list of tracks for each dance?
 
Here's what one guy does around here:
- always plays dances in pairs i.e. W,W,CC,CC,F,F,R,R etc.
- he also always alternates between Standard & Latin (works socially) but those of us who change shoes, not very good,
- he even has it down to the pause between like dances as being half of the pause between a switch in dances (a bit of overkill in my opinion) of if I recall 4 and 8 seconds respectively,
 
ANOTHER guy does this:
- always play 3 of one style (Std or Ltn) and also in pairs which means you get six in row of Std and then six in row Ltn (I suppose less desirable socially) but he does always mix up the 3 dances being chosen each round;
- for me (perhaps as a competitive 10-dancer), I LIKE this format;
 
I'm a little confused. Were you proposing to list all the tracks with a desireability weighting? I had been trying to come up with something that would generate a list of dances, and then I'd manually fill in tracks for dances (basically I want to use personal preferences to choose music, but keep the numbers and sequence 'fair'). But maybe I could use your method instead, if I can fully figure it out.

Specifcally, I'm a bit confused about what does and doesn't get flagged during the setup phase.

What is the meaning of "list" in your system - is it the list of dances, the list of tracks, or an individual list of tracks for each dance?

I thought you wanted a two-tiered list: list of types (waltz, quickstep, etc) and a list of songs within that type. But if you just want a set of tracks to fill out manually, you can just have a list of dance types. In this case you do not need to do the part about chosing a song from the list of songs for the dance type.
 
my instructor and his partner wrote a program that constructs playlists on-the-spot for practice or socials, depending on how many of each type of song you want. very handy. can adjust length, bpm, fade, spacing in between...

as to how they did that... tch... am clueless.
 
Sounds worth a try - and here I contemplating plugging the external drive containing C compiler into the laptop, because the build environment on my desktop is messed up...
 
Chris I think if you adapt the algorithm you already use to plan out your monthly wardrobe you should be fine.

:together:
 
The other interesting way, although it would be a bit of work to set up and get tweaked properly, would be to use a directed graph. Say you choose a starting node and that node is quickstep. From there, the possible transitions to the next state could be rumba, waltz, or foxtrot. It randomly chooses one of the transitions. Then, say, the rumba node could have a transition that leads down a path where the next node is a cha-cha, and from there it could pick from a foxtrot or a samba or a bolero. If it picks, say the bolero, the next dance might be VW, and so forth. I believe this might more closely duplicate the way that DJ's think of songs when they are putting sets together. I might try to draw such a graph if I can find the time.
 
The other interesting way, although it would be a bit of work to set up and get tweaked properly, would be to use a directed graph. Say you choose a starting node and that node is quickstep. From there, the possible transitions to the next state could be rumba, waltz, or foxtrot. It randomly chooses one of the transitions. Then, say, the rumba node could have a transition that leads down a path where the next node is a cha-cha, and from there it could pick from a foxtrot or a samba or a bolero. If it picks, say the bolero, the next dance might be VW, and so forth. I believe this might more closely duplicate the way that DJ's think of songs when they are putting sets together. I might try to draw such a graph if I can find the time.

That process should have a certain logic in it so that you don't get a path which gets "heavy" in one style. I.e. if your rumba node has possible transitions to chacha or foxtrot and your chacha node has a possible transition to rumba or waltz, you want to prevent a situation when you have rumba-chacha-rumba, while still allowing for them to follow one another as a pair. So in other words, your transitions should be path dependent.

I tried to implement back-to-back conditions as a matrix (i.e. viennese cannot be back-to-back with quickstep or samba), but that still requires some tweaking.
 
I think maybe cornutts path graph could be implemented with something like Tanya's dwindling flags on the transition paths - ie, a base weight for going from this dance to the next, combined with a variable one based on how much that possible dance has been used lately overall.
 

Dance Ads

Advertise on Dance Forums Reach dancers, teachers, studios, event organizers, and dance-friendly brands. View ad options
Back
Top