Nonconvex.jl
                                
                                
                                
                                    Nonconvex.jl copied to clipboard
                            
                            
                            
                        DictModel cannot convert a JuMP model with quadratic objective
julia> using JuMP
julia> import Nonconvex
julia> Nonconvex.@load Ipopt
[ Info: Attempting to load the package NonconvexIpopt.
[ Info: Loading succesful.
julia> model = JuMP.Model();
julia> @variable(model, x >= 0)
x
julia> @objective(model, Min, x^2)
x²
julia> ncvx_model = DictModel(model)
ERROR: AssertionError: obj isa AffExpr
Stacktrace:
 [1] get_objective_info(model::JuMP.Model, nvars::Int64)
   @ NonconvexCore ~/.julia/packages/NonconvexCore/YjDSM/src/models/jump.jl:184
 [2] DictModel(model::JuMP.Model)
   @ NonconvexCore ~/.julia/packages/NonconvexCore/YjDSM/src/models/jump.jl:204
 [3] top-level scope
   @ REPL[7]:1
cc @ccoffrin
Adding an epigraph variable also fails:
julia> using JuMP
julia> import Nonconvex
julia> Nonconvex.@load Ipopt
[ Info: Attempting to load the package NonconvexIpopt.
[ Info: Loading succesful.
julia> model = JuMP.Model();
julia> @variable(model, x >= 0)
x
julia> @variable(model, t)
t
julia> @constraint(model, t >= x^2)
-x² + t ≥ 0.0
julia> @objective(model, Min, t)
t
julia> ncvx_model = DictModel(model)
ERROR: AssertionError: obj isa AffExpr
Stacktrace:
 [1] get_objective_info(model::JuMP.Model, nvars::Int64)
   @ NonconvexCore ~/.julia/packages/NonconvexCore/YjDSM/src/models/jump.jl:184
 [2] DictModel(model::JuMP.Model)
   @ NonconvexCore ~/.julia/packages/NonconvexCore/YjDSM/src/models/jump.jl:204
 [3] top-level scope
   @ REPL[17]:1
                                    
                                    
                                    
                                
Yes currently I only support linear expressions because this is the main utility of using JuMP over Nonconvex directly to define objectives or constraints. Extending this is possible but it will need to add support for more expression types in https://github.com/JuliaNonconvex/NonconvexCore.jl/blob/master/src/models/jump.jl.