Skip to content

Conversation

@sshin23
Copy link
Collaborator

@sshin23 sshin23 commented Nov 29, 2025

closes #198
cc: @klamike @odow

@github-actions
Copy link
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/ext/ExaModelsJuMP.jl b/ext/ExaModelsJuMP.jl
index 879aee6..b66df0d 100644
--- a/ext/ExaModelsJuMP.jl
+++ b/ext/ExaModelsJuMP.jl
@@ -7,7 +7,7 @@ function ExaModels.ExaModel(jm::JuMP.GenericModel{T}; options...) where {T}
     if JuMP.nonlinear_model(jm) != nothing
         error("The legacy nonlinear model interface is not supported. Please use the new MOI-based interface.")
     end
-    
+
     return ExaModels.ExaModel(JuMP.backend(jm); T = T, options...)
 end
 
diff --git a/test/JuMPTest/JuMPTest.jl b/test/JuMPTest/JuMPTest.jl
index 60f2c9a..782cd71 100644
--- a/test/JuMPTest/JuMPTest.jl
+++ b/test/JuMPTest/JuMPTest.jl
@@ -28,14 +28,14 @@ function nlp_legacy_runtests()
     jm = JuMP.Model()
 
     JuMP.@variable(jm, x[1:10])
-    JuMP.@NLobjective(jm, Min, sum(x[i] for i=1:10))
+    JuMP.@NLobjective(jm, Min, sum(x[i] for i in 1:10))
 
     @test_throws ErrorException ExaModel(jm)
 
     jm = JuMP.Model(() -> ExaModels.Optimizer(NLPModelsIpopt.ipopt))
-    @test_throws ErrorException optimize!(jm)
+    return @test_throws ErrorException optimize!(jm)
 end
-    
+
 function fixed_variable_e2etest()
     N=5
     jm = JuMP.Model()

return
end

function MOI.set(model::Optimizer, ::MOI.NLPBlock, nlp_data::MOI.NLPBlockData)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to do something similar to this for the ExaModel(::MOI.ModelLike) API?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be more specific @klamike ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two APIs, ExaModels.Optimizer for solving with ExaModels and ExaModel(::JuMP.Model) to get the underlying examodel directly. I think this fix only covers the first case, not the second.

@amontoison amontoison merged commit e31b8b7 into main Dec 15, 2025
7 of 14 checks passed
@amontoison amontoison deleted the ss/error_moi_nonlinear branch December 15, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExaModelsMOI is ignoring the old nonlinear API

4 participants