Skip to content

Commit cabc199

Browse files
committed
Fix format
1 parent f29056b commit cabc199

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

test/solver_native_diff.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,9 @@ function MOI.get(s::EqQPSolver, ::DiffOpt.ForwardConstraintDual, ci::EQ_CI)
513513
end
514514

515515
# ForwardObjectiveSensitivity
516-
MOI.get(s::EqQPSolver, ::DiffOpt.ForwardObjectiveSensitivity) = s.fwd_obj_sensitivity
516+
function MOI.get(s::EqQPSolver, ::DiffOpt.ForwardObjectiveSensitivity)
517+
return s.fwd_obj_sensitivity
518+
end
517519

518520
# DifferentiateTimeSec
519521
MOI.get(s::EqQPSolver, ::DiffOpt.DifferentiateTimeSec) = s.diff_time
@@ -896,7 +898,8 @@ function test_forward_objective_sensitivity()
896898
# dobj/dt = (Qx + c)'dx + dc'x = [3,3]'*dx + [1,0]'*[0,1]
897899
expected = dot([3.0, 3.0], fwd[1:2]) + dot([1.0, 0.0], [0.0, 1.0])
898900

899-
@test MOI.get(model, DiffOpt.ForwardObjectiveSensitivity()) expected atol = ATOL
901+
@test MOI.get(model, DiffOpt.ForwardObjectiveSensitivity()) expected atol =
902+
ATOL
900903
end
901904

902905
# ── Test forward twice (re-differentiation in forward mode) ──────────────
@@ -911,16 +914,19 @@ function test_forward_twice()
911914
DiffOpt.forward_differentiate!(model)
912915

913916
fwd1 = K \ [-1.0, 0.0, 0.0]
914-
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x1) fwd1[1] atol = ATOL
917+
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x1) fwd1[1] atol =
918+
ATOL
915919

916920
# Second: perturb dc = [0, 1]
917921
DiffOpt.empty_input_sensitivities!(model)
918922
MOI.set(model, DiffOpt.ForwardObjectiveFunction(), 1.0 * x2)
919923
DiffOpt.forward_differentiate!(model)
920924

921925
fwd2 = K \ [0.0, -1.0, 0.0]
922-
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x1) fwd2[1] atol = ATOL
923-
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x2) fwd2[2] atol = ATOL
926+
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x1) fwd2[1] atol =
927+
ATOL
928+
@test MOI.get(model, DiffOpt.ForwardVariablePrimal(), x2) fwd2[2] atol =
929+
ATOL
924930
end
925931

926932
# ── Test ReverseConstraintSet (not applicable without parameters, but test the getter path) ──

0 commit comments

Comments
 (0)