{"action":"closed","issue":{"url":"https://api.github.com/repos/hoburg/gpkit/issues/936","repository_url":"https://api.github.com/repos/hoburg/gpkit","labels_url":"https://api.github.com/repos/hoburg/gpkit/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/hoburg/gpkit/issues/936/comments","events_url":"https://api.github.com/repos/hoburg/gpkit/issues/936/events","html_url":"https://github.com/hoburg/gpkit/issues/936","id":186331641,"number":936,"title":"monomial constraint being identified as a signomial","user":{"login":"mayork","id":6796415,"avatar_url":"https://avatars.githubusercontent.com/u/6796415?v=3","gravatar_id":"","url":"https://api.github.com/users/mayork","html_url":"https://github.com/mayork","followers_url":"https://api.github.com/users/mayork/followers","following_url":"https://api.github.com/users/mayork/following{/other_user}","gists_url":"https://api.github.com/users/mayork/gists{/gist_id}","starred_url":"https://api.github.com/users/mayork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mayork/subscriptions","organizations_url":"https://api.github.com/users/mayork/orgs","repos_url":"https://api.github.com/users/mayork/repos","events_url":"https://api.github.com/users/mayork/events{/privacy}","received_events_url":"https://api.github.com/users/mayork/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/hoburg/gpkit/milestones/13","html_url":"https://github.com/hoburg/gpkit/milestones/Next%20release","labels_url":"https://api.github.com/repos/hoburg/gpkit/milestones/13/labels","id":1608329,"number":13,"title":"Next release","description":"Frustrations / bugs / etc that are achievable in ~ 1 month timeframe.","creator":{"login":"whoburg","id":6042395,"avatar_url":"https://avatars.githubusercontent.com/u/6042395?v=3","gravatar_id":"","url":"https://api.github.com/users/whoburg","html_url":"https://github.com/whoburg","followers_url":"https://api.github.com/users/whoburg/followers","following_url":"https://api.github.com/users/whoburg/following{/other_user}","gists_url":"https://api.github.com/users/whoburg/gists{/gist_id}","starred_url":"https://api.github.com/users/whoburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whoburg/subscriptions","organizations_url":"https://api.github.com/users/whoburg/orgs","repos_url":"https://api.github.com/users/whoburg/repos","events_url":"https://api.github.com/users/whoburg/events{/privacy}","received_events_url":"https://api.github.com/users/whoburg/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":9,"state":"open","created_at":"2016-02-26T16:03:40Z","updated_at":"2016-11-24T16:06:50Z","due_on":"2016-11-18T00:00:00Z","closed_at":null},"comments":3,"created_at":"2016-10-31T16:33:37Z","updated_at":"2016-11-24T16:06:50Z","closed_at":"2016-11-24T16:06:49Z","body":"In the engine performance model the following two constraints\r\n\r\n```\r\nu25 == M25*(self.compressor['Cp_{2}']*self.engine['R']*T25/(781*units('J/kg/K')))**.5,   #B.202\r\nu2 == M2*(self.compressor['Cp_{1}']*self.engine['R']*T2/(781*units('J/kg/K')))**.5,  #B.197\r\n```\r\n\r\ncause this error\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nValueError                                Traceback (most recent call last)\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in <module>()\r\n   1229     with vectorize(2):\r\n   1230         state= TestState()\r\n-> 1231         engineP = engine.dynamic(state)\r\n   1232 \r\n   1233     constraints = []\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in dynamic(self, state)\r\n    135         \"\"\"\r\n    136         return EnginePerformance(self, self.compressor, self.combustor, self.turbine,\r\n--> 137                                  self.fanmap, self.lpcmap, self.hpcmap, self.thrust, self.sizing, state)\r\n    138 \r\n    139 class Compressor(Model):\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in __init__(self, engine, compressor, combustor, turbine, fanmap, LPCmap, HPCmap, thrust, sizing, state, **kwargs)\r\n   1141         self.LPCmapP = LPCmap.dynamic(self.compP, self.thrustP, engine)\r\n   1142         self.HPCmapP = HPCmap.dynamic(self.compP, self.thrustP, engine)\r\n-> 1143         self.sizingP = sizing.dynamic(engine, self.compP, self.combP, self.turbineP, self.fanmapP, self.LPCmapP, self.HPCmapP, self.thrustP, compressor, fanmap, LPCmap, HPCmap, state, 0)\r\n   1144 \r\n   1145         models = [self.compP, self.combP, self.turbineP, self.thrustP, self.fanmapP, self.LPCmapP, self.HPCmapP, self.sizingP]\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in dynamic(self, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7)\r\n    941         creates an instance of the engine sizing performance model\r\n    942         \"\"\"\r\n--> 943         return SizingPerformance(self, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7)\r\n    944 \r\n    945 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in __init__(self, sizing, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7, cooling)\r\n   1075             h2 == self.compressor['Cp_{1}'] * T2,\r\n   1076             rho2 == P2/(self.engine['R'] * T2),  #B.196\r\n-> 1077             u2 == M2*(self.compressor['Cp_{1}']*self.engine['R']*T2/(781*units('J/kg/K')))**.5,  #B.197\r\n   1078             self.sizing['A_2'] == self.thrustP['m_{fan}']/(rho2*u2),     #B.198\r\n   1079 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/array.pyc in wrapped_func(self, other)\r\n     37         else:\r\n     38             veccable_other = other\r\n---> 39         result = vecfunc(self, veccable_other)\r\n     40         left = self.key if hasattr(self, \"key\") else self\r\n     41         right = other.key if hasattr(other, \"key\") else other\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in __call__(self, *args, **kwargs)\r\n   2216             vargs.extend([kwargs[_n] for _n in names])\r\n   2217 \r\n-> 2218         return self._vectorize_call(func=func, args=vargs)\r\n   2219 \r\n   2220     def _get_ufunc_and_otypes(self, func, args):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _vectorize_call(self, func, args)\r\n   2279             _res = func()\r\n   2280         else:\r\n-> 2281             ufunc, otypes = self._get_ufunc_and_otypes(func=func, args=args)\r\n   2282 \r\n   2283             # Convert args to object arrays first\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _get_ufunc_and_otypes(self, func, args)\r\n   2241             # arrays (the input values are not checked to ensure this)\r\n   2242             inputs = [asarray(_a).flat[0] for _a in args]\r\n-> 2243             outputs = func(*inputs)\r\n   2244 \r\n   2245             # Performance note: profiling indicates that -- for simple\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __eq__(self, other)\r\n    411         if isinstance(other, mons):\r\n    412             # if both are monomials, return a constraint\r\n--> 413             return MonomialEquality(self, \"=\", other)\r\n    414         return super(Monomial, self).__eq__(other)\r\n    415 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    599     def __init__(self, left, oper, right):\r\n    600         # pylint: disable=non-parent-init-called\r\n--> 601         ScalarSingleEquationConstraint.__init__(self, left, oper, right)\r\n    602         if self.oper is not \"=\":\r\n    603             raise ValueError(\"operator %s is not supported by\"\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    438     def __init__(self, left, oper, right):\r\n    439         super(ScalarSingleEquationConstraint,\r\n--> 440               self).__init__(Signomial(left), oper, Signomial(right))\r\n    441         self.varkeys = KeySet(self.left.varlocs)\r\n    442         self.varkeys.update(self.right.varlocs)\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, exps, cs, require_positive, simplify, **descr)\r\n    106 \r\n    107         # init NomialData to create self.exps, self.cs, and so on\r\n--> 108         super(Signomial, self).__init__(exps, cs, simplify=simplify)\r\n    109 \r\n    110         if self.any_nonpositive_cs:\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/data.pyc in __init__(self, exps, cs, simplify)\r\n     27             exps, cs = simplify_exps_and_cs(exps, cs)\r\n     28         self.exps, self.cs = exps, cs\r\n---> 29         self.any_nonpositive_cs = any(mag(c) <= 0 for c in self.cs)\r\n     30 \r\n     31         varlocs = {}\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/data.pyc in <genexpr>((c,))\r\n     27             exps, cs = simplify_exps_and_cs(exps, cs)\r\n     28         self.exps, self.cs = exps, cs\r\n---> 29         self.any_nonpositive_cs = any(mag(c) <= 0 for c in self.cs)\r\n     30 \r\n     31         varlocs = {}\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __le__(self, other)\r\n    356     def __le__(self, other):\r\n    357         if isinstance(other, Numbers + (Monomial,)):\r\n--> 358             return PosynomialInequality(self, \"<=\", other)\r\n    359         else:\r\n    360             # fall back on other's __ge__\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    457 \r\n    458     def __init__(self, left, oper, right):\r\n--> 459         ScalarSingleEquationConstraint.__init__(self, left, oper, right)\r\n    460         if self.oper == \"<=\":\r\n    461             p_lt, m_gt = self.left, self.right\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    438     def __init__(self, left, oper, right):\r\n    439         super(ScalarSingleEquationConstraint,\r\n--> 440               self).__init__(Signomial(left), oper, Signomial(right))\r\n    441         self.varkeys = KeySet(self.left.varlocs)\r\n    442         self.varkeys.update(self.right.varlocs)\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, exps, cs, require_positive, simplify, **descr)\r\n    111             from .. import SIGNOMIALS_ENABLED\r\n    112             if require_positive and not SIGNOMIALS_ENABLED:\r\n--> 113                 raise ValueError(\"each c must be positive.\")\r\n    114             self.__class__ = Signomial\r\n    115         else:\r\n\r\nValueError: each c must be positive.\r\n```\r\n\r\nIf I put them in a `SignomialsEnabled()` environment I get this error\r\n\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in <module>()\r\n   1231     with vectorize(2):\r\n   1232         state= TestState()\r\n-> 1233         engineP = engine.dynamic(state)\r\n   1234 \r\n   1235     constraints = []\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in dynamic(self, state)\r\n    135         \"\"\"\r\n    136         return EnginePerformance(self, self.compressor, self.combustor, self.turbine,\r\n--> 137                                  self.fanmap, self.lpcmap, self.hpcmap, self.thrust, self.sizing, state)\r\n    138 \r\n    139 class Compressor(Model):\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in __init__(self, engine, compressor, combustor, turbine, fanmap, LPCmap, HPCmap, thrust, sizing, state, **kwargs)\r\n   1143         self.LPCmapP = LPCmap.dynamic(self.compP, self.thrustP, engine)\r\n   1144         self.HPCmapP = HPCmap.dynamic(self.compP, self.thrustP, engine)\r\n-> 1145         self.sizingP = sizing.dynamic(engine, self.compP, self.combP, self.turbineP, self.fanmapP, self.LPCmapP, self.HPCmapP, self.thrustP, compressor, fanmap, LPCmap, HPCmap, state, 0)\r\n   1146 \r\n   1147         models = [self.compP, self.combP, self.turbineP, self.thrustP, self.fanmapP, self.LPCmapP, self.HPCmapP, self.sizingP]\r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in dynamic(self, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7)\r\n    941         creates an instance of the engine sizing performance model\r\n    942         \"\"\"\r\n--> 943         return SizingPerformance(self, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7)\r\n    944 \r\n    945 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit-models/gpkitmodels/aircraft/CFM_56_performance_components.py in __init__(self, sizing, engine, compressorP, combustorP, turbineP, fanmapP, lpcmapP, hpcmapP, thrustP, compressor, fanmap, lpcmap, hpcmap, state, res7, cooling)\r\n   1077                 h2 == self.compressor['Cp_{1}'] * T2,\r\n   1078                 rho2 == P2/(self.engine['R'] * T2),  #B.196\r\n-> 1079                 u2 == M2*(self.compressor['Cp_{1}']*self.engine['R']*T2/(781*units('J/kg/K')))**.5,  #B.197\r\n   1080                 self.sizing['A_2'] == self.thrustP['m_{fan}']/(rho2*u2),     #B.198\r\n   1081 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/array.pyc in wrapped_func(self, other)\r\n     37         else:\r\n     38             veccable_other = other\r\n---> 39         result = vecfunc(self, veccable_other)\r\n     40         left = self.key if hasattr(self, \"key\") else self\r\n     41         right = other.key if hasattr(other, \"key\") else other\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in __call__(self, *args, **kwargs)\r\n   2216             vargs.extend([kwargs[_n] for _n in names])\r\n   2217 \r\n-> 2218         return self._vectorize_call(func=func, args=vargs)\r\n   2219 \r\n   2220     def _get_ufunc_and_otypes(self, func, args):\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _vectorize_call(self, func, args)\r\n   2279             _res = func()\r\n   2280         else:\r\n-> 2281             ufunc, otypes = self._get_ufunc_and_otypes(func=func, args=args)\r\n   2282 \r\n   2283             # Convert args to object arrays first\r\n\r\n/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _get_ufunc_and_otypes(self, func, args)\r\n   2241             # arrays (the input values are not checked to ensure this)\r\n   2242             inputs = [asarray(_a).flat[0] for _a in args]\r\n-> 2243             outputs = func(*inputs)\r\n   2244 \r\n   2245             # Performance note: profiling indicates that -- for simple\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __eq__(self, other)\r\n    411         if isinstance(other, mons):\r\n    412             # if both are monomials, return a constraint\r\n--> 413             return MonomialEquality(self, \"=\", other)\r\n    414         return super(Monomial, self).__eq__(other)\r\n    415 \r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    599     def __init__(self, left, oper, right):\r\n    600         # pylint: disable=non-parent-init-called\r\n--> 601         ScalarSingleEquationConstraint.__init__(self, left, oper, right)\r\n    602         if self.oper is not \"=\":\r\n    603             raise ValueError(\"operator %s is not supported by\"\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    438     def __init__(self, left, oper, right):\r\n    439         super(ScalarSingleEquationConstraint,\r\n--> 440               self).__init__(Signomial(left), oper, Signomial(right))\r\n    441         self.varkeys = KeySet(self.left.varlocs)\r\n    442         self.varkeys.update(self.right.varlocs)\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, exps, cs, require_positive, simplify, **descr)\r\n    106 \r\n    107         # init NomialData to create self.exps, self.cs, and so on\r\n--> 108         super(Signomial, self).__init__(exps, cs, simplify=simplify)\r\n    109 \r\n    110         if self.any_nonpositive_cs:\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/data.pyc in __init__(self, exps, cs, simplify)\r\n     27             exps, cs = simplify_exps_and_cs(exps, cs)\r\n     28         self.exps, self.cs = exps, cs\r\n---> 29         self.any_nonpositive_cs = any(mag(c) <= 0 for c in self.cs)\r\n     30 \r\n     31         varlocs = {}\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/data.pyc in <genexpr>((c,))\r\n     27             exps, cs = simplify_exps_and_cs(exps, cs)\r\n     28         self.exps, self.cs = exps, cs\r\n---> 29         self.any_nonpositive_cs = any(mag(c) <= 0 for c in self.cs)\r\n     30 \r\n     31         varlocs = {}\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __le__(self, other)\r\n    356     def __le__(self, other):\r\n    357         if isinstance(other, Numbers + (Monomial,)):\r\n--> 358             return PosynomialInequality(self, \"<=\", other)\r\n    359         else:\r\n    360             # fall back on other's __ge__\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)\r\n    469         self.substitutions = dict(p_lt.values)\r\n    470         self.substitutions.update(m_gt.values)\r\n--> 471         self.unsubbed = self._gen_unsubbed()\r\n    472         self.nomials = [self.left, self.right, self.p_lt, self.m_gt]\r\n    473         self.nomials.extend(self.unsubbed)\r\n\r\n/Users/mayork/Documents/GpGit/gpkit/gpkit/nomials/nomial_math.pyc in _gen_unsubbed(self)\r\n    505     def _gen_unsubbed(self):\r\n    506         \"Returns the unsubstituted posys <= 1.\"\r\n--> 507         p = self.p_lt / self.m_gt\r\n    508 \r\n    509         if isinstance(p.cs, Quantity):\r\n\r\nTypeError: unsupported operand type(s) for /: 'Monomial' and 'Signomial'\r\n\r\n```\r\n\r\nunless I'm crazy both constraints are monomial equalities...."}}
{"actor":{"display_login":"bqpd"}}