We have a checkerboard and a number of pieces form by squares of dimension 1 to put in the checkerboard. The pieces can not overlap and they can not be rotated. The objective is to find, from all the possible configurations of the pieces in the checkerboard, the minimum number of positions without cover.
The checkerboard is square, and each piece is given with the number of single squares which constitute the piece, a reference square and the movements (rows and columns) to access from the reference square to the other squares in the piece. For example, the pieces
are
represented:
3 1 0 1 -1
(three squares, the second square 1 row below and in the same column as the reference square, and the third square 1 row below and 1 column to the left), and
4 0 1 1 0 1 1
A number of problems is solved. For each problem the function to parallelize has:
Input parameters:
-int n: the size of the checkerboard (size nxn)
-int p: the number of pieces
-int **pieces: a structure to store the description of the pieces. Each pieces[i] is a vector for the i-th piece. If the piece has s squares, pieces[i] has 2*s-1 components, with the size of the piece in the first position, and the rest of the components in pieces[i] are the movements to access the other squares in the piece. In the example, pieces is a pointer to a vector of tho pointers, with pieces[0]=(3,1,0,1,-1) and pieces[1]=(4,0,1,1,0,1,1).
Parallelism parameters:
-int node: the number of the MPI process
-int np: the total number of MPI processes
Return:
-int minimum: the number of positions in the checkerboard which are not covered by the configuration which gives the maximum number of positions covered.