gpkit: Bounded bug with SPs
Hello again! This time I have a less trivial issue.
I have a model that solves using a standard signomial solve. It’s in gpkit-models, d8fuselage branch;
the file is~\gpkit-models\gpkitmodels\aircraft\d8fuselage.py.
The implementation that solves is:
M = Fuselage()
sol = M.localsolve("mosek",tolerance = 0.01, verbosity = 1, iteration_limit=50)
But when I do this:
M = Fuselage()
M = Model(M.cost, BCS(M)) #Using BoundedConstraintSet
sol = M.localsolve("mosek",tolerance = 0.01, verbosity = 1, iteration_limit=50)
Then it gives me this:
TypeError                                 Traceback (most recent call last)
<ipython-input-9-defd0f9cf008> in <module>()
----> 1 M.localsolve('mosek')
c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\prog_factories.pyc in s
olvefn(self, solver, verbosity, skipsweepfailures, *args, **kwargs)
     89         if "sweepvariables" in solution:
     90             solution["variables"].update(solution["sweepvariables"])
---> 91         self.process_solution(solution)
     92         self.solution = solution  # NOTE: SIDE EFFECTS
     93         return solution
c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\set.pyc in process_solu
tion(self, sol)
    285         When x0 is none, may return a default guess."""
    286         gpconstrs = [constr.as_gpconstr(x0) for constr in self]
--> 287         return ConstraintSet(gpconstrs, self.substitutions)
    288
    289     def process_solution(self, sol):
c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\bounded.pyc in process_
solution(self, sol)
     81         out = defaultdict(list)
     82         for i, varkey in enumerate(self.bounded_varkeys):
---> 83             lam_gt, lam_lt = lam[2*i], lam[2*i+1]
     84             if abs(lam_gt) >= 1e-7:  # arbitrary threshold
     85                 out["sensitive to upper bound"].append(varkey)
TypeError: 'NoneType' object has no attribute '__getitem__'
For some odd reason, it believes that sol is a NoneType object (doesn’t exist!). Don’t understand why… But it does make it a pain to try to use BoundedConstraintSet at the moment. Let me know what the issue is!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- close #912, add test — committed to convexengineering/gpkit by bqpd 7 years ago
Does not occur on
master. @1ozturkbe, please reopen if you can reproduce this on master!@1ozturkbe, markdown formatting for python code can be done like this:
I’ve done that already for your post above.