0

I'm loading MPS files into SCIP via pyscipopt. I would like to convert the constraints to standard form so that I can get a consistent tableau (via getLPBInvRow). I'm unsure on how to negate existing constraints. I was picturing something like this:

def standardize(m: scip.Model):
    for c in m.getConss():
        if not m.isInfinity(m.getRhs(c)):
            m.addCons(-c)
            m.delCons(c)

-c doesn't work, though. What is the right way to do this?

Brannon
  • 5,324
  • 4
  • 35
  • 83

1 Answers1

0

I think that while PySCIPOpt allows you to add constraints using expressions, it currently will not give you an expression when asking for a constraint (although a method that does this seems like it could be quite useful in the future).

So I think you are stuck with querying all the variables+coefficients and adding them negated to your new constraint in a good old-fashioned loop

PySCIPOpt experts can correct me if the functionality to get an expression from an existing constraint exists.

Leon
  • 1,588
  • 1
  • 7
  • 16