Optimal covering of 2D matrix elements given spatial constraints
Yes, this can be expressed as an instance of integer linear programming and then solved with an ILP solver.  I don't know if there's a better way (for instance, I don't know if the problem is NP-complete).

We'll define zero-or-one variables $x_{i,j}$ and $y_{i,j}$, with the intention that $x_{i,j}=1$ means that cell $(i,j)$ of the matrix is marked and $y_{i,j}=1$ means that cell $(i,j)$ is covered.  Let $A$ denote the matrix.  Then we have constraints to ensure that all 1's in the matrix are covered: $y_{i,j} \ge 1$ for all $i,j$ such that $A_{i,j} = 1$.  Also, we have constraints to ensure that the $x$'s and $y$'s are related appropriately:

$$y_{i,j} \ge x_{i,j} \qquad y_{i,j} \ge x_{i-1,j} \qquad y_{i,j} \ge x_{i+1,j}$$

$$y_{i,j} \le x_{i-1,j} + x_{i,j} + x_{i+1,j}$$

To impose the requirement that at most $N/2$ cells are marked in each row, add the constraints

$$\sum_j x_{i,j} \le N/2.$$

Finally, notice that $y_{i,j}-x_{i,j}$  is $1$ if cell $(i,j)$ is covered but not marked, and $0$ otherwise.  Therefore, the objective function is:

$$\sum_{i,j} y_{i,j}-x_{i,j}$$

Now feed this to an ILP solver, and let it do what it can to try to solve it.