Skip to content

Commit e7d8f2d

Browse files
committed
vjp jvp eval function fix returns
1 parent d483b16 commit e7d8f2d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/OptimizationMOI/src/nlp.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,13 @@ function MOI.eval_constraint_jacobian_product(
302302
evaluator::MOIOptimizationNLPEvaluator, y, x, w)
303303
if evaluator.f.cons_jvp !== nothing
304304
evaluator.f.cons_jvp(y, x, w)
305-
306305
elseif evaluator.f.cons_j !== nothing
307306
J = evaluator.J
308307
evaluator.f.cons_j(J, x)
309308
mul!(y, J, w)
310-
return
309+
else
310+
error("Thou shalt provide the v'J of the constraint jacobian, not doing so is associated with great misfortune and also no ice cream for you.")
311311
end
312-
error("Thou shalt provide the v'J of the constraint jacobian, not doing so is associated with great misfortune and also no ice cream for you.")
313312
end
314313

315314
function MOI.eval_constraint_jacobian_transpose_product(
@@ -320,14 +319,13 @@ function MOI.eval_constraint_jacobian_transpose_product(
320319
)
321320
if evaluator.f.cons_vjp !== nothing
322321
evaluator.f.cons_vjp(y, x, w)
323-
324322
elseif evaluator.f.cons_j !== nothing
325323
J = evaluator.J
326324
evaluator.f.cons_j(J, x)
327325
mul!(y, J', w)
328-
return
326+
else
327+
error("Thou shalt provide the v'J of the constraint jacobian, not doing so is associated with great misfortune and also no ice cream for you.")
329328
end
330-
error("Thou shalt provide the v'J of the constraint jacobian, not doing so is associated with great misfortune and also no ice cream for you.")
331329
end
332330

333331
function MOI.hessian_lagrangian_structure(evaluator::MOIOptimizationNLPEvaluator)

0 commit comments

Comments
 (0)