On Wed, 2020-09-09 at 18:17 -0300, yami...@cock.li wrote: > Hey, > > I'm trying to make a program that populates a binary matrix keeping > as > many blank lines as possible, e.g. > > > 00| > > 11| > > 10| > > instead of > > > 10| > > 10| > > 10| > > > Since I know the sum of the lines won't be too big I decided to use > an > approach based on division, but I'm getting a "operand following / > has > invalid type" error. > > /* binary matrix */ > var m{x in X, y in Y} binary; > /* minimizes total (sum of line)^-1, a full line is better than two > half-full lines*/ > minimize maxEmpty: sum{x in X} 1/(1 + sum{y in Y} m[x,y]); > > I made a few tests and some constraints, I'm pretty sure it's not a > problem with the sets, the matrix, or a typo. > If I had to guess I'd say the error is being caused by the nested > sums, > but I couldn't find much on that. > > Can this be fixed in any way? > Thanks. > >
In constraints and objectives you can divide only by a constant expression. In your case you divide by a linear form that leads to a non-linear objective function, which is not allowed. Probably you need to reformulate your model.