Skip to content

Commit

Permalink
[MOI] update signatures of callbacks in MOI wrapper (#351)
Browse files Browse the repository at this point in the history
Co-authored-by: Sungho Shin <sshin@anl.gov>
  • Loading branch information
frapac and sshin23 authored Nov 12, 2024
1 parent 4cbd998 commit fb02d29
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ext/MadNLPMOI/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mutable struct QPBlockData{T}
end
end

function _value(variable::MOI.VariableIndex, x::Vector, p::Dict)
function _value(variable::MOI.VariableIndex, x::AbstractVector, p::Dict)
if _is_parameter(variable)
return p[variable.value]
else
Expand All @@ -97,7 +97,7 @@ end

function eval_function(
f::MOI.ScalarQuadraticFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
)::T where {T}
y = f.constant
Expand All @@ -118,7 +118,7 @@ end

function eval_function(
f::MOI.ScalarAffineFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
)::T where {T}
y = f.constant
Expand All @@ -129,9 +129,9 @@ function eval_function(
end

function eval_dense_gradient(
∇f::Vector{T},
∇f::AbstractVector{T},
f::MOI.ScalarQuadraticFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
adj::T,
)::Nothing where {T}
Expand All @@ -154,9 +154,9 @@ function eval_dense_gradient(
end

function eval_dense_gradient(
∇f::Vector{T},
∇f::AbstractVector{T},
f::MOI.ScalarAffineFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
adj::T,
)::Nothing where {T}
Expand Down Expand Up @@ -201,7 +201,7 @@ end
function eval_sparse_gradient(
∇f::AbstractVector{T},
f::MOI.ScalarQuadraticFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
)::Int where {T}
i = 0
Expand Down Expand Up @@ -229,7 +229,7 @@ end
function eval_sparse_gradient(
∇f::AbstractVector{T},
f::MOI.ScalarAffineFunction{T},
x::Vector{T},
x::AbstractVector{T},
p::Dict{Int64,T},
)::Int where {T}
i = 0
Expand Down

0 comments on commit fb02d29

Please sign in to comment.