Skip to content

Commit

Permalink
fix for mosek_conif
Browse files Browse the repository at this point in the history
  • Loading branch information
bqpd committed Mar 5, 2020
1 parent b8a0c84 commit fd8babe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion gpkit/constraints/gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,12 @@ def _generate_nula(self, solver_out):
nu_by_posy = [nu[mi] for mi in self.m_idxs]
solver_out["la"] = la = np.array([sum(nup) for nup in nu_by_posy])
elif "la" in solver_out:
la = np.ravel(solver_out["la"])
if len(la) == len(self.hmaps) - 1:
# assume solver dropped the cost's sensitivity (always 1.0)
la = np.hstack(([1.0], la))
# solver gave us posynomial sensitivities, generate monomial ones
solver_out["la"] = la = np.ravel(solver_out["la"])
solver_out["la"] = la
z = np.log(self.cs) + self.A.dot(solver_out["primal"])
m_iss = [self.p_idxs == i for i in range(len(la))]
nu_by_posy = [la[p_i]*np.exp(z[m_is])/sum(np.exp(z[m_is]))
Expand Down
2 changes: 1 addition & 1 deletion gpkit/nomials/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def __init__(self, left, right):
self.meq_bounded = {}
self._las = []
if self.unsubbed and len(self.varkeys) > 1:
exp, = list(self.unsubbed[0].hmap)
exp, = self.unsubbed[0].hmap
for key, e in exp.items():
s_e = np.sign(e)
ubs = frozenset((k, "upper" if np.sign(e) != s_e else "lower")
Expand Down

0 comments on commit fd8babe

Please sign in to comment.