@@ -348,16 +348,6 @@ function columns(m::Optimizer, ci::MOI.ConstraintIndex{MOI.VectorOfVariables})
348348 return ColumnIndices (Mosek. getcone (m. task, coneidx)[4 ])
349349end
350350
351- function rows (
352- m:: Optimizer ,
353- ci:: MOI.ConstraintIndex{MOI.VectorAffineFunction{Float64}} ,
354- )
355- if ! (ci. value in keys (m. F_rows))
356- throw (MOI. InvalidIndex (ci))
357- end
358- return m. F_rows[ci. value]
359- end
360-
361351function _append_cone_domain (t:: Mosek.Task , n:: Int , :: MOI.ExponentialCone )
362352 @assert n == 3
363353 return Mosek. appendprimalexpconedomain (t)
@@ -624,7 +614,6 @@ function MOI.add_constraint(
624614 afei = Mosek. getnumafe (m. task)
625615 b = - reorder (axbs. constants, D, true )
626616 domi = _append_cone_domain (m. task, length (axbs. constants), dom)
627- m. F_rows[acci] = afei .+ eachindex (b)
628617 Mosek. appendafes (m. task, length (axbs. constants))
629618 Mosek. appendaccseq (m. task, domi, afei + 1 , b)
630619 rsubi, rsubj, rcof = Int64[], Int32[], Float64[]
@@ -785,23 +774,24 @@ function MOI.get(
785774 attr:: MOI.ConstraintFunction ,
786775 ci:: MOI.ConstraintIndex{MOI.VectorAffineFunction{Float64},S} ,
787776) where {S<: VectorConeDomain }
777+ MOI. throw_if_not_valid (m, ci)
788778 if length (m. sd_dim) > 0
789779 # Cannot get function if there are matrix variables
790780 throw (MOI. GetAttributeNotAllowed (attr))
791781 end
792- r = rows (m, ci)
793- frow, fcol, fval = Mosek. getaccftrip (m. task)
794- constants = Mosek. getaccb (m. task, ci. value)
795- set = MOI. Utilities. set_with_dimension (S, length (r))
782+ rows = Mosek. getaccafeidxlist (m. task, ci. value)
783+ set = MOI. Utilities. set_with_dimension (S, length (rows))
796784 terms = MOI. VectorAffineTerm{Float64}[]
797- for (frowi, fcoli, fvali) in zip (frow, fcol, fval)
798- if frowi in r
799- row = reorder (frowi - first (r) + 1 , set, false )
800- term = MOI. ScalarAffineTerm (fvali, _col_to_index (m, fcoli))
801- push! (terms, MOI. VectorAffineTerm (row, term))
785+ for (i, row) in enumerate (rows)
786+ numnz, varidx, val = Mosek. getafefrow (m. task, row)
787+ output_index = reorder (i, set, false )
788+ for (coli, vali) in zip (varidx, val)
789+ term = MOI. ScalarAffineTerm (vali, _col_to_index (m, coli))
790+ push! (terms, MOI. VectorAffineTerm (output_index, term))
802791 end
803792 end
804- return MOI. VectorAffineFunction (terms, - reorder (constants, S, false ))
793+ constants = - reorder (Mosek. getaccb (m. task, ci. value), S, false )
794+ return MOI. VectorAffineFunction (terms, constants)
805795end
806796
807797function _type_cone (ct)
@@ -948,26 +938,28 @@ function MOI.is_valid(
948938 return Mosek. getdomaintype (model. task, domidx) == _domain (S)
949939end
950940
951- # Commenting out as it doesn't work (gives a MethodError)
952-
953- # Deleting a constraint block means clearing non-zeros from the its
954- # AFE rows and resetting the underlying ACC to an empty domain. We do
955- # not reclaim the AFEs.
956- # function MOI.delete(m::Optimizer,
957- # cref::MOI.ConstraintIndex{F,D}) where {F <: MOI.VectorAffineFunction{Float64},
958- # D <: VectorConeDomain}
959- # MOI.throw_if_not_valid(m, cref)
960- # Mosek.putaccname(m.task,cref.value,"")
961- # afeidxs = Mosek.getaccafeidxlist(m.task,cref.value)
962- # # clear afe non-zeros, but don't delete or reuse afe idx
963- # # FIXME gives a MethodError
964- # Mosek.putafefrowlist(afeidxs,zeros(Int32,length(afeidxs)),zeros(Int64,length(afeidxs)),Int32[],Float64[])
965- # putaccdom(m.task,
966- # cref.value,
967- # 1, # the empty zero domain,
968- # Int64[],
969- # Float64[])
970- # end
941+ # Deleting a constraint block means clearing non-zeros from the its AFE rows and
942+ # resetting the underlying ACC to an empty domain. We do not reclaim the AFEs.
943+ function MOI. delete (
944+ m:: Optimizer ,
945+ cref:: MOI.ConstraintIndex{MOI.VectorAffineFunction{Float64},S} ,
946+ ) where {S<: VectorConeDomain }
947+ MOI. throw_if_not_valid (m, cref)
948+ Mosek. putaccname (m. task, cref. value, " " )
949+ afeidxs = Mosek. getaccafeidxlist (m. task, cref. value)
950+ Mosek. putafefrowlist (
951+ m. task,
952+ afeidxs,
953+ zeros (Int32, length (afeidxs)),
954+ ones (Int64, length (afeidxs)),
955+ Int32[],
956+ Float64[],
957+ )
958+ Mosek. putacc (m. task, cref. value, Mosek. MSK_DOMAIN_RZERO, Int64[], Float64[])
959+ delete! (m. con_to_name, cref)
960+ m. name_to_con = nothing
961+ return
962+ end
971963
972964function MOI. is_valid (
973965 model:: Optimizer ,
0 commit comments