Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change monomial equality creation for SMA, k=1 #59

Merged
merged 23 commits into from
Jan 2, 2017
Merged

change monomial equality creation for SMA, k=1 #59

merged 23 commits into from
Jan 2, 2017

Conversation

mjburton11
Copy link

@mjburton11 mjburton11 commented Dec 12, 2016

@whoburg, @bqpd: ready for review:

I've been getting the below error when trying to fit data with SMA, K=1. I believe this PR will fix it.

/Users/mjburton11/anaconda/lib/python2.7/site-packages/gpfit/fit.pyc in fit(xdata, ydata, K, ftype, varNames)
    165         # # If only one term, automatically make an equality constraint
    166         if K == 1:
--> 167             cstrt = MonomialEquality(cstrt, "=", 1)
    168 
    169 

/Users/mjburton11/MIT/GPKIT/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)
    566     def __init__(self, left, oper, right):
    567         # pylint: disable=non-parent-init-called
--> 568         ScalarSingleEquationConstraint.__init__(self, left, oper, right)
    569         if self.oper is not "=":
    570             raise ValueError("operator %s is not supported by"

/Users/mjburton11/MIT/GPKIT/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, left, oper, right)
    411     def __init__(self, left, oper, right):
    412         super(ScalarSingleEquationConstraint,
--> 413               self).__init__(Signomial(left), oper, Signomial(right))
    414         self.varkeys = KeySet(self.left.varlocs)
    415         self.varkeys.update(self.right.varlocs)

/Users/mjburton11/MIT/GPKIT/gpkit/gpkit/nomials/nomial_math.pyc in __init__(self, exps, cs, require_positive, simplify, **descr)
     71             try:
     72                 # test for presence of length and identical lengths
---> 73                 assert len(cs) == len(exps)
     74                 exps_ = list(range(len(exps)))
     75                 if not all(isinstance(c, Quantity) for c in cs):

TypeError: object of type 'int' has no len()

@mjburton11
Copy link
Author

mjburton11 commented Dec 12, 2016

Also got the same error when using ISMA for K=1. Fixed in 94701ee.

@galbramc
Copy link

test this please

@galbramc
Copy link

All the tests are passing. Ignore anything other than "gpfit pylint tests" and "gpfit unit tests"

@bqpd
Copy link
Contributor

bqpd commented Dec 21, 2016

@mjburton11, there seem to be pylint errors on this?

@galbramc
Copy link

are the changes to .pylintrc here consistent with those in gpkit?

@bqpd
Copy link
Contributor

bqpd commented Dec 31, 2016 via email

@bqpd
Copy link
Contributor

bqpd commented Jan 2, 2017

@galbramc, pylint consistency is now captured in issue #63

@bqpd bqpd merged commit 648d114 into master Jan 2, 2017
@bqpd bqpd deleted the smaequality branch January 2, 2017 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants