https://github.com/samuelsonric/mathoptchordaldecomposition.jl
https://github.com/samuelsonric/mathoptchordaldecomposition.jl
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/samuelsonric/mathoptchordaldecomposition.jl
- Owner: samuelsonric
- Created: 2025-05-01T20:30:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-02T15:38:24.000Z (about 1 year ago)
- Last Synced: 2025-05-02T15:50:12.216Z (about 1 year ago)
- Language: Julia
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MathOptChordalDecomposition.jl
[](https://github.com/samuelsonric/MathOptChordalDecomposition.jl/actions/workflows/ci.yml)
[](https://codecov.io/gh/samuelsonric/MathOptChordalDecomposition.jl)
MathOptChordalDecomposition.jl is a [MathOptInterface.jl](https://github.com/jump-dev/MathOptInterface.jl)
layer that implements chordal decomposition of sparse semidefinite constraints.
## Getting help
If you need help, please ask a question on the [JuMP community forum](https://jump.dev/forum).
If you have a reproducible example of a bug, please [open a GitHub issue](https://github.com/samuelsonric/MathOptChordalDecomposition.jl/issues/new).
## License
`MathOptChordalDecomposition.jl` is licensed under the
[MIT License](https://github.com/samuelsonric/MathOptChordalDecomposition.jl/blob/master/LICENSE).
## Installation
Install MathOptChordalDecomposition as follows:
```julia
import Pkg
Pkg.add("MathOptChordalDecomposition")
```
## Use with JuMP
To use MathOptChordalDecomposition with JuMP, use `MathOptChordalDecomposition.Optimizer`:
```julia
using JuMP, MathOptChordalDecomposition, SCS
model = Model(() -> MathOptChordalDecomposition.Optimizer(SCS.Optimizer))
```
Change `SCS` for any other conic solver that supports semidefinite constraints.
## Basic Usage
The `sdplib` directory contains four semidefinite programming problems from the
[SDPLIB library](https://github.com/vsdp/SDPLIB).
The function `main`, defined below, reads one of the problems and
constructs a [JuMP.jl](https://github.com/jump-dev/JuMP.jl) model.
For this example, it is significantly faster to solve the problem with
MathOptChordalDecomposition than to use SCS by itself:
```julia
julia> using FileIO, JLD2, JuMP, LinearAlgebra, SCS
julia> import MathOptChordalDecomposition as MOCD
julia> function main(optimizer, name::String)
data = FileIO.load("./sdplib/$name.jld2");
F, c, m, n = data["F"], data["c"], data["m"], data["n"]
model = Model(optimizer)
set_silent(model)
@variable(model, x[1:m])
@objective(model, Min, c' * x)
@constraint(
model,
con,
LinearAlgebra.Symmetric(-F[1] + x' * F[2:end]) in PSDCone(),
)
optimize!(model)
return objective_value(model)
end
main (generic function with 1 method)
julia> @time main(SCS.Optimizer, "mcp124-1")
9.447474 seconds (154.70 k allocations: 12.313 MiB)
141.96561765120785
julia> @time main(() -> MOCD.Optimizer(SCS.Optimizer), "mcp124-1")
0.245992 seconds (170.72 k allocations: 15.103 MiB, 1.85% compilation time)
141.9887372030578
```