Skip to content

Commit b29d41b

Browse files
committed
Improve the error message for VectorNonlinearFunction
1 parent 6f26c06 commit b29d41b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/MOI_wrapper.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ MOI.supports_constraint(::Optimizer, ::Type{VAF}, ::Type{<:VLS}) = true
8585
MOI.supports_constraint(::Optimizer, ::Type{SQF}, ::Type{<:ALS}) = true
8686
MOI.supports_constraint(::Optimizer, ::Type{VQF}, ::Type{<:VLS}) = true
8787
MOI.supports_constraint(::Optimizer, ::Type{SNF}, ::Type{<:ALS}) = true
88-
MOI.supports_constraint(::Optimizer, ::Type{VNF}, ::Type{<:VLS}) = true
8988

9089
function MOI.copy_to(dest::Optimizer, src::MOI.ModelLike)
9190
if !haskey(dest.options, "solver")

src/utils.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ function parser_MOI(moimodel, index_map, nvar)
380380

381381
contypes = MOI.get(moimodel, MOI.ListOfConstraintTypesPresent())
382382
for (F, S) in contypes
383-
F <: AF || F <: QF || F <: NF || F == VI || error("Function $F is not supported.")
383+
(F == VNF) && error("The function $F is not supported. Please use `.<=`, `.==`, and `.>=` in your constraints to ensure compatibility with ScalarAffineFunction.")
384+
F <: AF || F <: QF || F == SNF || F == VI || error("Function $F is not supported.")
384385
S <: LS || error("Set $S is not supported.")
385386

386387
conindices = MOI.get(moimodel, MOI.ListOfConstraintIndices{F, S}())
@@ -432,7 +433,7 @@ _nlp_model(::MOI.Nonlinear.Model, ::MOI.ModelLike, ::Type, ::Type) = false
432433
function _nlp_model(
433434
dest::MOI.Nonlinear.Model,
434435
src::MOI.ModelLike,
435-
F::Type{<:NF},
436+
F::Type{SNF},
436437
S::Type,
437438
)
438439
has_nonlinear = false

0 commit comments

Comments
 (0)