diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79a4c27..a260def 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,13 @@ jobs: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - uses: julia-actions/cache@v3 + - name: MOI + shell: julia --project=@. {0} + run: | + using Pkg + Pkg.add([ + PackageSpec(name="MathOptInterface", rev="bl/linearity"), + ]) - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 with: diff --git a/src/ArrayDiff.jl b/src/ArrayDiff.jl index 0601b35..31016f6 100644 --- a/src/ArrayDiff.jl +++ b/src/ArrayDiff.jl @@ -86,6 +86,12 @@ function from_onnx end model(::Mode{S}) where {S} = Model{eltype(S)}() +# Hook so that solvers using `MOI.Nonlinear.model(backend)` (for example, +# NLopt and NLPModelsJuMP) receive an ArrayDiff model for an ArrayDiff mode. +# ArrayDiff's model natively parses scalar and array nonlinear functions, but +# not the `MOI.VectorNonlinearOracle` set, hence no oracle layer either. +Nonlinear.model(mode::Mode) = model(mode) + # Extend MOI.Nonlinear.set_objective so that solvers calling # MOI.Nonlinear.set_objective(arraydiff_model, snf) dispatch here. function Nonlinear.set_objective(model::Model, obj::MOI.ScalarNonlinearFunction)