Search code examples
python-3.5scip

update RHS on a constraint in scip using python


Are there any good solutions for updating the rhs of a constraint? Preferably I would like to do something like:

    import pyscipopt as scp
    Mod=scp.Model()
    x=Mod.addVar(ub=3,name="x")
    y=Mod.addVar(ub=4,name="y")
    c=Mod.addCons(x+y<=2,"C1")
    Mod.setObjective(0.5*x+0.3*y, "maximize")
    Mod.optimize()
    print(Mod.getObjVal())
    c.updateRHS(4) # This function does not exist..
    Mod.optimize()
    print(Mod.getObjVal())

Solution

  • This is fixed in the latest version of PySCIPOpt (see https://github.com/SCIP-Interfaces/PySCIPOpt/pull/70)

    The methods are called chgLhs() and chgRhs(). Keep in mind that they are only going to work for linear and quadratic constraints for now.