Skip to content

isapprox for a VectorNonlinearFunction after simple bridge modifications #2553

@DimitriAlston

Description

@DimitriAlston

I am working on adding support for MOI.ScalarNonlinearFunction to EAGO and I am running into a particular error with some tests.

I cannot provide a MWE since I have not pushed any of my changes yet, but this is how I am running my tests.

import EAGO
import MathOptInterface as MOI

model = MOI.instantiate(
        EAGO.Optimizer;
        with_bridge_type = Float64,
        with_cache_type = Float64,
)
config = MOI.Test.Config(;
             atol = 1e-3,
             rtol = 1e-3,
             exclude = Any[
                 MOI.DualObjectiveValue,
                 MOI.ConstraintBasisStatus,
                 MOI.VariableBasisStatus,
                 MOI.ConstraintDual,
             ],
)
MOI.empty!(model)

MOI.Test.test_basic_VectorNonlinearFunction_CountAtLeast(model, config)

I have excluded the other tests (which are all test_basic_VectorNonlinearFunction_) in this example, but they all return the same error.

ERROR: MethodError: no method matching filter_variables(::MathOptInterface.Utilities.var"#17#18"{Set{MathOptInterface.VariableIndex}}, ::MathOptInterface.VectorNonlinearFunction)
Closest candidates are:
  filter_variables(::F, ::Any, ::Any) where F<:Function
  filter_variables(::Function, ::MathOptInterface.VariableIndex)
  filter_variables(::Function, ::MathOptInterface.VectorOfVariables)
  ...

The way I implemented MOI.ScalarNonlinearFunction is similar to Optim.jl https://github.com/JuliaNLSolvers/Optim.jl/blob/658c39a316bda911cddf442702b11bf086f1b5ba/ext/OptimMOIExt.jl
where the functions are added to a MOI.Nonlinear.Model and then used to create a MOI.Nonlinear.Evaluator and MOI.NLPBlockData to continue using the old nonlinear interface.

I am not sure if this issue is because I am not directly storing the functions or something else, but I figured I would check here first for insight before moving forward.
Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions