Elsevier

Information Sciences

Volume 178, Issue 3, 1 February 2008, Pages 647-662
Information Sciences

Music playlist generation by adapted simulated annealing

https://doi.org/10.1016/j.ins.2007.08.019Get rights and content

Abstract

We present the design of an algorithm for use in an interactive music system that automatically generates music playlists that fit the music preferences of a user. To this end, we introduce a formal model, define the problem of automatic playlist generation (APG), and prove its NP-hardness. We use a local search (LS) procedure employing a heuristic improvement to standard simulated annealing (SA) to solve the APG problem. In order to employ this LS procedure, we introduce an optimization variant of the APG problem, which includes the definition of penalty functions and a neighborhood structure. To improve upon the performance of the standard SA algorithm, we incorporated three heuristics referred to as song domain reduction, partial constraint voting, and a two-level neighborhood structure. We evaluate the developed algorithm by comparing it to a previously developed approach based on constraint satisfaction (CS), both in terms of run time performance and quality of the solutions. For the latter we not only considered the penalty of the resulting solutions, but we also performed a conclusive user evaluation to assess the subjective quality of the playlists generated by both algorithms. In all tests, the LS algorithm was shown to be a dramatic improvement over the CS algorithm.

Introduction

Some of the cornerstones of the Ambient Intelligence vision are related to the embedded and context-aware qualities of new technologies [1], [14]. Diffuse technologies will make functions and content available everywhere, at large quantities, at all times, and within reach for everyone for any context-of-use. As a present-day example, efficient audio compression techniques and the Internet already gave the impulse to people to collect massive volumes of digital music files for personal use. Additionally, Ambient Intelligence strongly advocates the need of personalized, adaptive, and anticipatory qualities of the new technologies. In other words, to make the digital environment useful, useable, and pleasurable for people, the functions of the technologies need to be concerned with real user needs and desires. As a real need from the wide-spread availability of music, people welcome help to sort out their music and a handle to an easy and enjoyable music listening experience.

In order to realize personalized assistance in music choice, we research the automatic generation of music playlists by means of ‘intelligent algorithms’ borrowed from mathematical programming and combinatorial optimization. As a first prerequisite, we need to be able to reason about songs. Therefore, we think of songs as a list of attributes that are deemed to be relevant for music choice. As shown in Table 1, song attributes can be nominal such as the song/album title or the performing artist, allowing only reasoning in terms of equivalence (e.g., these two songs are by the same artist) and set membership (e.g., that song belongs to this album). Attributes can also be numerical such as the duration and the tempo of the song; numerical attributes allow the computation of a difference between attribute values. One can also think of other types of attributes such as categorical types allowing partial order relationships between attribute values, and ordinal ones having a total order on the values.

Having the description of songs in place, we should be able to automatically create music playlists. Informally, a playlist is a sequence of the ‘right’ songs at the ‘right’ positions that can be played back in one go. What is ‘right’ in this respect depends on the prevailing purposes of everyday music listening, including the music preferences, interests, and mood of the music listener. In our work, we model these desired playlist properties as formal constraints that are defined over the playlist positions in terms of song attributes. We distinguish three types of constraints. A unary constraint poses a restriction for a single playlist position (e.g., the first song should be a ‘jazz-song’). A binary constraint declares a desired relation between songs at two different positions. For instance, this relation can express a song order (e.g., the first song should be faster than the second song) or a similarity between two songs (e.g., both songs should have the same tempo). Finally, a global constraint is defined on any number of positions. For instance, they can express restrictions on cardinality for the entire playlist (e.g., there should be at most two different genres in a playlist) or group a set of unary or binary constraints all together (e.g., all songs should be ‘jazz-songs’).

By placing the user and her environment central to our research activities, we formulated a list of requirements that we used as input and evaluation criterion for our automatic playlist generation algorithms. Since the algorithms will be used in an interactive music system, demands on efficiency, scalability, and optimality are pressing. Time to compute a playlist should run in a few seconds, since there is a user waiting for the result. The algorithms should scale towards playlists of any length and music collections of any size and any variety. The returned playlist should be optimal and reflect the music preferences of the user, even if these preferences result into conflicting constraints and no playlist exists that meets all expressed preferences.

