Skip to content

Commit

Permalink
Review types (#137)
Browse files Browse the repository at this point in the history
* Generalize types

* Remove `zeros` and `ones`
  • Loading branch information
tmigot authored Jul 4, 2024
1 parent 1c12a31 commit 2326d3e
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 136 deletions.
2 changes: 1 addition & 1 deletion src/FletcherPenaltySolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import SolverCore.solve!
export fps_solve, solve!

"""
fps_solve(nlp::AbstractNLPModel, x0::AbstractVector{T} = nlp.meta.x0; subsolver_verbose::Int = 0, kwargs...)
fps_solve(nlp::AbstractNLPModel{T, S}, x0::S = nlp.meta.x0; subsolver_verbose::Int = 0, kwargs...)
Compute a local minimum of a bound and equality-constrained optimization problem using Fletcher's penalty function and the implementation described in
Expand Down
16 changes: 8 additions & 8 deletions src/feasibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Approximately solves `min ‖c(x) - l‖`, where l is nlp.meta.lcon, using a tru
"""
function feasibility_step(
feasibility_solver::GNSolver,
nlp::AbstractNLPModel,
x::AbstractVector{T},
cx::AbstractVector{T},
nlp::AbstractNLPModel{T, S},
x::S,
cx::S,
normcx::T,
Jx::Union{LinearOperator{T}, AbstractMatrix{T}},
Jx, #::Union{LinearOperator{T}, AbstractMatrix{T}},
ρ::T,
ctol::AbstractFloat,
verbose;
Expand All @@ -38,7 +38,7 @@ function feasibility_step(
max_eval::Int = 1_000,
max_time::AbstractFloat = 60.0,
max_feas_iter::Int = typemax(Int64),
) where {T}
) where {T, S}
z = x
cz = cx
Jz = Jx
Expand Down Expand Up @@ -207,12 +207,12 @@ using `lsmr` method from `Krylov.jl`.
"""
function TR_lsmr(
solver,
cz::AbstractVector{T},
Jz::Union{LinearOperator{T}, AbstractMatrix{T}},
cz,
Jz,
ctol::AbstractFloat,
Δ::T,
normcz::AbstractFloat,
Jd::AbstractVector{T},
Jd,
) where {T}
Krylov.solve!(
solver,
Expand Down
Loading

0 comments on commit 2326d3e

Please sign in to comment.