Skip to content

Commit

Permalink
Merge ae51176 into 0558de2
Browse files Browse the repository at this point in the history
  • Loading branch information
rschwarz committed Mar 8, 2019
2 parents 0558de2 + ae51176 commit 717eacf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ function MOI.get(o::Optimizer, ::MOI.NumberOfConstraints{F,S}) where {F,S}
return haskey(o.constypes, (F, S)) ? length(o.constypes[F, S]) : 0
end

function MOI.get(o::Optimizer, ::MOI.ListOfConstraints)
return collect(keys(o.constypes))
end

function MOI.optimize!(o::Optimizer)
@SC SCIPsolve(o)
return nothing
Expand Down
45 changes: 39 additions & 6 deletions test/MOI_wrapper.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using MathOptInterface
const MOI = MathOptInterface
const MOIB = MOI.Bridges
const MOIT = MOI.Test

const optimizer = SCIP.Optimizer(display_verblevel=0)
const config = MOIT.TestConfig(duals=false, infeas_certificates=false)
const OPTIMIZER = SCIP.Optimizer(display_verblevel=0)
const SCALARIZED = MOIB.Scalarize{Float64}(SCIP.Optimizer(display_verblevel=0))
const CONFIG = MOIT.TestConfig(atol=1e-5, rtol=1e-5, duals=false,
infeas_certificates=false)

@testset "MOI Continuous Linear" begin
excluded = [
Expand All @@ -16,16 +19,46 @@ const config = MOIT.TestConfig(duals=false, infeas_certificates=false)
"linear15", # needs MOI.VectorAffineFunction
"partial_start", # TODO: supportVariablePrimalStart
]
MOIT.contlineartest(optimizer, config, excluded)
MOIT.contlineartest(OPTIMIZER, CONFIG, excluded)
end

@testset "MOI Integer Linear" begin
MOIT.intlineartest(optimizer, config)
@testset "MOI Continuous Linear - ScalarizeBridge" begin
excluded = [
"linear1", # needs MOI.delete (of variables in constraints)
"linear5", # needs MOI.delete (of variables in constraints)
"linear11", # broken in SCIP (#2556)
"linear13", # TODO: support MOI.FEASIBILITY_SENSE
"linear14", # needs MOI.delete (of variables in constraints)
"partial_start", # TODO: supportVariablePrimalStart
]
MOIT.contlineartest(SCALARIZED, CONFIG, excluded)
end

@testset "MOI Continuous Conic - ScalarizeBridge" begin
MOIT.lintest(SCALARIZED, CONFIG)

# needs VectorAffineFunction
# MOIT.soctest(SCALARIZED, CONFIG)

# other cones not supported
end

@testset "MOI Quadratic Constraint" begin
excluded = [
"qcp1", # needs VectorAffineFunction
]
MOIT.qcptest(optimizer, config, excluded)
MOIT.qcptest(OPTIMIZER, CONFIG, excluded)
end

@testset "MOI Quadratic Constraint - ScalarizeBridge" begin
MOIT.qcptest(SCALARIZED, CONFIG)
end

@testset "MOI Integer Linear" begin
MOIT.intlineartest(OPTIMIZER, CONFIG)
end

@testset "MOI Integer Conic - ScalarizeBridge" begin
# needs VectorAffineFunction
# MOIT.intconictest(SCALARIZED, CONFIG)
end

0 comments on commit 717eacf

Please sign in to comment.