The algorithm we present is at the heart of a range of interactive music systems, which are used for demonstration purposes and in end user evaluations. These systems allow music listeners to create their personal music playlist without any effort and in a playful interaction style. By manipulating interactive controls in a user-system interface, users can parameterize the playlist constraints needed for generation. Specific controls are coupled to a specific set of constraints. Note that the end user is not aware of the playlist generation method hidden behind the interface; she just manipulates some controls and observes the immediate results of her actions.

We show two concrete examples of an interactive music system that make use of the automatic playlist generation algorithm, with two different usage scenarios. The first system aims at usage with a television set and remote control combination [12]. Users can browse through a music collection using a two-panel visualisation, as shown in Fig. 1a. Movement through the panels is done by using the cursor keys on the remote control. The left-hand panel provides the current choices for the user. The right-hand panel displays the consequences of a choice. Selecting an item can be done by pressing the ‘ok’ button. Color keys can be used to invoke functions like ‘reset’, ‘clear’ and ‘generate’. While navigating and listening, songs can be added to or removed from a playlist. In addition, a user can select playlist criteria on, for instance,

  • the number of songs or duration of a playlist,

  • the variety in genres, artists, and albums,

  • the tempo and period of release of the songs, and

  • the similarity of songs.

These playlist criteria are directly transformed into constraints to generate a playlist.

The second system aims at usage with a web-tablet touch interface. Users can browse through a music collection in a genre-artist-album menu hierarchy by touching the display [15]. The user can put ‘chips’ in a circular region, as shown in Fig. 1b. Each ‘chip’ is associated with an aspect like a genre, an artist, or an album. The closer the ‘chip’ is placed to the centre of the region, the more important the corresponding aspect is to the definition of the playlist. In this way, the variety in genres, artists, and albums can be adjusted according to personal view. Additional criteria on tempo, year of release, and length of the playlist can also be adjusted, if desired. The interaction allows the generation of several versions of the playlist by changing criteria and by fixing, removing, and adding songs to the playlist. Again, criteria for a playlist are transformed into constraints before generation.

Generating a music playlist in an automatic fashion has already been researched using different formulations of the problem. Unfortunately, the approaches were not paired with thorough evaluations. Here, we will only review approaches that are comparable to our model and solution.

Alghoniemy and Tewfik present a network flow approach to playlist generation [4], [3]. Nodes in the network represent songs and the arcs are attributed with weighted costs reflecting constraints to be satisfied. Generating a playlist is formulated as an objective to find a path with minimal cost connecting a source node and a sink node in the network (i.e., the first and last song in the playlist). To solve the flow problem, they transformed it into a binary linear program using branch and bound [10]. Their method incorporates a notion of optimality. Unfortunately, branch and bound is an exponential algorithm in the worst case.

Pachet et al. [9] use a constraint satisfaction formulation in which desired properties of the playlist are declared by constraints to be met. A standard constraint satisfaction programming (CS) method was used at first [13]. In a CS context, a playlist is modelled as a fixed-sized sequence of constrained variables in which each variable denotes a position in the playlist and has associated a domain of possible songs for that position. In a constructive search, CS assigns songs to variables from their domains in a one-by-one fashion under the condition that all constraints can be completely satisfied. If no songs for a given position are available that meet all constraints, the search backtracks by altering one of its previous assignments and proceeds with the assignment from there on. To improve CS, a wealth of heuristic improvements exists such as constraint propagation, song and variable selection strategies, and backtrack methods [13]. Similarly to branch and bound, CS algorithms have a worst-case exponential complexity. It does not incorporate a notion of optimality. Our own findings were that CS results in an adequate performance in an interactive music system for moderate instances [12], but it is not really scalable.

Aucouturier and Pachet [5] later re-formulate the problem to allow the use of approximating algorithms based on local search (LS) [2] to scale the approach towards very large music collections. Costs are associated with playlists: the more constraints are violated, the higher the cost. The use of this solution method is also the subject of this paper.

