> Does anyone know how to write a function to sum the diagonals of a matrix in
> glpk? It is simple to sum the rows or columns* but I cannot figure out how
> to write it for diagonals.

> *sum{i in xxx} y[i,j]

> For anyone interested, this code needs to provide the solution for the
> maximum number of bishops on a chess board without any bishop being under
> attach. The matrix will consist of 0's for empty spaces on the board and 1's
> where a space is occupied by a bishop. So the sum of both diagonals in which
> a bishop lies must be 1. Any advice would be much appreciated.

You may look at the example model examples/queens.mod, included in the
glpk distribution.




_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to