@@ -16,8 +16,8 @@ struct ConstraintData{F,J,H,Tx,Tc}
1616 uc:: Vector{Tc}
1717end
1818
19- immutable OptimizationProblem{P, Tfg, Tf <: Real , TS <: AbstractString ,
20- CT <: Union{Void ,ConstraintData} }
19+ struct OptimizationProblem{P, Tfg, Tf <: Real , TS <: AbstractString ,
20+ CT <: Union{Nothing ,ConstraintData} }
2121 name:: TS
2222 f:: Function
2323 g!:: Function
@@ -37,7 +37,7 @@ OptimizationProblem(name::AbstractString,
3737 g!:: Function ,
3838 fg!:: Tfg ,
3939 h!:: Function ,
40- constraints:: Union{Void ,ConstraintData} ,
40+ constraints:: Union{Nothing ,ConstraintData} ,
4141 initial_x:: Vector ,
4242 solutions:: Vector ,
4343 minimum:: Tf ,
@@ -49,24 +49,24 @@ OptimizationProblem(name::AbstractString,
4949 istwicedifferentiable,
5050 nothing )
5151
52- objective (p:: OptimizationProblem{P} ) where P<: Void = p. f
53- gradient (p:: OptimizationProblem{P} ) where P<: Void = p. g!
54- objective_gradient (p:: OptimizationProblem{P} ) where P<: Void = p. fg!
55- hessian (p:: OptimizationProblem{P} ) where P<: Void = p. h!
52+ objective (p:: OptimizationProblem{P} ) where P<: Nothing = p. f
53+ gradient (p:: OptimizationProblem{P} ) where P<: Nothing = p. g!
54+ objective_gradient (p:: OptimizationProblem{P} ) where P<: Nothing = p. fg!
55+ hessian (p:: OptimizationProblem{P} ) where P<: Nothing = p. h!
5656
5757objective (p:: OptimizationProblem{P} ) where P = x-> p. f (x,p. parameters)
5858gradient (p:: OptimizationProblem{P} ) where P = (out,x)-> p. g! (out,x,p. parameters)
5959objective_gradient (p:: OptimizationProblem{P} ) where P = (out,x)-> p. fg! (out,x,p. parameters)
6060hessian (p:: OptimizationProblem{P} ) where P = (out,x)-> p. h! (out,x,p. parameters)
6161
62- function objective_gradient (p:: OptimizationProblem{P,Tfg} ) where P where Tfg <: Void
62+ function objective_gradient (p:: OptimizationProblem{P,Tfg} ) where P where Tfg <: Nothing
6363 (out,x) -> begin
6464 gradient (p)(out,x)
6565 return objective (p)(x)
6666 end
6767end
6868
69- function objective_gradient (p:: OptimizationProblem{P,Tfg} ) where P <: Void where Tfg <: Void
69+ function objective_gradient (p:: OptimizationProblem{P,Tfg} ) where P <: Nothing where Tfg <: Nothing
7070 (out,x) -> begin
7171 gradient (p)(out,x)
7272 return objective (p)(x)
0 commit comments