How to Deal with Unconventional Applications of Constraint - - PowerPoint PPT Presentation

how to deal with unconventional applications of
SMART_READER_LITE
LIVE PREVIEW

How to Deal with Unconventional Applications of Constraint - - PowerPoint PPT Presentation

How to Deal with Unconventional Applications of Constraint Programming Charlotte Truchet TASC, LINA (UMR 6241), Universit de Nantes, France Doctoral Program CP 2015 August 31st, 2015 Truchet Unconventional Applications CP2015-DP 1 / 46


slide-1
SLIDE 1

How to Deal with Unconventional Applications

  • f Constraint Programming

Charlotte Truchet

TASC, LINA (UMR 6241), Université de Nantes, France

Doctoral Program CP 2015 August 31st, 2015

Truchet Unconventional Applications CP2015-DP 1 / 46

slide-2
SLIDE 2

Outline

1

Conventional? Unconventional?

2

Two examples of unconventional applications Urban Planning Music

3

Lessons learned

4

Conclusion

Truchet Unconventional Applications CP2015-DP 2 / 46

slide-3
SLIDE 3

Conventional? Unconventional?

Classical application area

Constraint Programming is a very powerful technology.

Truchet Unconventional Applications CP2015-DP 3 / 46

slide-4
SLIDE 4

Conventional? Unconventional?

Classical application area

Constraint Programming is a very powerful technology. BUT in practice, it is very often applied to a relatively small number of problems: scheduling, scheduling, scheduling, scheluding with something making it more difficult, scheduling with something else making it more difficult, etc

Truchet Unconventional Applications CP2015-DP 3 / 46

slide-5
SLIDE 5

Conventional? Unconventional?

Classical application area

See last year CP application tracks:

Truchet Unconventional Applications CP2015-DP 4 / 46

slide-6
SLIDE 6

Conventional? Unconventional?

Classical application area

Why? Maybe because it is difficult, in the NP-hard way ? Maybe because CP is indeed efficient on these problems? Maybe it is only cultural? Is there something wrong with this? Of course no. CP is used for what it’s good at. Does it say it all? No! (my claim)

Truchet Unconventional Applications CP2015-DP 5 / 46

slide-7
SLIDE 7

Conventional? Unconventional?

What is CP good at?

solving NP-hard problems, providing generic constraints (efficient, re-usable solving algorithms), providing generic constraint languages. Maybe, we focus a little too much on the first item, and not enough on the last two.

Truchet Unconventional Applications CP2015-DP 6 / 46

slide-8
SLIDE 8

Conventional? Unconventional?

Unconventional applications?

Conventional applications Scheduling, or any other application: naturally modeled by a CSP (no dirty variables or weird constraints), and which is NP-hard, and where the goal is to improve the solving time or the best

  • ptimum found so far.

Truchet Unconventional Applications CP2015-DP 7 / 46

slide-9
SLIDE 9

Conventional? Unconventional?

Unconventional applications?

Unconventional applications problems which are hard, or impossible, to model,

  • r problems which may not be hard to solve considering the

solving time, but hard to solve for other reasons,

  • r problems which may even not need to be properly solved.

NB there have already been a lot of such applications, for instance in medicine, computer aided design, image processing, oenology, disaster management... NB2 Actually, an unconventional application (drawing scenes with shadows) is at the origin of CP . See J.-F. Puget’s blog on CP history.

Truchet Unconventional Applications CP2015-DP 7 / 46

slide-10
SLIDE 10

Two examples of unconventional applications

Outline

1

Conventional? Unconventional?

2

Two examples of unconventional applications Urban Planning Music

3

Lessons learned

4

Conclusion

Truchet Unconventional Applications CP2015-DP 8 / 46

slide-11
SLIDE 11

Two examples of unconventional applications

Warnings and credits

The application to music is an extract of my PhD thesis, defended at IRCAM (Institute for Research and Coordination Acoustics / Musique, Paris) in 2004. The work is a collaboration with my PhD advisors, G. Assayag and P . Codognet, and several researchers and musicians from IRCAM. The application to urban planning is a collaboration with Bruno Belin (Université de Nantes, France), Marc Christie (IRISA, France) and Frédéric Benhamou (Université de Nantes, France), between 2011 and 2014.

Truchet Unconventional Applications CP2015-DP 9 / 46

slide-12
SLIDE 12

Two examples of unconventional applications

Warnings and credits

In theses frames are real slides from past presentations (only a few of them): CPAIOR2014 for urban planning, JFPLC 2004 for music.

