3.7.188. Producer-consumer

A constraint that can be used for modelling problems where a first set of tasks produces a non -renewable resource, while a second set of tasks consumes this resource so that a limit on the minimum or the maximum stock at each instant is imposed.

PartsΒ (A) andΒ (B) of FigureΒ 3.7.42 describes the simplest variant of the producer -consumer problemΒ [SimonisCornelissens95] where no negative stock is allowed. Given an initial stock, a first set of tasks (i.e.,Β producers) add instantaneously their respective production to the stock (when they are finished), and a second set of tasks (i.e.,Β consumers) take instantaneously from the stock (when they start) the amount of non -renewable resource they need. The problem is to schedule these tasks (i.e.,Β fix the end of the producers and fix the start of the consumers) and to fix for each task the quantity it produces or consumes, so that no negative stock occurs. PartΒ (A) of FigureΒ 3.7.42 describes an instance of such problem where we respectively have 2 producers and 3 consumers. PartΒ (B) depicts the corresponding cumulative view of the problem. At each timepoint the difference between the top line and the top of the cumulated profile gives the amount of available stock at that timepoint.

Figure 3.7.42. Producer -consumer models (A,C) and corresponding πšŒπšžπš–πšžπš•πšŠπšπš’πšŸπšŽ views (B,D)
ctrs/producer_consumer

A fundamental problem with the previous variant of the producer -consumer problem is that it does not allow to handle the fact that a resource is produced or used gradually. PartsΒ (C) andΒ (D) of FigureΒ 3.7.42 describes a second variant where this is in fact possible. This is achieved by replacing the rectangle associated with a producer by a task with a decreasing height. At a given instant the cumulated quantity produced by a producer is the difference between the height of that task at its starting time and the height of that task at the considered instant. Conversely a consumer is modelled by a task with an increasing height. At a particular timepoint the cumulated quantity used by a consumer task is the difference between the height of that task at its end and the height of that task at the considered instant. PartΒ (C) of FigureΒ 3.7.42 describes an instance of such problem where, again, we respectively have 2 producers and 3 consumers. PartΒ (D) depicts the corresponding cumulative view of the problem. As before, at each timepoint the difference between the top line and the top of the cumulated profile gives the amount of available stock at that timepoint.