Skip to content

Commit f2bfd53

Browse files
Merge pull request #1158 from ErikQQY/qqy/second_optimize
Add lb, ub, lcons and ucons for second order BVProblem
2 parents eb5e3c7 + c3a6fc7 commit f2bfd53

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/problems/bvp_problems.jl

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ every solve call.
102102
initial value problem, or a `Vector` of values for ``u(t_i)`` for collocation
103103
methods.
104104
* `tspan`: The timespan for the problem.
105-
* `p`: The parameters for the problem. Defaults to `NullParameters`
105+
* `p`: The parameters for the problem. Defaults to `NullParameters`.
106+
* `lb`: The lower bounds for the solution variables. Defaults to `nothing`.
107+
* `ub`: The upper bounds for the solution variables. Defaults to `nothing`.
108+
* `lcons`: The lower bounds for the constraint residuals. Defaults to `nothing`.
109+
* `ucons`: The upper bounds for the constraint residuals. Defaults to `nothing`.
110+
* `problem_type`: The type of the problem, either `StandardBVProblem` or
111+
`TwoPointBVProblem`.
106112
* `kwargs`: The keyword arguments passed onto the solves.
107113
108114
### Special Keyword Arguments
@@ -127,7 +133,8 @@ struct BVProblem{uType, tType, isinplace, nlls, P, F, LB, UB, LC, UC, PT, K} <:
127133
kwargs::K
128134

129135
@add_kwonly function BVProblem{iip}(f::AbstractBVPFunction{iip, TP}, u0, tspan,
130-
p = NullParameters(); lb = nothing, ub = nothing, lcons = nothing, ucons = nothing, problem_type = nothing, nlls = nothing,
136+
p = NullParameters(); lb = nothing, ub = nothing, lcons = nothing,
137+
ucons = nothing, problem_type = nothing, nlls = nothing,
131138
kwargs...) where {iip, TP}
132139
_u0 = prepare_initial_state(u0)
133140
_tspan = promote_tspan(tspan)
@@ -347,21 +354,32 @@ every solve call.
347354
initial value problem, or a `Vector` of values for ``u(t_i)`` for collocation
348355
methods.
349356
* `tspan`: The timespan for the problem.
350-
* `p`: The parameters for the problem. Defaults to `NullParameters`
357+
* `p`: The parameters for the problem. Defaults to `NullParameters`.
358+
* `lb`: The lower bounds for the solution variables. Defaults to `nothing`.
359+
* `ub`: The upper bounds for the solution variables. Defaults to `nothing`.
360+
* `lcons`: The lower bounds for the constraint residuals. Defaults to `nothing`.
361+
* `ucons`: The upper bounds for the constraint residuals. Defaults to `nothing`.
362+
* `problem_type`: The type of the problem, either `StandardSecondOrderBVProblem` or
363+
`TwoPointSecondOrderBVProblem`.
351364
* `kwargs`: The keyword arguments passed onto the solves.
352365
"""
353-
struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, PT, K} <:
366+
struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, LB, UB, LC, UC, PT, K} <:
354367
AbstractBVProblem{uType, tType, isinplace, nlls}
355368
f::F
356369
u0::uType
357370
tspan::tType
358371
p::P
372+
lb::LB
373+
ub::UB
374+
lcons::LC
375+
ucons::UC
359376
problem_type::PT
360377
kwargs::K
361378

362379
@add_kwonly function SecondOrderBVProblem{iip}(
363380
f::DynamicalBVPFunction{iip, specialize, TP}, u0, tspan,
364-
p = NullParameters(); problem_type = nothing, nlls = nothing,
381+
p = NullParameters(); lb = nothing, ub = nothing, lcons = nothing,
382+
ucons = nothing, problem_type = nothing, nlls = nothing,
365383
kwargs...) where {iip, specialize, TP}
366384
_u0 = prepare_initial_state(u0)
367385
_tspan = promote_tspan(tspan)
@@ -377,7 +395,9 @@ struct SecondOrderBVProblem{uType, tType, isinplace, nlls, P, F, PT, K} <:
377395
end
378396

379397
return new{typeof(_u0), typeof(_tspan), iip, typeof(nlls), typeof(p), typeof(f),
380-
typeof(problem_type), typeof(kwargs)}(f, _u0, _tspan, p, problem_type, kwargs)
398+
typeof(lb), typeof(ub), typeof(lcons), typeof(ucons),
399+
typeof(problem_type), typeof(kwargs)}(
400+
f, _u0, _tspan, p, lb, ub, lcons, ucons, problem_type, kwargs)
381401
end
382402

383403
function SecondOrderBVProblem{iip}(

0 commit comments

Comments
 (0)