In blue, I tell you how things really happened.

Truchet Unconventional Applications CP2015-DP 9 / 46

slide-13
SLIDE 13

Two examples of unconventional applications Urban Planning

Evolution of the world city population [United Nations reports] 1995 the urban population in emerging countries is higher than the urban population of industrial countries, 2008 more than 50% of the world population lived in cities, 1/3 in townships, 2025 58% of the world population lives in cities (projection) 2050 67.2% of the world population lives in cities (projection) = ⇒ Huge needs for the development of new cities, mostly in Africa and Asia.

The truth: thanks to Marc, we had a meeting with urban plan- ners he knew. They had problems which seemed interesting, highly combinatorial, and hard.

Truchet Unconventional Applications CP2015-DP 10 / 46

slide-14
SLIDE 14

Two examples of unconventional applications Urban Planning

The SUSTAINS project a national-funded French research project, the project gathers urban planners and computer scientists Areva TA, Armines, Artelys, Artefacto, EPAMarne, LINA, LIMSI, goal : deploy a software suite for designing new cities, taking into account sustainability issues (energetic, social and economic), end-users are urban planners and decision makers. Early stage of urban planning: start with a beetroot field, draw a rough map for the decision makers and the population, used to have first estimations of the needs in big equipments.

It is often easier to get money when working on such applica- tions, because: industrial, and original.

Truchet Unconventional Applications CP2015-DP 11 / 46

slide-15
SLIDE 15

Two examples of unconventional applications Urban Planning

Existing urban models: UrbanSim [Waddell 2002], a land-use model, CommunityViz, a fine grain model for urban planners. We are not interested in fine grain information, pricing issues or time evolution of the future city. We use an ad-hoc urban model proposed by EPAMarne, which need very little information and does not model time evolution. A two stage approach: first step: a urban model calibrates the type of land use of the future city (EPAMarne), second step: a geographical constraint model computes the best possible map of the city.

We started in the blind and had to read a totally new bibliogra-

  • phy. But think about it: I’ve read scientific papers on SimCity.

For work!

Truchet Unconventional Applications CP2015-DP 12 / 46

slide-16
SLIDE 16

Two examples of unconventional applications Urban Planning

What is given: geographic data: area, rivers, landscape, existing elements (highways, historic places...), blocks: a 80m × 80m square, atomic element of the city, urban shapes: type of land use and buildings within a single block, macroscopic informations: intensities, centralities, economic indicators (number of inhabitants, employment rate, public services...).

We spent hours of discussion, on almost two years, to under- stand these urban notions. We never fully understood, but we had reasonable assumptions to start with.

Truchet Unconventional Applications CP2015-DP 13 / 46

slide-17
SLIDE 17

Two examples of unconventional applications Urban Planning

The constraint model is a permutation optimization problem: given data grid representation of the city, geographical informations, variables cells of the grid, domains urban shapes provided by the urban model,

We never had a CSP . We explained to the urban planners what we could do, we made several prototypes (choosing the vari- ables and constraints ourselves), we improved them based on their remarks, and the CSP/model arrived in the end.

Truchet Unconventional Applications CP2015-DP 14 / 46

slide-18
SLIDE 18

Two examples of unconventional applications Urban Planning

Core constraints: Interaction A cell of a given urban shape has location preferences and neighboorhood preferences. Example: shool units are attracted to residential units, and residential units are repelled by industrial units. Industrial units are attracted to rivers and roads. Preferences coefficients: one for each urban shape vs each type of landscape, and one for each urban shape vs each other urban shape.

In discussions with the urban planners, the word "attraction" was often used. So we tried this as our first prototype and it happened to fit the urban planners view.

Truchet Unconventional Applications CP2015-DP 15 / 46

slide-19
SLIDE 19

Two examples of unconventional applications Urban Planning

Higher level constraints Distance Some urban shapes must be placed with a minimum distance, expressed as a number of cells, between them. Example: between an individual house and a high building (R+7), there must be a minimum distance of 4 cells Critical size Some urban shapes must be grouped to have at minimum size (bigger than one cell). Example: highschools must be on at least two blocks. Areas with indus- trial activity must be big enough, otherwise, the area will not be created in practice because it will not be cost-effective.

Once the base model was implemented, we showed some re- sults to the urban planners. At once, they saw situations that could not happen, and we refined the model from their obser- vations.

Truchet Unconventional Applications CP2015-DP 16 / 46

slide-20
SLIDE 20

