Skip to content

Commit a01f0a6

Browse files
committed
format
1 parent 423decd commit a01f0a6

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/systems/optimization/modelingtoolkitize.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function modelingtoolkitize(prob::DiffEqBase.OptimizationProblem; kwargs...)
2727
for i in 1:num_cons
2828
if !isinf(prob.lcons[i])
2929
if prob.lcons[i] != prob.ucons[i]
30-
push!(cons, prob.lcons[i] lhs[i])
30+
push!(cons, prob.lcons[i] lhs[i])
3131
else
3232
push!(cons, lhs[i] ~ prob.ucons[i])
3333
end

src/systems/optimization/optimizationsystem.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ function DiffEqBase.OptimizationProblem{iip}(sys::OptimizationSystem, u0map,
269269
expression = Val{false})
270270

271271
obj_expr = subs_constants(objective(sys))
272-
272+
273273
if grad
274274
grad_oop, grad_iip = generate_gradient(sys, checkbounds = checkbounds,
275275
linenumbers = linenumbers,

test/optimizationsystem.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,17 @@ end
289289
@parameters a b
290290
loss = (a - x)^2 + b * (y - x^2)^2
291291
@named sys = OptimizationSystem(loss, [x, y], [a, b], constraints = [x^2 + y^2 0.0])
292-
@test_throws ArgumentError OptimizationProblem(sys, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0], lcons = [0.0])
293-
@test_throws ArgumentError OptimizationProblem(sys, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0], ucons = [0.0])
292+
@test_throws ArgumentError OptimizationProblem(sys,
293+
[x => 0.0, y => 0.0],
294+
[a => 1.0, b => 100.0],
295+
lcons = [0.0])
296+
@test_throws ArgumentError OptimizationProblem(sys,
297+
[x => 0.0, y => 0.0],
298+
[a => 1.0, b => 100.0],
299+
ucons = [0.0])
294300

295301
prob = OptimizationProblem(sys, [x => 0.0, y => 0.0], [a => 1.0, b => 100.0])
296302
@test prob.f.expr isa Symbolics.Symbolic
297-
@test all(prob.f.cons_expr[i].lhs isa Symbolics.Symbolic for i in 1:length(prob.f.cons_expr))
298-
end
303+
@test all(prob.f.cons_expr[i].lhs isa Symbolics.Symbolic
304+
for i in 1:length(prob.f.cons_expr))
305+
end

0 commit comments

Comments
 (0)