In this paper, we will go in-depth into the automatic playlist generation problem, its algorithmic solution, and a comparative evaluation of the algorithm. First, we present a formal model and the computational difficulties of the problem in Section 2. An optimization variant of the problem will be introduced in Section 3, which allows us to use a class of generic approximation algorithms known as local search. We will explain the use of simulated annealing, as a special case of local search, for our optimization problem in Section 4. A study of the problem structure provided us heuristics to improve simulated annealing for our problem. We will devote Section 5 to a thorough evaluation on efficiency and scalability of the developed algorithm by comparing it to a previously developed approach based on constraint satisfaction. Part of this evaluation is a conclusive user test in which we assessed to what extent the playlists of both algorithms were found to be optimal in the eyes of real prospective users. Finally, we will summarize the results, findings, and possible applications of our work in Section 6.

Section snippets

A formal model

In this section, we present a formal model of the playlist generation problem. The first element of the model is the input, which is given by a music collection. Formally, a song is given by a vector s = (v1,  , vK) of attribute values, denoting that the kth attribute of song s has value vk  Dk. For an example of attributes, see Table 1. Next, a music collection is given by a set M = {s1,  , sm} of m songs.

The second element of playlist generation is given by its desired output, a playlist, which is

An optimization variant

We convert APG into an optimization variant APG-O by introducing a non-negative penalty function that represents the amount of violation of the constraints. Then, instead of searching for a playlist that meets all constraints, we search for a playlist that minimizes the penalty. If the penalty is zero, all constraints are met. Introducing a penalty also overcomes the problem of over-constrained problem instances. In that case, no solution exists that meets all constraints, but the user is still

Local search

The definition of the optimization variant APG-O allows us to solve it with a generic approximation method such as local search (LS) [2], [7]. The key feature of local search is that it searches the solution space by iteratively stepping from one solution to a neighboring solution, and comparing their quality. A neighborhood structure defines which solutions are neighbors to a given solution, which are usually obtained by making small alterations to the given solution. For APG-O, solutions are

Evaluation

This section presents the evaluation of our algorithmic solution to APG-O. First, we set the algorithmic parameters in Section 5.2. Next, we present tests on the scalability issues of our solution and a conclusive user study in Sections 5.3 Tests on scalability, 5.4 Quality evaluation, respectively. Our solution method was compared with a constraint satisfaction (CS) algorithm. All tests were performed using a PC with a 3 GHz Pentium 4 processor and 1 GB of RAM, running the Windows XP operating

Conclusion

We introduced a formal model and an optimization variant of the automatic music playlist generation problem and designed an optimization algorithm for it based on simulated annealing. The main requirements for the algorithm were concerned with efficiency, scalability, and optimality. In a set of tests, the algorithm was shown to be an improvement over a previously designed algorithm based on constraint satisfaction on all three requirements. We found that the typical run time of the algorithm

References (16)

  • E.H.L. Aarts et al.

    The New Everyday: Views on Ambient Intelligence

    (2003)
  • E.H.L. Aarts et al.

    Local Search in Combinatorial Optimization

    (1997)
  • M. Alghoniemy, A.H. Tewfik, A network flow model for playlist generation, in: Proceedings of the IEEE International...
  • M. Alghoniemy, A.H. Tewfik, User-defined music sequence retrieval, in: Proceedings of the 8th ACM International...
  • J.-J. Aucouturier, F. Pachet, Scaling up music playlist generation, in: Proceedings of the IEEE International...
  • M.R. Garey et al.

    Computers and Intractability: A Guide to the Theory of NP-Completeness

    (1979)
  • S. Kirkpatrick et al.

    Optimization by simulated annealing

    Science

    (1983)
  • S.E. Maxwell et al.

    Designing Experiments and Analyzing Data: A Model Comparison Perspective

    (1990)
There are more references available in the full text version of this article.

Cited by (17)

View all citing articles on Scopus
1

Present address: Quinity, Maliebaan 50, 3581 CS Utrecht, The Netherlands.

View full text