Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] POI + DiffOpt = S2 #143

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ version = "0.7.0"

[deps]
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
DiffOpt = "930fe3bc-9c6b-11ea-2d94-6184641e85e7"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"

[compat]
GLPK = "1"
Expand All @@ -16,11 +18,12 @@ julia = "1.6"

[extras]
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SCS = "c946c3f1-0d1f-5ce8-9dea-7daa1f7e2d13"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["GLPK", "Ipopt", "JuMP", "LinearAlgebra", "SCS", "Test"]
test = ["GLPK", "HiGHS", "Ipopt", "JuMP", "LinearAlgebra", "SCS", "Test"]
6 changes: 5 additions & 1 deletion src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ function MOI.is_empty(model::Optimizer)
#
isempty(model.multiplicative_parameters) &&
isempty(model.dual_value_of_parameters) &&
model.number_of_parameters_in_model == 0
model.number_of_parameters_in_model == 0 &&
isempty(model.parameter_input_forward) &&
isempty(model.parameter_output_backward)
end

function MOI.empty!(model::Optimizer{T}) where {T}
Expand Down Expand Up @@ -133,6 +135,8 @@ function MOI.empty!(model::Optimizer{T}) where {T}
empty!(model.dual_value_of_parameters)
#
model.number_of_parameters_in_model = 0
empty!(model.parameter_input_forward)
empty!(model.parameter_output_backward)
return
end

Expand Down
7 changes: 7 additions & 0 deletions src/ParametricOptInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ mutable struct Optimizer{T,OT<:MOI.ModelLike} <: MOI.AbstractOptimizer
number_of_parameters_in_model::Int64
constraints_interpretation::ConstraintsInterpretationCode
save_original_objective_and_constraints::Bool

# sensitivity data
parameter_input_forward::Dict{ParameterIndex,T}
parameter_output_backward::Dict{ParameterIndex,T}
function Optimizer(
optimizer::OT;
evaluate_duals::Bool = true,
Expand Down Expand Up @@ -219,6 +223,8 @@ mutable struct Optimizer{T,OT<:MOI.ModelLike} <: MOI.AbstractOptimizer
0,
ONLY_CONSTRAINTS,
save_original_objective_and_constraints,
Dict{ParameterIndex,T}(),
Dict{ParameterIndex,T}(),
)
end
end
Expand Down Expand Up @@ -248,5 +254,6 @@ end
include("duals.jl")
include("update_parameters.jl")
include("MOI_wrapper.jl")
include("diff.jl")

end # module
Loading
Loading