--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sorry, having a little trouble parsing this. Are you saying:
If we have only a float added to a component as the expression (i.e., m.obj = Objective(expr=3.0)) then we get a NumericConstant that wraps the float, but if the float is part of a longer expression (i.e. m.obj = Objective(expr=m.x + 3.0)) that we do NOT get a NumericConstant object wrapping the float “3.0”?
Is that the discrepancy?
Regards,
Carl.
--
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-developers+unsubscribe@googlegroups.com.
Again, so I understand. If we *always* wrap floats in a NumericConstant, then we have certain methods guaranteed to be valid for all nodes of an expression tree. However, if we do not always wrap, then we have to do the checks for python POD first, correct?
Any major performance predictions either way?
From: <pyomo-de...@googlegroups.com> on behalf of Bill Hart <whar...@gmail.com>
Reply-To: "pyomo-de...@googlegroups.com" <pyomo-de...@googlegroups.com>
Date: Monday, April 30, 2018 at 2:46 PM
To: Pyomo Developers <pyomo-de...@googlegroups.com>
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-developers+unsubscribe@googlegroups.com.
There was a significant performance and memory benefit of moving away from NumericConstants in expression trees. However, we never made that change for the actual *component* APIs. That is, if you ask for information about a component (e.g., m.e.expr(), m.c.body(), m.obj.expr(), m.c.lower()) you were guaranteed to get a derivative of Pyomo’s NumericValue class. That allowed users to blindly use the __call__ notation for evaluation, or check is_fixed, etc. without any need to check “isinstance(x, NumericValue)” first. The argument at the time was that when we were changing the storage within the expression system, we were changing an internal API, whereas changing the component attributes would change a public / user API.
For the record, `y = as_numeric(x)` is a utility method to efficiently return x as a NumericValue. That is, expressions, Vars, (mutable) Params , etc were just returned, and constants were wrapped in NumericConstant before being returned. While that guaranteed “y.is_constant()” would return he correct value, that was far from the only purpose.
john
From: pyomo-de...@googlegroups.com [mailto:pyomo-de...@googlegroups.com]
On Behalf Of Bill Hart
Sent: Monday, April 30, 2018 2:02 PM
To: Pyomo Developers <pyomo-de...@googlegroups.com>
Subject: Re: [EXTERNAL] A Pyomo Design Question
Right.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyomo Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-develope...@googlegroups.com.