Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jul 10, 2024
1 parent 6eacfe0 commit c7f3c55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/MOI_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ const _SetWithDotProd = MOI.SetWithDotProducts{
MOI.TriangleVectorization{MOI.LowRankMatrix{Cdouble}},
}

const SupportedSets = Union{
MOI.Nonnegatives,
MOI.PositiveSemidefiniteConeTriangle,
_SetWithDotProd,
}
const SupportedSets =
Union{MOI.Nonnegatives,MOI.PositiveSemidefiniteConeTriangle,_SetWithDotProd}

mutable struct Optimizer <: MOI.AbstractOptimizer
objective_constant::Float64
Expand Down Expand Up @@ -263,7 +260,9 @@ function _fill!(
blk, i, j = model.varmap[t.variable.value]
_fill_until(model, abs(blk), entptr, type, length(ent))
if type[end] == Cchar('l')
error("Can either have one dot product variable or several normal variables in the same constraint")
error(
"Can either have one dot product variable or several normal variables in the same constraint",
)
end
if blk < 0
type[end] = Cchar('l')
Expand Down
16 changes: 11 additions & 5 deletions test/test_simple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import Random
import MathOptInterface as MOI

# This is `test_conic_PositiveSemidefiniteConeTriangle_VectorOfVariables`
@testset "Solve simple with sdplrlib with $file" for file in ["simple_sparse.jl", "simple_lowrank.jl"]
@testset "Solve simple with sdplrlib with $file" for file in [
"simple_sparse.jl",
"simple_lowrank.jl",
]
include(file)
# The `925` seed is taken from SDPLR's `main.c`
Random.seed!(925)
Expand Down Expand Up @@ -43,9 +46,11 @@ end
function simple_lowrank_model()
model = SDPLR.Optimizer()
A = MOI.LowRankMatrix(
[-1/4, 1/4],
[-1.0 1.0
1.0 1.0]
[-1 / 4, 1 / 4],
[
-1.0 1.0
1.0 1.0
],
)
X, _ = MOI.add_constrained_variables(
model,
Expand Down Expand Up @@ -76,7 +81,8 @@ function simple_test(model, X, c)
@test σ sigma
end

@testset "MOI wrapper for $f" for f in [simple_sparse_model, simple_lowrank_model]
@testset "MOI wrapper for $f" for f in
[simple_sparse_model, simple_lowrank_model]
model, X, c = f()
MOI.optimize!(model)
simple_test(model, X, c)
Expand Down

0 comments on commit c7f3c55

Please sign in to comment.