Skip to content

Commit

Permalink
Adding test to verify this branch resolves #637
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Jun 25, 2019
1 parent 9db7022 commit 6f2537e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pyomo/core/tests/unit/test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# ___________________________________________________________________________

import copy
import itertools
import logging
import pickle
from six import StringIO
Expand Down Expand Up @@ -4996,3 +4997,16 @@ def _test(b, x, y, z):
self.assertEqual(len(m.test), 1)
m.test2 = Block(m.set_mult, m.s3, rule=_test)
self.assertEqual(len(m.test2), 1)

def test_issue_637(self):
constraints = {
c for c in itertools.product(['constrA', 'constrB'], range(5))
}
vars = {
v for v in itertools.product(['var1', 'var2', 'var3'], range(5))
}
matrix_coefficients = {m for m in itertools.product(constraints, vars)}
m = ConcreteModel()
m.IDX = Set(initialize=matrix_coefficients)
m.Matrix = Param(m.IDX, default=0)
self.assertEqual(len(m.Matrix), 2*5*3*5)

0 comments on commit 6f2537e

Please sign in to comment.