I'm tackeling an advanced optimization problem but I could really use some help from you guys!

The problem is:

In the European car industry, production on (individual) demand is a common practice. As a consequence, cars of different types and colors are produced assorted, which can lead to high set-up costs in the factory. Suppose you are responsible for the coloring of the cars and your boss challenges you to improve efficiency. You are eager to perform well and immediately start to study the current process. You find out that the cars arrive in a certain order, and the different car types can occur at different positions in the sequence. There is no way you can influence this sequence. Further, for each car type, it is given how many cars you need to produce from each color. You conclude that the only way you can improve the process is by optimizing the color switches; indeed, less color switches mean less setup costs. Thus, your job is to decide which car in the sequence is colored in which color, such that the number of times a color switch is needed, is minimized, while demand is satisfied.

An example would be:

You are given a sequence of 10 cars, of two different types that need to be colored in three different colors. The demand for each type and each color is given in the table. The arrival sequence is [0 1 1 0 0 1 0 0 1 1].

Car type blue grey white
0 2 1 2
1 2 2 1

A feasible solution is then to start with the color grey, after three cars switch to color white for the next three cars, and finally turn to blue for the last 4 cars. You will have switched colors twice; this clearly is an optimal solution.

My problem has got 1000 cars, 10 different types, that can be coloured in 10 diffirent colours.

I hope someone can help me getting started!

Thanking you in advance,