Two examples of unconventional applications Urban Planning

We got scared when we saw the size ot real-life problems (here, the french city of Marne-la-Vallée that we used as a test- case).

Truchet Unconventional Applications CP2015-DP 17 / 46

slide-21
SLIDE 21

Two examples of unconventional applications Urban Planning

We use a distributed version of Adaptive Search, a local search algorithm in the spirit of Tabu Search [Codognet 2001]. For the distributed version, the map is cut into subareas. We use a master-slave parallel scheme where the slaves can read the whole map, but only work on some subareas. The base iteration becomes: compute the cost of the current configuration (master core), assign a couple of subareas to each slave (master core), select the worst variable within the assigned subareas , select, within the assigned subareas, the best move(s), collect all the possible swaps and select the one(s) to apply (master core).

Since the problem is based on a 2D grid, we used its geo- graphic properties to develop a divide-and-conquer distributed

  • approach. Yet, it was quite a lot of (exciting) work to find a good

parallel scheme.

Truchet Unconventional Applications CP2015-DP 18 / 46

slide-22
SLIDE 22

Two examples of unconventional applications Urban Planning

We were satisfied. But I am pretty sure that the urban planners never understood why the computation time was so big in the first place.

Truchet Unconventional Applications CP2015-DP 19 / 46

slide-23
SLIDE 23

Two examples of unconventional applications Urban Planning

It was mandatory, for this application, to render the solver inter-

  • active. This is the kind of issues that are obviously interesting,

but that no one tackles without being forced to.

Truchet Unconventional Applications CP2015-DP 20 / 46

slide-24
SLIDE 24

Two examples of unconventional applications Urban Planning

The project involved people from HMI, who made a very nice 3D interface and implemented it on a huge tablet.

Truchet Unconventional Applications CP2015-DP 21 / 46

slide-25
SLIDE 25

Two examples of unconventional applications Music

Outline

1

Conventional? Unconventional?

2

Two examples of unconventional applications Urban Planning Music

3

Lessons learned

4

Conclusion

Truchet Unconventional Applications CP2015-DP 22 / 46

slide-26
SLIDE 26

Two examples of unconventional applications Music

Computer Assisted Composition OpenMusic, visual language

I chose my PhD advisor to work on this language, because it’s really beautiful. At this time, we only had a feeling that constraints would be useful.

Truchet Unconventional Applications CP2015-DP 23 / 46

slide-27
SLIDE 27

Two examples of unconventional applications Music

Constraint Programming Constraint Programming

variables constraints third fifth Resolution phase

This is how I explained CP to musicians: it makes sense to use CP in music, because music is often declarative by nature (think about the harmony treaties in classical western music).

Truchet Unconventional Applications CP2015-DP 24 / 46

slide-28
SLIDE 28

Two examples of unconventional applications Music

Constraint Programming Constraint and music, previous works

  • Automatic harmonization: Ebcioglu 87, Tsang Aitken

91, Ballesta 98, Pachet Roy 01

  • MusicSpace (Delerue 04), BOXES (Beurivé,

Desainte-Catherine 01), Mosaïcing (Zils, Pachet 01), Pico (Rueda, Valencia 01)

  • In OpenMusic: PWConstraints (Laurson 96),

Situation (Rueda, Bonnet 90)

There were already several works on musical applications, and since the very beginning of CP . These works were often pub- lished in computer music conferences.

Truchet Unconventional Applications CP2015-DP 25 / 46

slide-29
SLIDE 29

Two examples of unconventional applications Music

Modelling musical CSPs Asynchronous rhythms, Mauro Lanza

  • Variables: rhythmical patterns of fixed, relatively

prime lengths L1 ... Ln

  • Each pattern is played repetitively on one voice
  • Constraints: not two onsets played simultaneously for

a fixed duration D No solution as soon as D >= lcm(Li , Lj) for any i, j

The problem is very quickly unsatisfiable due to the chinese remainder theorem.

Truchet Unconventional Applications CP2015-DP 26 / 46

slide-30
SLIDE 30

Two examples of unconventional applications Music

Modelling musical CSPs Asynchronous rhythms, Mauro Lanza

It naturally becomes an optimization problem where the goal is to minimize the number of simultaneous onsets.

Truchet Unconventional Applications CP2015-DP 27 / 46

slide-31
SLIDE 31

Two examples of unconventional applications Music

Modelling musical CSPs Harmony, Georges Bloch

