Algorithm Round 2

The Algorithm invitational highlights the pure skill of an individual's ability to solve a problem.

Tutorial
Tutorial

Simulator Operation

Here's how the simulator works, and what your algorithm must do:

Input: an NxN matrix representing an area of the earth's atmosphere, separated into cells. Each cell has an initial temperature between 20 and 30 (degrees celsius).

You are given F movable carbon farms, which remove CO2 from the atmosphere. The Farms remove the carbon from the cell they are in, as well as any cells “upwind” in gentle advection currents, or breezes – the kind produced between two neighboring cells whose difference in temperature is exactly 1 degree.

The simulation takes place over the course of T weeks.

For each time t <= T:

  • For t = 1, you place your F farms at coordinates of your choosing. for t > 1, you can move each Farm up to DF distance away in either or both dimensions. For example, if DF was 1, you could move it to any of the 8 squares surrounding the current square horizonally, vertically, or diagonally). More than 1 farm can be in a given cell.

  • Farms are able to extract CO2 in the cell they are in, as well as any adjacent cells whose temperature is 1 degree higher, and any cells adjacent to those with temperatures 1 degree higher than that, etc, due to advection air currents from the hotter cell to the cooler one. Here "adjacent" means with a common vertical and horizontal border - not cells which are diagonal to each other.

  • For all cells whose CO2 is extracted, the temperature drops 1 degree C, with a minimum of 20 C.

  • Continuing temperature fluctuations and man-made CO2 emissions change the temperatures of the cells in the matrix. A number (NC) of cool spots cool the cells they are in by 1 degree; and even greater number (NH) of hotspots add 1 degree of heat to cells they are in. The positions of these cool and hot spots are initially chosen randomly, and therafter can move up to DW distance in each or both dimensions randomly each turn. It is possible for two cool/hot spots to be in the same cell. The net result of applying Cool spots and Hot spots to a cell will never decrease its temperature below 20, or raise it over 40.

Note: With a sophisticated GCM, you are able to predict the movement of the cool and hot spots for all weeks turns in advance. This “lookahead” into cool/hot spot movement is supplied to you each turn.

Here is what the matrix might look like at a time t.

 

It is important that your algorithm work on any matrix. A number of randomly-generated practice matrices have been provided; however, the final test will use a different set of randomly-generated matrices (which will not be known in advance). Any algorithm which fails to work on any matrix will be eliminated from consideration.

Your algorithm must be supplied in the form of a .NET 2.0 assembly which exposes a "PlaceFarms" method. This method will be called repeatedly to obtain the farm positions for each step of the simulation. See the SDK documentation for more information on creating your submission.