Skip to content

Commit fb6ddc8

Browse files
committed
some comments and planning
1 parent 4ebfaad commit fb6ddc8

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

cvxpy/reductions/solvers/nlp_solvers/nlp_solver.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(self, problem, initial_point, num_constraints,
152152
self.c_problem = C_problem(problem, verbose=verbose)
153153
self.use_hessian = use_hessian
154154

155-
# Always initialize Jacobian
155+
# Always initialize Jacobian ---- TODO: move this to initialize jacobian?
156156
self.c_problem.init_jacobian()
157157

158158
# Only initialize Hessian if needed (not for quasi-Newton methods)
@@ -188,19 +188,26 @@ def constraints(self, x):
188188
return self.c_problem.constraint_forward(x)
189189

190190
def jacobian(self, x):
191-
"""Returns the Jacobian values in COO format at the sparsity structure. """
192-
191+
"""Returns the Jacobian values corresponding to the precomputed sparsity pattern."""
192+
193193
if not self.constraints_forward_passed:
194194
self.constraints(x)
195195

196196
jac_csr = self.c_problem.jacobian()
197197
jac_coo = jac_csr.tocoo()
198+
199+
# return self.c_problem.eval_jacobian_vals()
200+
198201
return jac_coo.data.copy()
199202

200203
def jacobianstructure(self):
201204
"""Returns the sparsity structure of the Jacobian."""
202205
if self._jac_structure is not None:
203206
return self._jac_structure
207+
208+
# self.c_problem.init_jacobian()
209+
# self._jac_structure = self.c_problem.get_jacobian_sparsity_coo()
210+
# return self._jac_structure
204211

205212
jac_csr = self.c_problem.get_jacobian()
206213
jac_coo = jac_csr.tocoo()
@@ -226,6 +233,8 @@ def hessian(self, x, duals, obj_factor):
226233
# Extract lower triangular values
227234
mask = hess_coo.row >= hess_coo.col
228235

236+
# return self.c_problem.eval_hessian_vals_coo(obj_factor, duals)
237+
229238
return hess_coo.data[mask]
230239

231240
def hessianstructure(self):
@@ -237,6 +246,10 @@ def hessianstructure(self):
237246
if self._hess_structure is not None:
238247
return self._hess_structure
239248

249+
#self.c_problem.init_hessian()
250+
#self._hess_structure = self.c_problem.get_hessian_sparsity_coo()
251+
#return self._hess_structure
252+
240253
hess_csr = self.c_problem.get_hessian()
241254
hess_coo = hess_csr.tocoo()
242255

0 commit comments

Comments
 (0)