Georges Bloch is a french composer and musicologist, who was at IRCAM at the time. He was interested in rhythmical canons.

Truchet Unconventional Applications CP2015-DP 28 / 46

slide-32
SLIDE 32

Two examples of unconventional applications Music

Modelling musical CSPs Harmony, Georges Bloch

minimize Distance Estrada (Chi, FixCh) minimize Distance Georges (Virfun (Chi) -Virfun (Chi+1)) FixCh =

Une empreinte sonore de la Fondation Beyeler (for ensemble)

With only the first constraint, there are no non-trivial solutions. Worse than that: the second constraint contradicts the first

  • ne.

Truchet Unconventional Applications CP2015-DP 29 / 46

slide-33
SLIDE 33

Two examples of unconventional applications Music

Results

The problem was obviously unsatisfiable. Georges did not care, he wanted an answer and found this very elegant idea: at the beginning of the piece, play a solution for only constraint 1, and the end of the piece, play a solution for only constraint 2, solve the problem with both constraints 1 and 2, gather the local

  • ptima, and sort them according to their scores on each

constraint. In the end, he obtained a smooth harmonic shift, used in Une empreinte sonore de la Fondation Beyeler, for ensemble, 2001.

Because Georges was unsatisfied with the problem/solution, he used the solver trace (sort of).

Truchet Unconventional Applications CP2015-DP 30 / 46

slide-34
SLIDE 34

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier

  • Musical analysis
  • Music from the Aka pygmies in Central Africa
  • Property identified by Arom 91

Record of pygmy music Extraction of the rhythm

At IRCAM, I met Marc, who worked on mathematical models for natural or cultural phenomena. His book (Les Mathéma- tiques Naturelles) is a must-read. He was working on a math- ematical model for those rhythms.

Truchet Unconventional Applications CP2015-DP 31 / 46

slide-35
SLIDE 35

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier

Fixed number of 2 and 3 groups The circle cannot be cut into two equal parts

The goal is to count all the possible rhythmical patterns with this property. The difficulty is due to the symmetries (rota- tions).

Truchet Unconventional Applications CP2015-DP 32 / 46

slide-36
SLIDE 36

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier

Fixed number of 2 and 3 groups Variables = 2 and 3 groups Domain = permutation Constraint = no partial sum of consecutive variables equals to half of the duration

It is rather easy to obtain a constraint model.

Truchet Unconventional Applications CP2015-DP 33 / 46

slide-37
SLIDE 37

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier with help from Louis Martin Rousseau.

The CSP can be used to count the solutions (a sort of brute- force approach).

Truchet Unconventional Applications CP2015-DP 34 / 46

slide-38
SLIDE 38

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier

Number of such patterns ? Experimentally computed Known if the number of 3 groups is a 2k (Chemillier, Truchet, 2004) All of them effectively played by the Aka

Based on a remark that the "3" groups must face each other on the circle, we could find a generation scheme (Lyndon words) for all the rhythms where there are 2k such groups.

Truchet Unconventional Applications CP2015-DP 35 / 46

slide-39
SLIDE 39

Two examples of unconventional applications Music

Modelling musical CSPs Rhythmical imparity, with Marc Chemillier

n3 n2 Rythmic pattern Lyndon word Ethnic group 2 1 3 3 2 a b Zande 3 3 2 3 2 2 a b b b Aka, Gbaya, Nzakara 5 3 2 2 3 2 2 2 a b b b b b Gbaya, Ngbaka 7 3 2 2 2 3 2 2 2 2 a b b b b b b b 9 3 2 2 2 2 3 2 2 2 2 2 a b b b b b b b b b Aka 4 1 3 3 3 3 2 a a b 3 3 3 2 3 3 2 2 a a b b b 3 3 2 3 2 3 2 a b a b b 5 3 3 2 2 3 3 2 2 2 a a b b b b b 3 3 2 2 3 2 3 2 2 a b a b b b b 3 2 3 2 3 2 3 2 2 a b b a b b b 6 1 3 3 3 3 3 3 2 a a a b 3 3 3 3 2 3 3 3 2 2 a a a b b b 3 3 3 2 3 3 2 3 2 a a b a b b Aka 3 3 3 2 3 2 3 3 2 a a b b a b 3 3 2 3 3 2 3 3 2 a b a b a b

And we could show that most of the not-too-long patterns were indeed played by the different tribes.

Truchet Unconventional Applications CP2015-DP 36 / 46

slide-40
SLIDE 40

Two examples of unconventional applications Music

