Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
ctdunc committed Apr 15, 2024
commit 3b6b372ba2b415e871a63dcb874a879336e1d49d
24 changes: 24 additions & 0 deletions tests/test_decomp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from pyscipopt import Model, Decomposition, quicksum
import pytest


def test_consLabels():
m = Model()
a = m.addVar("C", lb = 0)
b = m.addVar("C", lb = 0)
c = m.addVar("M", lb = 0)
d = m.addVar("C", lb = 0)

cons_1 = m.addCons( a + b <= 5)
cons_2a = m.addCons( c**2 + d**2 <= 8)
cons_2b = m.addCons( c == d )
decomp = Decomposition()
decomp.setConsLabels({cons_1: 1, cons_2a: 2, cons_2b: 2})

m.addDecomposition(decomp)
o = m.addVar("C")
m.addCons( o <= a + b + c + d)
m.setObjective("o", "minimize")
m.optimize()

test_consLabels()