Closed 1ozturkbe closed 5 years ago
It's looking for a Varkey, but gets str instead. Needs something like substitutions.update.
Beginning signomial solve. --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-6-dbbd52c503f3> in <module>() ----> 1 sol = m.penalty_ccp_solve(verbosity=2, mutategp=False, x0=x0) c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\prog_factories.pyc in solvefn(self, solver, verbosity, skipsweepfailures, **kwargs) 122 else: 123 self.program, progsolve = genfunction(self) --> 124 result = progsolve(solver, verbosity, **kwargs) 125 solution.append(result) 126 solution.program = self.program c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\sgp.pyc in penalty_ccp_solve(self, solver, verbosity, x0, reltol, iteration_limit, mutategp, exp, **kwargs) 193 self.result = relaxed_model.localsolve(solver, verbosity, 194 x0, reltol, iteration_limit, --> 195 mutategp, **kwargs) 196 self.gps = relaxed_model.gps 197 return self.result c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\sgp.pyc in localsolve(self, solver, verbosity, x0, reltol, iteration_limit, mutategp, **kwargs) 120 mutategp = mutategp and not self.externalfns 121 if x0 and not mutategp: --> 122 self._gp = self.init_gp(self.substitutions, x0) 123 slackvar = Variable() 124 prevcost, cost, rel_improvement = None, None, None c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\sgp.pyc in init_gp(self, substitutions, x0) 218 "Generates a simplified GP representation for later modification" 219 gpconstrs, self._spconstrs, self._approx_lt, approx_gt = [], [], [], [] --> 220 x0 = self._fill_x0(x0) 221 for cs in self.flat(): 222 try: c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\constraints\sgp.pyc in _fill_x0(self, x0) 206 def _fill_x0(self, x0): 207 "Returns a copy of x0 with subsitutions added." --> 208 x0 = KeyDict(x0) if x0 else KeyDict() 209 for key in self.varkeys: 210 if key in x0: c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\keydict.pyc in __init__(self, *args, **kwargs) 69 self.logged_gets = set() 70 self.owned = set() ---> 71 self.update(*args, **kwargs) 72 73 def get(self, key, alternative=KeyError): c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\keydict.pyc in update(self, *args, **kwargs) 94 else: 95 for k, v in dict(*args, **kwargs).items(): ---> 96 self[k] = v 97 98 def parse_and_index(self, key): c:\users\berk\dropbox (mit)\mit graduate school\code\gpkit\gpkit\keydict.pyc in __setitem__(self, key, value) 210 value = value.value # substitute constant monomials 211 if isinstance(value, Quantity): --> 212 value = value.to(key.units or "dimensionless").magnitude 213 if idx: 214 if is_sweepvar(value): AttributeError: 'str' object has no attribute 'units'
It's looking for a Varkey, but gets str instead. Needs something like substitutions.update.