Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Aug 24, 2024
1 parent 015079a commit 3b0330b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/alg_traits.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ requiresgradient(opt) = false
allowsfg(opt)
Trait declaration for whether an optimizer
allows combined function and gradient evaluation
allows combined function and gradient evaluation
in `instantiate_function`.
Defaults to false.
Expand All @@ -161,7 +161,7 @@ requireshessian(opt) = false
allowsfgh(opt)
Trait declaration for whether an optimizer
allows combined function, gradient, and hessian
allows combined function, gradient, and hessian
evaluation in `instantiate_function`.
Defaults to false.
Expand All @@ -172,7 +172,7 @@ allowsfgh(opt) = false
requiresconsjac(opt)
Trait declaration for whether an optimizer
requires `cons_j` in `instantiate_function`, that is,
requires `cons_j` in `instantiate_function`, that is,
does the optimizer require a constraints' Jacobian.
Defaults to false.
Expand Down Expand Up @@ -205,7 +205,7 @@ allowsconsvjp(opt) = false
requiresconshess(opt)
Trait declaration for whether an optimizer
requires cons_h in `instantiate_function`, that is,
requires cons_h in `instantiate_function`, that is,
does the optimizer require constraints' hessian.
Defaults to false.
Expand All @@ -216,7 +216,7 @@ requiresconshess(opt) = false
requireslagh(opt)
Trait declaration for whether an optimizer
requires lag_h in `instantiate_function`, that is,
requires lag_h in `instantiate_function`, that is,
does the optimizer require lagrangian hessian.
Defaults to false.
Expand Down
6 changes: 3 additions & 3 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ function _remake_internal(thing; kwargs...)
named_thing = struct_as_namedtuple(thing)
if :kwargs fieldnames(typeof(thing))
if :args fieldnames(typeof(thing))
named_thing = Base.structdiff(named_thing, (;args=()))
named_thing = Base.structdiff(named_thing, (; args = ()))
if :args keys(kwargs)
k = Base.structdiff(named_thing, (;args=()))
k = Base.structdiff(named_thing, (; args = ()))
if :kwargs keys(kwargs)
T(; named_thing..., thing.kwargs..., kwargs...)
else
T(; named_thing..., kwargs[:kwargs]...)
end
else
kwargs2 = Base.structdiff((;kwargs...), (;args=()))
kwargs2 = Base.structdiff((; kwargs...), (; args = ()))
if :kwargs keys(kwargs)
T(kwargs[:args]...; named_thing..., thing.kwargs..., kwargs2...)
else
Expand Down
4 changes: 2 additions & 2 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ callback = function (state, l, pred; doplot = false) #callback function to obser
end
```
If the chosen method is a global optimizer that employs a local optimization
method, a similar set of common local optimizer arguments exists. Look at `MLSL` or `AUGLAG`
If the chosen method is a global optimizer that employs a local optimization
method, a similar set of common local optimizer arguments exists. Look at `MLSL` or `AUGLAG`
from NLopt for an example. The common local optimizer arguments are:
- `local_method`: optimizer used for local optimization in global method
Expand Down
14 changes: 7 additions & 7 deletions test/remake_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ tmp = newprob.g([0.0, 0.0, 0.0], [1.0, 2.0, 3.0], nothing, 0.0)
@test tmp[0.2, 0.4, 0.6] atol=1e-6

struct Remake_Test1
p
args
kwargs
p::Any
args::Any
kwargs::Any
end
Remake_Test1(args...; p, kwargs...) = Remake_Test1(p, args, kwargs)
a = Remake_Test1(p=1)
@test @inferred remake(a, p=2) == Remake_Test1(p=2)
@test @inferred remake(a, args=1) == Remake_Test1(1, p=1)
@test @inferred remake(a, kwargs=(;a=1)) == Remake_Test1(p=1, a=1)
a = Remake_Test1(p = 1)
@test @inferred remake(a, p = 2) == Remake_Test1(p = 2)
@test @inferred remake(a, args = 1) == Remake_Test1(1, p = 1)
@test @inferred remake(a, kwargs = (; a = 1)) == Remake_Test1(p = 1, a = 1)

0 comments on commit 3b0330b

Please sign in to comment.