Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to MOI v1 #11

Merged
merged 3 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CDCS"
uuid = "4fe2ecd4-b952-581a-b4b6-a532675a646e"
repo = "https://github.com/oxfordcontrol/CDCS.jl.git"
version = "0.1.2"
version = "0.2.0"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -11,8 +11,8 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
MATLAB = "0.7.3, 0.8"
MathOptInterface = "0.9.12"
julia = "1"
MathOptInterface = "1"
julia = "1.6"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
53 changes: 49 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,66 @@ To use it with [JuMP](https://github.com/JuliaOpt/JuMP.jl), simply do
```julia
using JuMP
using CDCS
model = Model(with_optimizer(CDCS.Optimizer))
model = Model(optimizer_with_attributes(CDCS.Optimizer))
```
To suppress output, do
To suppress output, do either
```julia
model = Model(with_optimizer(CDCS.Optimizer, verbose=0))
set_silent(model)
```
or
```julia
model = Model(optimizer_with_attributes(CDCS.Optimizer, verbose=0))
```

## Installation

You can install `CDCS.jl` through the
[Julia package manager](https://docs.julialang.org/en/v1/stdlib/Pkg/index.html):
```julia
] add https://github.com/oxfordcontrol/CDCS.jl.git
] add CDCS
```
but you first need to make sure that you satisfy the requirements of the
[MATLAB.jl](https://github.com/JuliaInterop/MATLAB.jl) Julia package and that
the CDCS software is installed in your
[MATLAB™](http://www.mathworks.com/products/matlab/) installation.

### Troubleshooting

#### CDCS not in PATH

If you get the error:
```
Undefined function or variable 'cdcs'.

Error using save
Variable 'jx_cdcs_arg_out_1' not found.

Linear Programming example: Error During Test at /home/blegat/.julia/dev/CDCS/test/lp.jl:5
Got exception outside of a @test
MATLAB.MEngineError("failed to get variable jx_cdcs_arg_out_1 from MATLAB session")
Stacktrace:
[1] get_mvariable(session::MATLAB.MSession, name::Symbol)
@ MATLAB ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:164
[2] mxcall(::MATLAB.MSession, ::Symbol, ::Int64, ::Matrix{Float64}, ::Vararg{Any})
@ MATLAB ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:297
[3] mxcall
@ ~/.julia/packages/MATLAB/SVjnA/src/engine.jl:317 [inlined]
[4] cdcs(A::Matrix{Float64}, b::Vector{Float64}, c::Vector{Float64}, K::CDCS.Cone; kws::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Int64}}})
```
The error means that we try to find the `cdcs` function with 1 output argument using the MATLAB C API but it wasn't found.
This most likely means that you did not add CDCS to the MATLAB's path (i.e. the `toolbox/local/pathdef.m` file).

If modifying `toolbox/local/pathdef.m` does not work, the following should work where `/path/to/CDCS/` is the directory where the `CDCS` folder is located:
```julia
julia> using MATLAB

julia> cd("/path/to/CDCS/") do
mat"cdcsInstall"
end
```
This should make `CDCS.jl` work for the Julia session in which this is run.
Alternatively, run
```julia
julia> mat"savepath"
```
to make `CDCS.jl` work for future Julia sessions.
Loading