| Tim,
Let's deal with the static version first.
Given any tile we can split it up into n tiles of unit height without
changing the cost. So without loss of generality, all the tiles in the
optimum solution have unit height. So we can reduce the problem to
considering a single row.
If a row contains a black square, then we cannot tile that square, and
the row becomes split into two subrows, we are considered separately.
Otherwise, a row may contain 1 or more essential squares (either
red or supporting a red above). If there is just one, we tile just that
1 square. If there is more than one essential square, we tile the entire
row (might as well).
If a subrow contains 0 essential squares, we don't tile it.
That's the static version solved.
--------------------------------------------------------------------------------
Before tackling the dynamic version, can you tell me:
(1) are happy with this solution to the static version?
(2) in the dynamic version, can a new row contain a black tile?
(3) when a new row is placed, may I only lay I tile?
Thanks,
Andrew.
|
| Damn. You've made it clear I left out a cost. Sorry.
Each tile in a red square's support also costs one. If a red square is
supported by more than one set of tiles, you're free to count only the
minimum-cost support. (But in the dynamic version, you must decide what
support to use at the time you create support for the new red square.)
To answer your questions, a new row may indeed contain a black square,
and yes, you're free to add more than one tile at each step.
|
| Well, I've now done the simulation, and found not only another bug in
the specification of the problem, but found a solution that (in
practice) works so well there's no need to look for an optimal
solution.
The bug in the specification was that the support of every red square
must stop at the top of the red square. (That is, the top tile
supporting a red square must cannot extend above the red square.)
This constraint comes from the dynamic form of the actual problem, in
which you can't put down a tile that extends above the current top of
the board. That eliminates the example you used to pose your question.
The answer to the question is that you must count a tile each time it
is used as a support.
The solution that works in practice is to separate ranges that have
lots of black squares from ranges that have none (or almost none) after
the initial one. In ranges with lots of new black squares, tile with
unit-width columns. In ranges with rare black squares, make each tile
the width of the whole range.
Thanks for giving it your attention.
Tim
|