Conversation
|
double-check the ticket numbers this closes? 17 must be a typo. |
|
Oops, yep, meant in gpkit-models |
gpkit/keydict.py
Outdated
| def add(self, *args): | ||
| "Adds all args to the keyset" | ||
| for arg in args: | ||
| self[arg] = None |
There was a problem hiding this comment.
python's set.add takes exactly one argument. I think we should match that interface here. https://docs.python.org/2/library/sets.html#sets.Set
There was a problem hiding this comment.
Then how should we add multiple?
There was a problem hiding this comment.
same way people add multiple things to a set -- I assume they write a for loop? Or also implement union, which takes an iterable?
|
This branch works for d8 but not for another external model. Issue appears to be with how model names are appended to variables. |
gpkit/constraints/set.py
Outdated
| def reset_varkeys(self, init_dict=None): | ||
| "Goes through constraints and collects their varkeys." | ||
| varkeys = KeySet() | ||
| if not init_dict is None: |
There was a problem hiding this comment.
I think preferred syntax is if init_dict is not None
|
@whoburg, see if commenting out the last line in |
|
nope, commenting out that line did not fix it. I'll debug a bit |
|
model that's not getting model names appended is a LinkedConstraintSet, if that matters |
|
Here's a MWE for not adding modelname to varkeys: from gpkit import Variable, VectorVariable, Model
class Thing(Model):
"a thing"
def __init__(self, n, **kwargs):
a = VectorVariable(n, "a", "g/m")
b = VectorVariable(n, "b", "m")
c = Variable("c", 17/4., "g")
Model.__init__(self, None, [a >= c/b], **kwargs)
t = Thing(3)
print t.varkeysoutput is |
|
added that MWE as a test to fix |
|
Passes the test locally, now. |
|
ok excellent, that was the issue. I'm going to try rebasing this onto master. |
|
@mayork, would you mind switching to this branch briefly and confirming your model(s) run fine? |
|
ok, the one ubuntu16 test failure was not caused by this; I'm ready to merge this. |
|
@whoburg I'm having trouble checking this out...I'm not sure if I'm doing something stupid but I can checkout branches like master equality and breakdown but get the following error when I try to check this out...it's called |
|
do |
|
okay got the branch installing and testing right now |
|
sorry slight delay I think I just broke the atmosphere model |
|
@whoburg it works...solved the model in fewer iterations also. |
Fix varkeys on model creation, and make it easy to add to that list. Closes #784 and makes convexengineering/gplibrary#17 possible.