0

I'm implementing on Xpress a problem with different solution proposed on a paper. The idea is to decompose a matrix X into a convex sum of 0 1 matrices. Among the constraints of the problem, the previous one can be written as:

equations = []
for i in agents:
    for j in objects:
        equation = xp.Dot(M[i,j,:], weights)  == X[i,j] 
        equations.append(equation)
agents_assining.addConstraint(equations)

where agents_assinig is the problem I'm trying to resolve and X is a given matrix. The code gives the error:

?864 Error: Quadratic constraint rows must be of type 'L' or 'G'. Wrong row type for row R112.

and I'm not sure how to deal with it. Important note: my license for xpress is not full, it is just the the community one.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22
Davide Trono
  • 99
  • 1
  • 1
  • 8

1 Answers1

1

For the Xpress linear and MIP solver, a quadratic constraint must be convex. Equality constraint are not convex, that is why you get this error.

As of version 9.0 Xpress now has a global solver that also supports quadratic equality constraints. You can install or upgrade via pip. In order to use the global solver do something like this:

import xpress as xp

x = xp.var()
y = xp.var()

p = xp.problem()
p.addVariable(x, y)
p.addConstraint(x * y == 0)

p.optimize('x')

Please also read the documentation for the global solver and see the documentation to understand how to query results etc.

Daniel Junglas
  • 5,830
  • 1
  • 5
  • 22
  • I'm afraid that optimize is not an attribute in xpress, maybe you are referring to gurobi? – Davide Trono Dec 14 '22 at 20:53
  • Nope, not at all. It *is* an attribute, I tested this before posting. But it was only introduced in 9.0 (as I said in my answer), so you need to make sure to have that version. Maybe try something like `pip uninstall xpress` and then `pip install xpress`. If this does not work then maybe create a new question and show the offending code. – Daniel Junglas Dec 16 '22 at 07:41