ILP Part 48 — Shapes and colors

This is the forty eighth part of the ILP series. For your convenience you can find other parts in the table of contents in Part 1 – Boolean algebra

You are given board with thirty rows and fifteen columns. For each cell you need to assign a shape with color. You are given the following shapes and collors:

    \[ \begin{array}{ccccc} Shape & Green & Blue & Red & Yellow \\ \hline \\ Circle & 50 & 30 & 30 & 15\\ Square & 20 & 20 & 25 & 20 \\ Triangle & 40 & 30 & 30 & 5\\ Rectangle & 15 & 60 & 20 & 40 \\ \hline  \end{array} \]

You are given two more requirements. For two neighboring columns you can change at most ten shapes, i.e., if you have 20 squares and 10 triangles in first column, you can have 15 squares, 10 triangles, 2 circles and 3 rectangles in second one. But you cannot have 10 squares and 20 triangles.

Also, you can change color after at least three consecutive cells in column-wise order. It means that if you have green in row 0 column 0, row 1 column 0 and row 2 column 0 must have the same color. The order includes following columns so you change color in last cell of column 3, two first cells of column 4 must have the same color.

This is the solution:

And solution: