Skip to content

Cannot add solution when using addConsIndicator #717

Open
@skyu0221

Description

@skyu0221

It might be my implementation error, but whenever I have indicator constraints, the constraints seem always needs to be satisfied regardless of the value of the binary variable. Minimum example:

from pyscipopt import Model

if __name__ == "__main__":
    m = Model()
    control = m.addVar(vtype='B')
    v = m.addVar(vtype='C', lb=1, ub=3)
    m.addConsIndicator(v <= 2, control)

    m.setObjective(v, "maximize")

    sol = m.createSol(None)
    m.setSolVal(sol, v, 3)
    m.setSolVal(sol, control, 0)
    m.addSol(sol)
    m.optimize()

    sol = m.getBestSol()
    print(sol[v])
    print(sol[control])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions