help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Chess Problem


From: Andrew Makhorin
Subject: Re: [Help-glpk] Chess Problem
Date: Sat, 11 Apr 2009 07:03:04 +0300

> 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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]