--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Antonello,
Close. You specify the allowable domain of a set with the within keyword. Your definition of model.ct actually creates an indexed set. The literal translation of your GAMS snippet (assuming a Concrete Model) would be:
model.t = Set(doc=’Towns’, initialize=[’New-York’,’Paris’,’Berlin’,’Manila’])
model.ct = Set(doc=’coastal towns’, within=model.t)
model.lt = Set(doc=’land towns’, within=model.t)
model.i = Set(initialize=model.t)
That said, you do not need to initialize aliases to sets in Pyomo. Sets are somewhat simple containers for “plain old data”, and we do not implicitly track which set an index comes out of. This means that it is perfectly legal (and arguably recommended) to use the same indexing set more than once in a component declaration. That is:
model.x = Var(model.t, model.t)
is fine. In GAMS, they explicitly track which set an index originated from – which requires the use of aliases. This also allows them to do stronger error checking for cases where a user inadvertently transposes the indexes (something that we unfortunately cannot currently do).
A final note: you might consider building sets like this in the other order (that is, from the most specific up):
model.ct = Set(doc=’coastal towns’, initialize=[’New-York’, ’Manila’])
model.lt = Set(doc=’land towns’, initialize=[’Paris’,’Berlin’])
model.t = model.ct | model.lt
john
--
Nor is it particularly well tested (at least according to the Jenkins coverage report). Maybe this should go over on the developers’ list, but if it hasn’t been documented yet, then before we do, would it be more intuitive to rename it “AliasSet” or “SetAlias”???
john
Cool. I do too. It was never documented in The Book or online, so it should be “safe” to change the API. Bill designed the set infrastructure, so if he also concurs I will start making that change on trunk.
I don’t follow… Is the “Expression” you are referring to the Pyomo Expression component? The Expression component is simply a component container for an expression tree fragment – I don’t see how to use that for a Set.
Our Sets (with the exception of VirtualSets generated through the set operators like | and *) all own (contain copies) of the set members. The role for SetOf (nee, SetAlias) is to have a Set object that doesn’t contain copies of the set members, but is rather somewhat “virtual” and references data stored in some other (external) object (in this case, another Set).
Changing forums…
Merging threads, Gabe: are you proposing what Dave is also asking for: a simple “Alias” component that behaves like whatever it is aliasing?
FWIW, I think there is still a use for a SetOf like thing – where you want a Set (that supports membership tests, operations, iteration, etc), but does not copy the data from some other external source (a large dict or database or something). That was the original use of SetOf – to convert large dicts or lists into Set objects. Using SetOf as an Alias mechanism is (I think) a bit of an abuse of Bill’s original design intent. [but still very useful]
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
Changing forums…
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+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 Forum" group.
...To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum+unsubscribe@googlegroups.com.
For more options, visi
Changing forums…
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@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 Forum" group.
--...To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visi
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.