Skip to content
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
11 changes: 10 additions & 1 deletion ext/ExaModelsMOI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,17 @@ function copy_constraints!(c, moim, var_to_idx, T)

con_types = MOI.get(moim, MOI.ListOfConstraintTypesPresent())
for (F, S) in con_types
F <: MOI.VariableIndex && continue
cis = MOI.get(moim, MOI.ListOfConstraintIndices{F,S}())
if F <: MOI.VariableIndex
for ci in cis
vi = MOI.get(moim, MOI.ConstraintFunction(), ci)
vartype, var_idx = var_to_idx[vi]
if vartype === :variable
con_to_idx[ci] = var_idx
end
end
continue
end
bin, offset =
exafy_con(moim, cis, bin, offset, lcon, ucon, y0, var_to_idx, con_to_idx)
end
Expand Down
9 changes: 9 additions & 0 deletions test/JuMPTest/JuMPTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,15 @@ function runtests()
set_optimizer_attribute(jm, "print_level", 0)
optimize!(jm)
sol = value.(all_variables(jm))
dsol = dual.(all_constraints(jm, include_variable_in_set_constraints = true))

set_optimizer(jm, () -> ExaModels.Optimizer(ipopt))
set_optimizer_attribute(jm, "print_level", 0)
optimize!(jm)
sol2 = value.(all_variables(jm))
dsol2 = dual.(all_constraints(jm, include_variable_in_set_constraints = true))
@test sol ≈ sol2 atol = 1.0e-6
@test dsol ≈ dsol2 atol = 1.0e-6

for backend in BACKENDS
@testset "$backend" begin
Expand Down