本文整理汇总了Python中pyomo.environ.ConcreteModel.s方法的典型用法代码示例。如果您正苦于以下问题:Python ConcreteModel.s方法的具体用法?Python ConcreteModel.s怎么用?Python ConcreteModel.s使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyomo.environ.ConcreteModel
的用法示例。
在下文中一共展示了ConcreteModel.s方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reclassification
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_reclassification(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.x, m.t)
m.dv = DerivativeVar(m.v)
m.dv2 = DerivativeVar(m.v2, wrt=(m.t, m.t))
m.dv3 = DerivativeVar(m.v3, wrt=m.x)
TransformationFactory('dae.finite_difference').apply_to(m, wrt=m.t)
self.assertTrue(m.dv.type() is Var)
self.assertTrue(m.dv2.type() is Var)
self.assertTrue(m.dv.is_fully_discretized())
self.assertTrue(m.dv2.is_fully_discretized())
self.assertTrue(m.dv3.type() is DerivativeVar)
self.assertFalse(m.dv3.is_fully_discretized())
TransformationFactory('dae.collocation').apply_to(m, wrt=m.x)
self.assertTrue(m.dv3.type() is Var)
self.assertTrue(m.dv3.is_fully_discretized())
示例2: build_model
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def build_model(self):
m = ConcreteModel()
m.v1 = Var(initialize=1, bounds=(1, 8))
m.v2 = Var(initialize=2, bounds=(0, 3))
m.v3 = Var(initialize=3, bounds=(-7, 4))
m.v4 = Var(initialize=4, bounds=(2, 6))
m.c1 = Constraint(expr=m.v1 == m.v2)
m.c2 = Constraint(expr=m.v2 == m.v3)
m.c3 = Constraint(expr=m.v3 == m.v4)
m.v2.fix()
m.s = RangeSet(5)
m.x = Var(m.s, initialize=5)
m.c = Constraint(m.s)
m.c.add(1, expr=m.x[1] == m.x[3])
m.c.add(2, expr=m.x[2] == m.x[4])
m.c.add(3, expr=m.x[2] == m.x[3])
m.c.add(4, expr=m.x[1] == 1)
m.c.add(5, expr=(2, m.x[5], 3))
m.y = Var([1, 2], initialize={1: 3, 2: 4})
m.c_too = Constraint(expr=m.y[1] == m.y[2])
m.z1 = Var()
m.z2 = Var()
m.ignore_me = Constraint(expr=m.y[1] + m.z1 + m.z2 <= 0)
m.ignore_me_too = Constraint(expr=m.y[1] * m.y[2] == 0)
m.multiple = Constraint(expr=m.y[1] == 2 * m.y[2])
return m
示例3: test_fixed_var_out_of_bounds_ub
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_fixed_var_out_of_bounds_ub(self):
m = ConcreteModel()
m.s = RangeSet(2)
m.v = Var(m.s, bounds=(0, 5))
m.c = ConstraintList()
m.c.add(expr=m.v[1] == m.v[2])
m.c.add(expr=m.v[1] == 6)
with self.assertRaises(ValueError):
TransformationFactory('contrib.aggregate_vars').apply_to(m)
示例4: test_reclassification_collocation
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_reclassification_collocation(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.t, m.x)
def _int1(m, t):
return m.v[t]
m.int1 = Integral(m.t, rule=_int1)
def _int2(m, s, t):
return m.v2[s, t]
m.int2 = Integral(m.s, m.t, wrt=m.t, rule=_int2)
def _int3(m, t, x):
return m.v3[t, x]
m.int3 = Integral(m.t, m.x, wrt=m.t, rule=_int3)
def _int4(m, x):
return m.int3[x]
m.int4 = Integral(m.x, wrt=m.x, rule=_int4)
self.assertFalse(m.int1.is_fully_discretized())
self.assertFalse(m.int2.is_fully_discretized())
self.assertFalse(m.int3.is_fully_discretized())
self.assertFalse(m.int4.is_fully_discretized())
TransformationFactory('dae.collocation').apply_to(m, wrt=m.t)
self.assertTrue(m.int1.is_fully_discretized())
self.assertTrue(m.int2.is_fully_discretized())
self.assertFalse(m.int3.is_fully_discretized())
self.assertFalse(m.int4.is_fully_discretized())
self.assertTrue(m.int1.type() is Integral)
self.assertTrue(m.int2.type() is Integral)
self.assertTrue(m.int3.type() is Integral)
self.assertTrue(m.int4.type() is Integral)
TransformationFactory('dae.collocation').apply_to(m, wrt=m.x)
self.assertTrue(m.int3.is_fully_discretized())
self.assertTrue(m.int4.is_fully_discretized())
self.assertTrue(m.int1.type() is Expression)
self.assertTrue(m.int2.type() is Expression)
self.assertTrue(m.int3.type() is Expression)
self.assertTrue(m.int4.type() is Expression)
示例5: test_invalid
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_invalid(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.x, m.t)
m.y = Var()
# Not passing a Var as the first positional argument
with self.assertRaises(DAE_Error):
m.ds = DerivativeVar(m.s)
# Specifying both option aliases
with self.assertRaises(TypeError):
m.dv = DerivativeVar(m.v, wrt=m.t, withrespectto=m.t)
# Passing in Var not indexed by a ContinuousSet
with self.assertRaises(DAE_Error):
m.dy = DerivativeVar(m.y)
# Not specifying 'wrt' when Var indexed by multiple ContinuousSets
with self.assertRaises(DAE_Error):
m.dv3 = DerivativeVar(m.v3)
# 'wrt' is not a ContinuousSet
with self.assertRaises(DAE_Error):
m.dv2 = DerivativeVar(m.v2, wrt=m.s)
with self.assertRaises(DAE_Error):
m.dv2 = DerivativeVar(m.v2, wrt=(m.t, m.s))
# Specified ContinuousSet does not index the Var
with self.assertRaises(DAE_Error):
m.dv = DerivativeVar(m.v, wrt=m.x)
with self.assertRaises(DAE_Error):
m.dv2 = DerivativeVar(m.v2, wrt=[m.t, m.x])
# Declaring the same derivative twice
m.dvdt = DerivativeVar(m.v)
with self.assertRaises(DAE_Error):
m.dvdt2 = DerivativeVar(m.v)
m.dv2dt = DerivativeVar(m.v2, wrt=m.t)
with self.assertRaises(DAE_Error):
m.dv2dt2 = DerivativeVar(m.v2, wrt=m.t)
m.dv3 = DerivativeVar(m.v3, wrt=(m.x, m.x))
with self.assertRaises(DAE_Error):
m.dv4 = DerivativeVar(m.v3, wrt=(m.x, m.x))
示例6: test_var_bound_propagate
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_var_bound_propagate(self):
"""Test for transitivity in a variable equality set."""
m = ConcreteModel()
m.v1 = Var(initialize=1, bounds=(1, 3))
m.v2 = Var(initialize=2, bounds=(0, 8))
m.v3 = Var(initialize=3, bounds=(2, 4))
m.v4 = Var(initialize=4, bounds=(0, 5))
m.c1 = Constraint(expr=m.v1 == m.v2)
m.c2 = Constraint(expr=m.v2 == m.v3)
m.c3 = Constraint(expr=m.v3 == m.v4)
m.s = RangeSet(4)
m.x = Var(m.s, initialize=5)
m.x[2].setlb(-1)
m.c = Constraint(m.s)
m.c.add(1, expr=m.x[1] == m.x[3])
m.c.add(2, expr=m.x[2] == m.x[4])
m.c.add(3, expr=m.x[2] == m.x[3])
m.c.add(4, expr=m.x[1] == 1)
m.y = Var([1, 2], initialize=3)
m.y[1].setub(3)
m.y[2].setub(15)
m.c_too = Constraint(expr=m.y[1] == m.y[2])
m.z1 = Var(bounds=(1, 2))
m.z2 = Var(bounds=(3, 4))
m.ignore_me = Constraint(expr=m.y[1] + m.z1 + m.z2 <= 0)
TransformationFactory('contrib.propagate_eq_var_bounds').apply_to(m)
self.assertEquals(value(m.v1.lb), 2)
self.assertEquals(value(m.v1.lb), value(m.v2.lb))
self.assertEquals(value(m.v1.lb), value(m.v3.lb))
self.assertEquals(value(m.v1.lb), value(m.v4.lb))
self.assertEquals(value(m.v1.ub), 3)
self.assertEquals(value(m.v1.ub), value(m.v2.ub))
self.assertEquals(value(m.v1.ub), value(m.v3.ub))
self.assertEquals(value(m.v1.ub), value(m.v4.ub))
for i in m.s:
self.assertEquals(value(m.x[i].lb), -1)
self.assertEquals(value(m.y[1].ub), 3)
self.assertEquals(value(m.y[2].ub), 3)
self.assertEquals(value(m.y[1].lb), None)
self.assertEquals(value(m.y[1].lb), None)
self.assertEquals(value(m.z1.ub), 2)
self.assertEquals(value(m.z2.ub), 4)
self.assertEquals(value(m.z1.lb), 1)
self.assertEquals(value(m.z2.lb), 3)
示例7: test_fixed_var_propagate
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_fixed_var_propagate(self):
"""Test for transitivity in a variable equality set."""
m = ConcreteModel()
m.v1 = Var(initialize=1)
m.v2 = Var(initialize=2)
m.v3 = Var(initialize=3)
m.v4 = Var(initialize=4)
m.c1 = Constraint(expr=m.v1 == m.v2)
m.c2 = Constraint(expr=m.v2 == m.v3)
m.c3 = Constraint(expr=m.v3 == m.v4)
m.v2.fix()
m.s = RangeSet(4)
m.x = Var(m.s, initialize=5)
m.c = Constraint(m.s)
m.c.add(1, expr=m.x[1] == m.x[3])
m.c.add(2, expr=m.x[2] == m.x[4])
m.c.add(3, expr=m.x[2] == m.x[3])
m.c.add(4, expr=m.x[1] == 1)
m.y = Var([1, 2], initialize=3)
m.c_too = Constraint(expr=m.y[1] == m.y[2])
m.z1 = Var()
m.z2 = Var()
m.ignore_me = Constraint(expr=m.y[1] + m.z1 + m.z2 <= 0)
TransformationFactory('contrib.propagate_fixed_vars').apply_to(m)
self.assertTrue(m.v1.fixed)
self.assertTrue(m.v2.fixed)
self.assertTrue(m.v3.fixed)
self.assertTrue(m.v4.fixed)
self.assertEquals(value(m.v4), 2)
self.assertTrue(m.x[1].fixed)
self.assertTrue(m.x[2].fixed)
self.assertTrue(m.x[3].fixed)
self.assertTrue(m.x[4].fixed)
self.assertEquals(value(m.x[4]), 1)
self.assertFalse(m.y[1].fixed)
self.assertFalse(m.y[2].fixed)
self.assertFalse(m.z1.fixed)
self.assertFalse(m.z2.fixed)
示例8: test_non_supported_single_index
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_non_supported_single_index(self):
# Can't simulate a model with no ContinuousSet
m = ConcreteModel()
with self.assertRaises(DAE_Error):
Simulator(m)
# Can't simulate a model with multiple ContinuousSets
m = ConcreteModel()
m.s = ContinuousSet(bounds=(0, 10))
m.t = ContinuousSet(bounds=(0, 5))
with self.assertRaises(DAE_Error):
Simulator(m)
# Can't simulate a model with no Derivatives
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 10))
with self.assertRaises(DAE_Error):
Simulator(m)
# Can't simulate a model with multiple RHS for a derivative
m = self.m
def _diffeq(m, t):
return m.dv[t] == m.v[t]**2 + m.v[t]
m.con1 = Constraint(m.t, rule=_diffeq)
m.con2 = Constraint(m.t, rule=_diffeq)
with self.assertRaises(DAE_Error):
Simulator(m)
m.del_component('con1')
m.del_component('con2')
# Can't simulate a model with multiple derivatives in an
# equation
m = self.m
def _diffeq(m, t):
return m.dv[t] == m.dv[t] + m.v[t]**2
m.con1 = Constraint(m.t, rule=_diffeq)
with self.assertRaises(DAE_Error):
Simulator(m)
m.del_component('con1')
示例9: test_invalid_declaration
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_invalid_declaration(self):
model = ConcreteModel()
model.s = Set(initialize=[1, 2, 3])
with self.assertRaises(TypeError):
model.t = ContinuousSet(model.s, bounds=(0, 1))
with self.assertRaises(ValueError):
model.t = ContinuousSet(bounds=(0, 0))
with self.assertRaises(ValueError):
model.t = ContinuousSet(initialize=[1])
with self.assertRaises(ValueError):
model.t = ContinuousSet(bounds=(None, 1))
with self.assertRaises(ValueError):
model.t = ContinuousSet(bounds=(0, None))
with self.assertRaises(ValueError):
model.t = ContinuousSet(initialize=[(1, 2), (3, 4)])
with self.assertRaises(ValueError):
model.t = ContinuousSet(initialize=['foo', 'bar'])
示例10: test_valid
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_valid(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set()
m.v = Var(m.t)
m.dv = DerivativeVar(m.v)
m.dv2 = DerivativeVar(m.v, wrt=(m.t, m.t))
self.assertTrue(isinstance(m.dv, Var))
self.assertTrue(isinstance(m.dv, DerivativeVar))
self.assertTrue(m.dv._wrt[0] is m.t)
self.assertTrue(m.dv._sVar is m.v)
self.assertTrue(m.v._derivative[('t',)]() is m.dv)
self.assertTrue(m.dv.type() is DerivativeVar)
self.assertTrue(m.dv._index is m.t)
self.assertTrue(m.dv2._wrt[0] is m.t)
self.assertTrue(m.dv2._wrt[1] is m.t)
self.assertTrue(m.v._derivative[('t', 't')]() is m.dv2)
self.assertTrue(m.dv.get_state_var() is m.v)
self.assertTrue(m.dv2.get_state_var() is m.v)
del m.dv
del m.dv2
del m.v
m.v = Var(m.s, m.t)
m.dv = DerivativeVar(m.v)
m.dv2 = DerivativeVar(m.v, wrt=(m.t, m.t))
self.assertTrue(isinstance(m.dv, Var))
self.assertTrue(isinstance(m.dv, DerivativeVar))
self.assertTrue(m.dv._wrt[0] is m.t)
self.assertTrue(m.dv._sVar is m.v)
self.assertTrue(m.v._derivative[('t',)]() is m.dv)
self.assertTrue(m.dv.type() is DerivativeVar)
self.assertTrue(m.t in m.dv._implicit_subsets)
self.assertTrue(m.s in m.dv._implicit_subsets)
self.assertTrue(m.dv2._wrt[0] is m.t)
self.assertTrue(m.dv2._wrt[1] is m.t)
self.assertTrue(m.v._derivative[('t', 't')]() is m.dv2)
del m.dv
del m.dv2
del m.v
del m.v_index
del m.dv_index
del m.dv2_index
m.v = Var(m.x, m.t)
m.dv = DerivativeVar(m.v, wrt=m.x)
m.dv2 = DerivativeVar(m.v, wrt=m.t)
m.dv3 = DerivativeVar(m.v, wrt=(m.t, m.x))
m.dv4 = DerivativeVar(m.v, wrt=[m.t, m.t])
self.assertTrue(isinstance(m.dv, Var))
self.assertTrue(isinstance(m.dv, DerivativeVar))
self.assertTrue(m.dv._wrt[0] is m.x)
self.assertTrue(m.dv._sVar is m.v)
self.assertTrue(m.v._derivative[('x',)]() is m.dv)
self.assertTrue(m.v._derivative[('t',)]() is m.dv2)
self.assertTrue(m.v._derivative[('t', 'x')]() is m.dv3)
self.assertTrue(m.v._derivative[('t', 't')]() is m.dv4)
self.assertTrue(m.dv.type() is DerivativeVar)
self.assertTrue(m.x in m.dv._implicit_subsets)
self.assertTrue(m.t in m.dv._implicit_subsets)
self.assertTrue(m.dv3._wrt[0] is m.t)
self.assertTrue(m.dv3._wrt[1] is m.x)
self.assertTrue(m.dv4._wrt[0] is m.t)
self.assertTrue(m.dv4._wrt[1] is m.t)
示例11: test_invalid
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_invalid(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.x, m.t)
def _int(m, t):
return m.v[t]
def _int2(m, x, t):
return m.v3[x, t]
def _int3(m, s, t):
return m.v2[s,t]
# Integrals must be indexed by a ContinuousSet
with self.assertRaises(ValueError):
m.int = Integral(rule=_int)
# Specifying multiple aliases of same option
with self.assertRaises(TypeError):
m.int = Integral(m.t, wrt=m.t, withrespectto=m.t, rule=_int)
# No ContinuousSet specified
with self.assertRaises(ValueError):
m.int2 = Integral(m.x, m.t, rule= _int2)
# 'wrt' is not a ContinuousSet
with self.assertRaises(ValueError):
m.int = Integral(m.s, m.t, wrt=m.s, rule=_int2)
# 'wrt' is not in argument list
with self.assertRaises(ValueError):
m.int = Integral(m.t, wrt=m.x, rule=_int)
# 'bounds' not supported
with self.assertRaises(DAE_Error):
m.int = Integral(m.t, wrt=m.t, rule=_int, bounds=(0,0.5))
# No rule specified
with self.assertRaises(ValueError):
m.int = Integral(m.t, wrt=m.t)
# test DerivativeVar reclassification after discretization
def test_reclassification_finite_difference(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.t, m.x)
def _int1(m, t):
return m.v[t]
m.int1 = Integral(m.t, rule=_int1)
def _int2(m, s, t):
return m.v2[s, t]
m.int2 = Integral(m.s, m.t, wrt=m.t, rule=_int2)
def _int3(m, t, x):
return m.v3[t, x]
m.int3 = Integral(m.t, m.x, wrt=m.t, rule=_int3)
def _int4(m, x):
return m.int3[x]
m.int4 = Integral(m.x, wrt=m.x, rule=_int4)
self.assertFalse(m.int1.is_fully_discretized())
self.assertFalse(m.int2.is_fully_discretized())
self.assertFalse(m.int3.is_fully_discretized())
self.assertFalse(m.int4.is_fully_discretized())
TransformationFactory('dae.finite_difference').apply_to(m, wrt=m.t)
self.assertTrue(m.int1.is_fully_discretized())
self.assertTrue(m.int2.is_fully_discretized())
self.assertFalse(m.int3.is_fully_discretized())
self.assertFalse(m.int4.is_fully_discretized())
self.assertTrue(m.int1.type() is Integral)
self.assertTrue(m.int2.type() is Integral)
self.assertTrue(m.int3.type() is Integral)
self.assertTrue(m.int4.type() is Integral)
TransformationFactory('dae.finite_difference').apply_to(m, wrt=m.x)
self.assertTrue(m.int3.is_fully_discretized())
self.assertTrue(m.int4.is_fully_discretized())
self.assertTrue(m.int1.type() is Expression)
#.........这里部分代码省略.........
示例12: test_valid
# 需要导入模块: from pyomo.environ import ConcreteModel [as 别名]
# 或者: from pyomo.environ.ConcreteModel import s [as 别名]
def test_valid(self):
m = ConcreteModel()
m.t = ContinuousSet(bounds=(0, 1))
m.x = ContinuousSet(bounds=(5, 10))
m.s = Set(initialize=[1, 2, 3])
m.v = Var(m.t)
m.v2 = Var(m.s, m.t)
m.v3 = Var(m.t, m.x)
def _int1(m, t):
return m.v[t]
m.int1 = Integral(m.t, rule=_int1)
def _int2(m, s, t):
return m.v2[s, t]
m.int2 = Integral(m.s, m.t, wrt=m.t, rule=_int2)
def _int3(m, t, x):
return m.v3[t, x]
m.int3 = Integral(m.t, m.x, wrt=m.t, rule=_int3)
def _int4(m, x):
return m.int3[x]
m.int4 = Integral(m.x, wrt=m.x, rule=_int4)
self.assertTrue(isinstance(m.int1, Expression))
self.assertTrue(isinstance(m.int2, Expression))
self.assertTrue(isinstance(m.int3, Expression))
self.assertTrue(isinstance(m.int4, Expression))
self.assertTrue(m.int1.get_continuousset() is m.t)
self.assertTrue(m.int2.get_continuousset() is m.t)
self.assertTrue(m.int3.get_continuousset() is m.t)
self.assertTrue(m.int4.get_continuousset() is m.x)
self.assertEqual(len(m.int1), 1)
self.assertEqual(len(m.int2), 3)
self.assertEqual(len(m.int3), 2)
self.assertEqual(len(m.int4), 1)
self.assertTrue(m.int1.type() is Integral)
self.assertTrue(m.int2.type() is Integral)
self.assertTrue(m.int3.type() is Integral)
self.assertTrue(m.int4.type() is Integral)
repn = generate_standard_repn(m.int1.expr)
self.assertEqual(repn.linear_coefs, (0.5, 0.5))
self.assertTrue(repn.linear_vars[0] is m.v[1])
self.assertTrue(repn.linear_vars[1] is m.v[0])
repn = generate_standard_repn(m.int2[1].expr)
self.assertEqual(repn.linear_coefs, (0.5, 0.5))
self.assertTrue(repn.linear_vars[0] is m.v2[1, 1])
self.assertTrue(repn.linear_vars[1] is m.v2[1, 0])
repn = generate_standard_repn(m.int4.expr)
self.assertEqual(repn.linear_coefs, (1.25, 1.25, 1.25, 1.25))
self.assertTrue(repn.linear_vars[0] is m.v3[1, 10])
self.assertTrue(repn.linear_vars[1] is m.v3[0, 10])
self.assertTrue(repn.linear_vars[2] is m.v3[1, 5])
self.assertTrue(repn.linear_vars[3] is m.v3[0, 5])