Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start towards correct dispatch on iip with Optimization problems #2380

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/systems/optimization/optimizationsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,21 @@
end
end

idx = iip ? 2 : 1
if length(cstr) > 0
@named cons_sys = ConstraintsSystem(cstr, dvs, ps)
cons, lcons_, ucons_ = generate_function(cons_sys, checkbounds = checkbounds,
linenumbers = linenumbers,
expression = Val{false})
if cons_j
_cons_j = generate_jacobian(cons_sys; expression = Val{false},
sparse = cons_sparse)[2]
sparse = cons_sparse)[idx]
else
_cons_j = nothing
end
if cons_h
_cons_h = generate_hessian(cons_sys; expression = Val{false},
sparse = cons_sparse)[2]
sparse = cons_sparse)[idx]
else
_cons_h = nothing
end
Expand Down Expand Up @@ -374,7 +375,7 @@
hess_prototype = hess_prototype,
syms = Symbol.(states(sys)),
paramsyms = Symbol.(parameters(sys)),
cons = cons[2],
cons = cons[idx],
cons_j = _cons_j,
cons_h = _cons_h,
cons_jac_prototype = cons_jac_prototype,
Expand Down Expand Up @@ -554,7 +555,7 @@
lb = $lb
ub = $ub
int = $int
cons = $cons[1]
cons = $cons[idx]

Check warning on line 558 in src/systems/optimization/optimizationsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/optimization/optimizationsystem.jl#L558

Added line #L558 was not covered by tests
lcons = $lcons
ucons = $ucons
cons_j = $_cons_j
Expand Down
Loading