Constraint for musical analysis

Still in collaboration with Marc Chemillier, I have worked on two other problems in musical analysis: harmonic textures in Ligeti’s works (such as Continuum or Melodien, patterns of the Nzakara harp (Central Africa). Starting from a musical analysis, expressed as constraints, we can count the number of solutions experimentally. If there are not too many solutions, and if all of them are actually in the music, then the analysis is probably relevant.

Notice that we don’t care about the solving time (it only needs to be reasonable), the first solution, etc.

Truchet Unconventional Applications CP2015-DP 37 / 46

slide-41
SLIDE 41

Two examples of unconventional applications Music

Conclusion on music

The users (musicians) always added constraints until the problem became unsatisfiable, they were not interested in getting a solution, rather in having a variety of solutions (possibly approximate), most of the time, the CSP framework could not capture all the features of the problem. The solutions needed to be corrected by hand, according to musical criteria.

Truchet Unconventional Applications CP2015-DP 38 / 46

slide-42
SLIDE 42

Lessons learned

Outline

1

Conventional? Unconventional?

2

Two examples of unconventional applications

3

Lessons learned

4

Conclusion

Truchet Unconventional Applications CP2015-DP 39 / 46

slide-43
SLIDE 43

Lessons learned

Lesson 0: randomness is the key

CP can be applied to lots of problems in lots of disciplins. But these applications usually come from a meeting between a CPer and an expert from another field. Why not try and provoke these meetings? go to conferences outside of your area of expertise (always interesting), ask questions, explain what you do as often as you can.

Truchet Unconventional Applications CP2015-DP 40 / 46

slide-44
SLIDE 44

Lessons learned

Lesson 1: it takes a lot of time

Each application comes with its own goal, which may not be simply solving a CSP . A collaboration with non-computer scientists is a long way to go. take the time you need to learn about the new field, read, drink beers, discuss. tell the expert everything about what you do. Maybe he’ll be interested in something you did not foresee. depending on the needs, don’t hesitate to add other methods than pure CP in your code (visualization, data analysis, HMI, etc). You are capable of more than you think!

Truchet Unconventional Applications CP2015-DP 41 / 46

slide-45
SLIDE 45

Lessons learned

Lesson 2: there will never be a model

We are used to see applications based on very clean problems, where everything is known from the start, all the variables are of the same nature, all the constraints apply similarly to the variables, etc. This is not the real world. If the expert is really far from CP , don’t wait for a model - you will never get one. Try and understand his/her goal. Make a prototype, and use it as a basis for your discussions.

Truchet Unconventional Applications CP2015-DP 42 / 46

slide-46
SLIDE 46

Lessons learned

Lesson 3: you will not publish

At least, not in CP conferences or journals. This is the sad truth. remember that it is still possible to publish elsewhere. For instance, the scientific community of your expert may be interested in the application. don’t make your weird applications your only research work. check next year CP special tracks!

Truchet Unconventional Applications CP2015-DP 43 / 46

slide-47
SLIDE 47

Lessons learned

Lesson 4: you will get a reward, probably not the one you expected

Think about how it feels to be part of a work that will help a create new cities, from scratch. And I’ve made a book (Constraint Programming in Music, with G. Assayag). Pascal Van Hentenryck et al. save lives! Unconventional applications are exciting.

Truchet Unconventional Applications CP2015-DP 44 / 46

slide-48
SLIDE 48

Lessons learned

Lesson 4: you will get a reward, probably not the one you expected

Think about how it feels to be part of a work that will help a create new cities, from scratch. And I’ve made a book (Constraint Programming in Music, with G. Assayag). Pascal Van Hentenryck et al. save lives! Unconventional applications are exciting. More than that, it is really important that CP gets known for all its

  • strengths. By exploring new applications fields, you can help it.

Truchet Unconventional Applications CP2015-DP 44 / 46

slide-49
SLIDE 49

Conclusion

Outline

1

Conventional? Unconventional?

2

Two examples of unconventional applications

3

Lessons learned

4

Conclusion

Truchet Unconventional Applications CP2015-DP 45 / 46

slide-50
SLIDE 50

Conclusion

Conclusion

Give it a try! CP is a good technology for plenty of reasons, and it should be better recognized than it actually is. Keep this in mind, and take all the occasions you can to expand the CP application spectrum! But don’t get trapped. Working only on unconventional applications will not get you a PhD. Do it, if you have an occasion, as a side project.

Truchet Unconventional Applications CP2015-DP 46 / 46