Skip to content

Commit

Permalink
Merge pull request #192 from JuliaOpt/bl/removecones-b1.1-msk9.1
Browse files Browse the repository at this point in the history
Shift indices given to removecones
  • Loading branch information
ulfworsoe authored Nov 20, 2019
2 parents 0489f4b + ea79b26 commit c9ab81e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/msk_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8384,7 +8384,7 @@ removecones(task:: MSKtask,subset:: Vector{T1}) where {T1} = removecones(task,co
function removecones(task_:: MSKtask,subset_:: Vector{Int32})
num_ = minimum([ length(subset_) ])
res = disable_sigint() do
@msk_ccall( "removecones",Int32,(Ptr{Nothing},Int32,Ptr{Int32},),task_.task,num_,subset_ .- Int32(1))
@msk_ccall( "removecones",Int32,(Ptr{Nothing},Int32,Ptr{Int32},),task_.task,num_, subset_ .- Int32(1))
end
if res != MSK_RES_OK.value
msg = getlasterror(task_)
Expand Down
24 changes: 24 additions & 0 deletions test/apitest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,26 @@ function test_sdo1()
end
end

function test_removecones()
task = maketask()
appendvars(task, 7)
appendcone(task, MSK_CT_QUAD, 0.0, [1, 2, 3])
appendcone(task, MSK_CT_RQUAD, 0.0, [4, 5, 6, 7])
@test getcone(task, 1) == (Mosek.MSK_CT_QUAD, 0.0, 3, Int32[1, 2, 3])
@test getconeinfo(task, 1) == (Mosek.MSK_CT_QUAD, 0.0, 3)
@test getcone(task, 2) == (Mosek.MSK_CT_RQUAD, 0.0, 4, Int32[4, 5, 6, 7])
@test getconeinfo(task, 2) == (Mosek.MSK_CT_RQUAD, 0.0, 4)
removecones(task, [1])
info = getconeinfo(task, 1)
# `info[1]` is Mosek.MSK_CT_QUAD
@test_broken info[1] == Mosek.MSK_CT_RQUAD
@test info[2:end] == (0.0, 4)
cone = getcone(task, 1)
# `cone[1]` is Mosek.MSK_CT_QUAD
@test_broken cone[1] == Mosek.MSK_CT_RQUAD
@test cone[2:end] == (0.0, 4, Int32[4, 5, 6, 7])
end

@testset "[apitest]" begin
@testset "lo1" begin
test_lo1()
Expand All @@ -319,5 +339,9 @@ end
test_sdo1()
end

@testset "removecones" begin
test_removecones()
end

end

0 comments on commit c9ab81e

Please sign in to comment.