15.3 Functions in alphabetical order¶
- analyzenames¶
function analyzenames(task::MSKtask, whichstream::Streamtype, nametype::Nametype)
The function analyzes the names and issues an error if a name is invalid.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)nametype
(Nametype
) – The type of names e.g. valid in MPS or LP files. (input)
- Groups:
- analyzeproblem¶
function analyzeproblem(task::MSKtask, whichstream::Streamtype)
The function analyzes the data of a task and writes out a report.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)
- Groups:
- analyzesolution¶
function analyzesolution(task::MSKtask, whichstream::Streamtype, whichsol::Soltype)
Print information related to the quality of the solution and other solution statistics.
By default this function prints information about the largest infeasibilites in the solution, the primal (and possibly dual) objective value and the solution status.
Following parameters can be used to configure the printed statistics:
MSK_IPAR_ANA_SOL_BASIS
enables or disables printing of statistics specific to the basis solution (condition number, number of basic variables etc.). Default is on.MSK_IPAR_ANA_SOL_PRINT_VIOLATED
enables or disables listing names of all constraints (both primal and dual) which are violated by the solution. Default is off.MSK_DPAR_ANA_SOL_INFEAS_TOL
is the tolerance defining when a constraint is considered violated. If a constraint is violated more than this, it will be listed in the summary.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups:
- appendacc¶
function appendacc(task::MSKtask, domidx::Int64, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}) function appendacc(task::MSKtask, domidx::T0, afeidxlist::T1, b::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Appends an affine conic constraint to the task. The affine constraint has the form a sequence of affine expressions belongs to a domain.
The domain index is specified with
domidx
and should refer to a domain previously appended with one of theappend...domain
functions.The length of the affine expression list
afeidxlist
must be equal to the dimension \(n\) of the domain. The elements ofafeidxlist
are indexes to the store of affine expressions, i.e. the affine expressions appearing in the affine conic constraint are:\[F_{\mathtt{afeidxlist}[k],:}x + g_{\mathtt{afeidxlist}[k]} \quad \mathrm{for}\ k=\idxbeg,\ldots,\idxend{n}.\]If an optional vector
b
of the same length asafeidxlist
is specified then the expressions appearing in the affine constraint will instead be taken as:\[F_{\mathtt{afeidxlist}[k],:}x + g_{\mathtt{afeidxlist}[k]} - b_k \quad \mathrm{for}\ k=\idxbeg,\ldots,\idxend{n}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Domain index. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- appendaccs¶
function appendaccs(task::MSKtask, domidxs::Vector{Int64}, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}) function appendaccs(task::MSKtask, domidxs::T0, afeidxlist::T1, b::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Appends
numaccs
affine conic constraint to the task. Each single affine conic constraint should be specified as inappendacc
and the input of this function should contain the concatenation of all these descriptions.In particular, the length of
afeidxlist
must equal the sum of dimensions of domains indexed indomainsidxs
.- Parameters:
task
(MSKtask
) – An optimization task. (input)domidxs
(Int64
[]
) – Domain indices. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- appendaccseq¶
function appendaccseq(task::MSKtask, domidx::Int64, afeidxfirst::Int64, b::Union{Nothing,Vector{Float64}}) function appendaccseq(task::MSKtask, domidx::T0, afeidxfirst::T1, b::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Appends an affine conic constraint to the task, as in
appendacc
. The function assumes the affine expressions forming the constraint are sequential. The affine constraint has the form a sequence of affine expressions belongs to a domain.The domain index is specified with
domidx
and should refer to a domain previously appended with one of theappend...domain
functions.The number of affine expressions should be equal to the dimension \(n\) of the domain. The affine expressions forming the affine constraint are arranged sequentially in a contiguous block of the affine expression store starting from position
afeidxfirst
. That is, the affine expressions appearing in the affine conic constraint are:\[F_{\mathtt{afeidxfirst}+k,:}x + g_{\mathtt{afeidxfirst}+k} \quad \mathrm{for}\ k=\idxbeg,\ldots,\idxend{n}.\]If an optional vector
b
of lengthnumafeidx
is specified then the expressions appearing in the affine constraint will instead be taken as\[F_{\mathtt{afeidxfirst}+k,:}x + g_{\mathtt{afeidxfirst}+k} - b_k \quad \mathrm{for}\ k=\idxbeg,\ldots,\idxend{n}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Domain index. (input)afeidxfirst
(Int64
) – Index of the first affine expression. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- appendaccsseq¶
function appendaccsseq(task::MSKtask, domidxs::Vector{Int64}, numafeidx::Int64, afeidxfirst::Int64, b::Union{Nothing,Vector{Float64}}) function appendaccsseq(task::MSKtask, domidxs::T0, numafeidx::T1, afeidxfirst::T2, b::T3) where { T0<:AbstractVector{<:Integer}, T1<:Integer, T2<:Integer, T3<:AbstractVector{<:Number} }
Appends
numaccs
affine conic constraint to the task. It is the block variant ofappendaccs
, that is it assumes that the affine expressions appearing in the affine conic constraints are sequential in the affine expression store, starting from positionafeidxfirst
.- Parameters:
task
(MSKtask
) – An optimization task. (input)domidxs
(Int64
[]
) – Domain indices. (input)numafeidx
(Int64
) – Number of affine expressions in the affine expression list (must equal the sum of dimensions of the domains). (input)afeidxfirst
(Int64
) – Index of the first affine expression. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- appendafes¶
function appendafes(task::MSKtask, num::Int64) function appendafes(task::MSKtask, num::T0) where { T0<:Integer }
Appends a number of empty affine expressions to the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)num
(Int64
) – Number of empty affine expressions which should be appended. (input)
- Groups:
- appendbarvars¶
function appendbarvars(task::MSKtask, dim::Vector{Int32}) function appendbarvars(task::MSKtask, dim::T0) where { T0<:AbstractVector{<:Integer} }
Appends positive semidefinite matrix variables of dimensions given by
dim
to the problem.- Parameters:
task
(MSKtask
) – An optimization task. (input)dim
(Int32
[]
) – Dimensions of symmetric matrix variables to be added. (input)
- Groups:
- appendcone Deprecated¶
function appendcone(task::MSKtask, ct::Conetype, conepar::Float64, submem::Vector{Int32}) function appendcone(task::MSKtask, ct::Conetype, conepar::T0, submem::T1) where { T0<:Number, T1<:AbstractVector{<:Integer} }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Appends a new conic constraint to the problem. Hence, add a constraint
\[\hat{x} \in \K\]to the problem, where \(\K\) is a convex cone. \(\hat{x}\) is a subset of the variables which will be specified by the argument
submem
. Cone type is specified byct
.Define
\[\hat{x} = x_{\mathtt{submem}[1]},\ldots,x_{\mathtt{submem}[\mathtt{nummem}]}.\]Depending on the value of
ct
this function appends one of the constraints:Quadratic cone (
MSK_CT_QUAD
, requires \(\mathtt{nummem}\geq 1\)):\[\hat{x}_0 \geq \sqrt{\sum_{i=1}^{i<\mathtt{nummem}} \hat{x}_i^2}\]Rotated quadratic cone (
MSK_CT_RQUAD
, requires \(\mathtt{nummem}\geq 2\)):\[2 \hat{x}_0 \hat{x}_1 \geq \sum_{i=2}^{i<\mathtt{nummem}} \hat{x}^2_i, \quad \hat{x}_{0}, \hat{x}_1 \geq 0\]Primal exponential cone (
MSK_CT_PEXP
, requires \(\mathtt{nummem}=3\)):\[\hat{x}_0 \geq \hat{x}_1\exp(\hat{x}_2/\hat{x}_1), \quad \hat{x}_0,\hat{x}_1 \geq 0\]Primal power cone (
MSK_CT_PPOW
, requires \(\mathtt{nummem}\geq 2\)):\[\hat{x}_0^\alpha \hat{x}_1^{1-\alpha} \geq \sqrt{\sum_{i=2}^{i<\mathtt{nummem}} \hat{x}^2_i}, \quad \hat{x}_{0}, \hat{x}_1 \geq 0\]where \(\alpha\) is the cone parameter specified by
conepar
.Dual exponential cone (
MSK_CT_DEXP
, requires \(\mathtt{nummem}=3\)):\[\hat{x}_0 \geq -\hat{x}_2 e^{-1}\exp(\hat{x}_1/\hat{x}_2), \quad \hat{x}_2\leq 0,\hat{x}_0 \geq 0\]Dual power cone (
MSK_CT_DPOW
, requires \(\mathtt{nummem}\geq 2\)):\[\left(\frac{\hat{x}_0}{\alpha}\right)^\alpha \left(\frac{\hat{x}_1}{1-\alpha}\right)^{1-\alpha} \geq \sqrt{\sum_{i=2}^{i<\mathtt{nummem}} \hat{x}^2_i}, \quad \hat{x}_{0}, \hat{x}_1 \geq 0\]where \(\alpha\) is the cone parameter specified by
conepar
.Zero cone (
MSK_CT_ZERO
):\[\hat{x}_i = 0 \ \textrm{for all}\ i\]
Please note that the sets of variables appearing in different conic constraints must be disjoint.
For an explained code example see Sec. 6.3 (Conic Quadratic Optimization), Sec. 6.5 (Conic Exponential Optimization) or Sec. 6.4 (Power Cone Optimization).
- Parameters:
task
(MSKtask
) – An optimization task. (input)ct
(Conetype
) – Specifies the type of the cone. (input)conepar
(Float64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(Int32
[]
) – Variable subscripts of the members in the cone. (input)
- Groups:
- appendconeseq Deprecated¶
function appendconeseq(task::MSKtask, ct::Conetype, conepar::Float64, nummem::Int32, j::Int32) function appendconeseq(task::MSKtask, ct::Conetype, conepar::T0, nummem::T1, j::T2) where { T0<:Number, T1<:Integer, T2<:Integer }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Appends a new conic constraint to the problem, as in
appendcone
. The function assumes the members of cone are sequential where the first member has indexj
and the lastj+nummem-1
.- Parameters:
task
(MSKtask
) – An optimization task. (input)ct
(Conetype
) – Specifies the type of the cone. (input)conepar
(Float64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(Int32
) – Number of member variables in the cone. (input)j
(Int32
) – Index of the first variable in the conic constraint. (input)
- Groups:
- appendconesseq Deprecated¶
function appendconesseq(task::MSKtask, ct::Vector{Conetype}, conepar::Vector{Float64}, nummem::Vector{Int32}, j::Int32) function appendconesseq(task::MSKtask, ct::Vector{Conetype}, conepar::T0, nummem::T1, j::T2) where { T0<:AbstractVector{<:Number}, T1<:AbstractVector{<:Integer}, T2<:Integer }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Appends a number of conic constraints to the problem, as in
appendcone
. The \(k\)th cone is assumed to be of dimensionnummem[k]
. Moreover, it is assumed that the first variable of the first cone has index \(j\) and starting from there the sequentially following variables belong to the first cone, then to the second cone and so on.- Parameters:
task
(MSKtask
) – An optimization task. (input)ct
(Conetype
[]
) – Specifies the type of the cone. (input)conepar
(Float64
[]
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(Int32
[]
) – Numbers of member variables in the cones. (input)j
(Int32
) – Index of the first variable in the first cone to be appended. (input)
- Groups:
- appendcons¶
function appendcons(task::MSKtask, num::Int32) function appendcons(task::MSKtask, num::T0) where { T0<:Integer }
Appends a number of constraints to the model. Appended constraints will be declared free. Please note that MOSEK will automatically expand the problem dimension to accommodate the additional constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)num
(Int32
) – Number of constraints which should be appended. (input)
- Groups:
- appenddjcs¶
function appenddjcs(task::MSKtask, num::Int64) function appenddjcs(task::MSKtask, num::T0) where { T0<:Integer }
Appends a number of empty disjunctive constraints to the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)num
(Int64
) – Number of empty disjunctive constraints which should be appended. (input)
- Groups:
- appenddualexpconedomain¶
function appenddualexpconedomain(task::MSKtask) -> domidx :: Int64
Appends the dual exponential cone \(\left\{ x\in \real^3 ~:~ x_0 \geq -x_2 e^{-1} e^{x_1/x_2},\ x_0> 0,\ x_2< 0 \right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appenddualgeomeanconedomain¶
function appenddualgeomeanconedomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appenddualgeomeanconedomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the dual geometric mean cone \(\left\{ x\in \real^n ~:~ (n-1) \left(\prod_{i=0}^{n-2} x_i\right)^{1/(n-1)} \geq |x_{n-1}|,\ x_0,\ldots,x_{n-2}\geq 0 \right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appenddualpowerconedomain¶
function appenddualpowerconedomain(task::MSKtask, n::Int64, alpha::Vector{Float64}) -> domidx :: Int64 function appenddualpowerconedomain(task::MSKtask, n::T0, alpha::T1) where { T0<:Integer, T1<:AbstractVector{<:Number} } -> domidx :: Int64
Appends the dual power cone domain of dimension \(n\), with \(n_\ell\) variables appearing on the left-hand side, where \(n_\ell\) is the length of \(\alpha\), and with a homogenous sequence of exponents \(\alpha_0,\ldots,\alpha_{n_\ell-1}\).
Formally, let \(s = \sum_i \alpha_i\) and \(\beta_i = \alpha_i / s\), so that \(\sum_i \beta_i=1\). Then the dual power cone is defined as follows:
\[\left\{ x\in \real^n ~:~ \prod_{i=0}^{n_\ell-1} \left(\frac{x_i}{\beta_i}\right)^{\beta_i} \geq \sqrt{\sum_{j=n_\ell}^{n-1}x_j^2},\ x_0\ldots,x_{n_\ell-1}\geq 0 \right\}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)alpha
(Float64
[]
) – The sequence proportional to exponents. Must be positive. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendprimalexpconedomain¶
function appendprimalexpconedomain(task::MSKtask) -> domidx :: Int64
Appends the primal exponential cone \(\left\{ x\in \real^3 ~:~ x_0 \geq x_1 e^{x_2/x_1},\ x_0,x_1> 0 \right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendprimalgeomeanconedomain¶
function appendprimalgeomeanconedomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendprimalgeomeanconedomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the primal geometric mean cone \(\left\{ x\in \real^n ~:~ \left(\prod_{i=0}^{n-2} x_i\right)^{1/(n-1)} \geq |x_{n-1}|,\ x_0\ldots,x_{n-2}\geq 0 \right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendprimalpowerconedomain¶
function appendprimalpowerconedomain(task::MSKtask, n::Int64, alpha::Vector{Float64}) -> domidx :: Int64 function appendprimalpowerconedomain(task::MSKtask, n::T0, alpha::T1) where { T0<:Integer, T1<:AbstractVector{<:Number} } -> domidx :: Int64
Appends the primal power cone domain of dimension \(n\), with \(n_\ell\) variables appearing on the left-hand side, where \(n_\ell\) is the length of \(\alpha\), and with a homogenous sequence of exponents \(\alpha_0,\ldots,\alpha_{n_\ell-1}\).
Formally, let \(s = \sum_i \alpha_i\) and \(\beta_i = \alpha_i / s\), so that \(\sum_i \beta_i=1\). Then the primal power cone is defined as follows:
\[\left\{ x\in \real^n ~:~ \prod_{i=0}^{n_\ell-1} x_i^{\beta_i} \geq \sqrt{\sum_{j=n_\ell}^{n-1}x_j^2},\ x_0\ldots,x_{n_\ell-1}\geq 0 \right\}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)alpha
(Float64
[]
) – The sequence proportional to exponents. Must be positive. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendquadraticconedomain¶
function appendquadraticconedomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendquadraticconedomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the \(n\)-dimensional quadratic cone \(\left\{x\in\real^n~:~x_0 \geq \sqrt{\sum_{i=1}^{n-1} x_i^2}\right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendrdomain¶
function appendrdomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendrdomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the \(n\)-dimensional real space \(\{ x \in \real^n \}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendrminusdomain¶
function appendrminusdomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendrminusdomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the \(n\)-dimensional negative orthant \(\{ x \in \real^n: \, x \leq 0 \}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendrplusdomain¶
function appendrplusdomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendrplusdomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the \(n\)-dimensional positive orthant \(\{ x \in \real^n: \, x \geq 0 \}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendrquadraticconedomain¶
function appendrquadraticconedomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendrquadraticconedomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the \(n\)-dimensional rotated quadratic cone \(\left\{x\in\real^n~:~2 x_0 x_1 \geq \sum_{i=2}^{n-1} x_i^2,\ x_0,x_1\geq 0\right\}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendrzerodomain¶
function appendrzerodomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendrzerodomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the zero in \(n\)-dimensional real space \(\{ x \in \real^n: \, x = 0 \}\) to the list of domains.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain. (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendsparsesymmat¶
function appendsparsesymmat(task::MSKtask, dim::Int32, subi::Vector{Int32}, subj::Vector{Int32}, valij::Vector{Float64}) -> idx :: Int64 function appendsparsesymmat(task::MSKtask, dim::T0, subi::T1, subj::T2, valij::T3) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} } -> idx :: Int64 function appendsparsesymmat(task::MSKtask, dim::T0, data:: SparseMatrixCSC{Float64}) where { T0<:Integer } -> idx :: Int64
MOSEK maintains a storage of symmetric data matrices that is used to build \(\barC\) and \(\barA\). The storage can be thought of as a vector of symmetric matrices denoted \(E\). Hence, \(E_i\) is a symmetric matrix of certain dimension.
This function appends a general sparse symmetric matrix on triplet form to the vector \(E\) of symmetric matrices. The vectors
subi
,subj
, andvalij
contains the row subscripts, column subscripts and values of each element in the symmetric matrix to be appended. Since the matrix that is appended is symmetric, only the lower triangular part should be specified. Moreover, duplicates are not allowed.Observe the function reports the index (position) of the appended matrix in \(E\). This index should be used for later references to the appended matrix.
- Parameters:
task
(MSKtask
) – An optimization task. (input)dim
(Int32
) – Dimension of the symmetric matrix that is appended. (input)subi
(Int32
[]
) – Row subscript in the triplets. (input)subj
(Int32
[]
) – Column subscripts in the triplets. (input)valij
(Float64
[]
) – Values of each triplet. (input)data
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Return:
idx
(Int64
) – Unique index assigned to the inputted matrix that can be used for later reference.- Groups:
- appendsparsesymmatlist¶
function appendsparsesymmatlist(task::MSKtask, dims::Vector{Int32}, nz::Vector{Int64}, subi::Vector{Int32}, subj::Vector{Int32}, valij::Vector{Float64}) -> idx :: Vector{Int64} function appendsparsesymmatlist(task::MSKtask, dims::T0, nz::T1, subi::T2, subj::T3, valij::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} } -> idx :: Vector{Int64}
MOSEK maintains a storage of symmetric data matrices that is used to build \(\barC\) and \(\barA\). The storage can be thought of as a vector of symmetric matrices denoted \(E\). Hence, \(E_i\) is a symmetric matrix of certain dimension.
This function appends general sparse symmetric matrixes on triplet form to the vector \(E\) of symmetric matrices. The vectors
subi
,subj
, andvalij
contains the row subscripts, column subscripts and values of each element in the symmetric matrix to be appended. Since the matrix that is appended is symmetric, only the lower triangular part should be specified. Moreover, duplicates are not allowed.Observe the function reports the index (position) of the appended matrix in \(E\). This index should be used for later references to the appended matrix.
- Parameters:
task
(MSKtask
) – An optimization task. (input)dims
(Int32
[]
) – Dimensions of the symmetric matrixes. (input)nz
(Int64
[]
) – Number of nonzeros for each matrix. (input)subi
(Int32
[]
) – Row subscript in the triplets. (input)subj
(Int32
[]
) – Column subscripts in the triplets. (input)valij
(Float64
[]
) – Values of each triplet. (input)
- Return:
idx
(Int64
[]
) – Unique index assigned to the inputted matrix that can be used for later reference.- Groups:
- appendsvecpsdconedomain¶
function appendsvecpsdconedomain(task::MSKtask, n::Int64) -> domidx :: Int64 function appendsvecpsdconedomain(task::MSKtask, n::T0) where { T0<:Integer } -> domidx :: Int64
Appends the domain consisting of vectors of length \(n=d(d+1)/2\) defined as follows
\[\{(x_1,\ldots,x_{d(d+1)/2})\in \real^n~:~ \mathrm{sMat}(x)\in\PSD^d\} = \{\mathrm{sVec}(X)~:~X\in\PSD^d\},\]where
\[\mathrm{sVec}(X) = (X_{11},\sqrt{2}X_{21},\ldots,\sqrt{2}X_{d1},X_{22},\sqrt{2}X_{32},\ldots,X_{dd}),\]and
\[\begin{split}\mathrm{sMat}(x) = \left[\begin{array}{cccc}x_1 & x_2/\sqrt{2} & \cdots & x_{d}/\sqrt{2} \\ x_2/\sqrt{2} & x_{d+1} & \cdots & x_{2d-1}/\sqrt{2} \\ \cdots & \cdots & \cdots & \cdots \\ x_{d}/\sqrt{2} & x_{2d-1}/\sqrt{2} & \cdots & x_{d(d+1)/2}\end{array}\right].\end{split}\]In other words, the domain consists of vectorizations of the lower-triangular part of a positive semidefinite matrix, with the non-diagonal elements additionally rescaled.
This domain is a self-dual cone.
- Parameters:
task
(MSKtask
) – An optimization task. (input)n
(Int64
) – Dimension of the domain, must be of the form \(d(d+1)/2\). (input)
- Return:
domidx
(Int64
) – Index of the domain.- Groups:
- appendvars¶
function appendvars(task::MSKtask, num::Int32) function appendvars(task::MSKtask, num::T0) where { T0<:Integer }
Appends a number of variables to the model. Appended variables will be fixed at zero. Please note that MOSEK will automatically expand the problem dimension to accommodate the additional variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)num
(Int32
) – Number of variables which should be appended. (input)
- Groups:
- asyncgetlog¶
function asyncgetlog(task::MSKtask, addr::AbstractString, accesstoken::Union{Nothing,AbstractString}, token::AbstractString)
Get the optimizer log from a remote job.
- Parameters:
task
(MSKtask
) – An optimization task. (input)addr
(AbstractString
) – Address of the solver server (input)accesstoken
(AbstractString
) – Access token string ornothing
if no token is given. (input)token
(AbstractString
) – Job token (input)
- Groups:
- asyncgetresult¶
function asyncgetresult(task::MSKtask, address::AbstractString, accesstoken::AbstractString, token::AbstractString) -> (respavailable :: Bool,resp :: Rescode,trm :: Rescode)
Request a solution from a remote job identified by the argument
token
. For other arguments seeasyncoptimize
. If the solution is available it will be retrieved and loaded into the local task.- Parameters:
task
(MSKtask
) – An optimization task. (input)address
(AbstractString
) – Address of the OptServer. (input)accesstoken
(AbstractString
) – Access token. (input)token
(AbstractString
) – The task token. (input)
- Return:
respavailable
(Bool
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.resp
(Rescode
) – Is the response code from the remote solver.trm
(Rescode
) – Is eitherMSK_RES_OK
or a termination response code.
- Groups:
- asyncoptimize¶
function asyncoptimize(task::MSKtask, address::AbstractString, accesstoken::AbstractString) -> token :: String
Offload the optimization task to an instance of OptServer specified by
addr
, which should be a valid URL, for examplehttp://server:port
orhttps://server:port
. The call will exit immediately.If the server requires authentication, the authentication token can be passed in the
accesstoken
argument.If the server requires encryption, the keys can be passed using one of the solver parameters
MSK_SPAR_REMOTE_TLS_CERT
orMSK_SPAR_REMOTE_TLS_CERT_PATH
.The function returns a token which should be used in future calls to identify the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)address
(AbstractString
) – Address of the OptServer. (input)accesstoken
(AbstractString
) – Access token. (input)
- Return:
token
(String
) – Returns the task token.- Groups:
- asyncpoll¶
function asyncpoll(task::MSKtask, address::AbstractString, accesstoken::AbstractString, token::AbstractString) -> (respavailable :: Bool,resp :: Rescode,trm :: Rescode)
Requests information about the status of the remote job identified by the argument
token
. For other arguments seeasyncoptimize
.- Parameters:
task
(MSKtask
) – An optimization task. (input)address
(AbstractString
) – Address of the OptServer. (input)accesstoken
(AbstractString
) – Access token. (input)token
(AbstractString
) – The task token. (input)
- Return:
respavailable
(Bool
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.resp
(Rescode
) – Is the response code from the remote solver.trm
(Rescode
) – Is eitherMSK_RES_OK
or a termination response code.
- Groups:
- asyncstop¶
function asyncstop(task::MSKtask, address::AbstractString, accesstoken::AbstractString, token::AbstractString)
Request that the remote job identified by
token
is terminated. For other arguments seeasyncoptimize
.- Parameters:
task
(MSKtask
) – An optimization task. (input)address
(AbstractString
) – Address of the OptServer. (input)accesstoken
(AbstractString
) – Access token. (input)token
(AbstractString
) – The task token. (input)
- Groups:
- basiscond¶
function basiscond(task::MSKtask) -> (nrmbasis :: Float64,nrminvbasis :: Float64)
If a basic solution is available and it defines a nonsingular basis, then this function computes the 1-norm estimate of the basis matrix and a 1-norm estimate for the inverse of the basis matrix. The 1-norm estimates are computed using the method outlined in [Ste98], pp. 388-391.
By definition the 1-norm condition number of a matrix \(B\) is defined as
\[\kappa_1(B) := \|B\|_1 \|B^{-1}\|_1.\]Moreover, the larger the condition number is the harder it is to solve linear equation systems involving \(B\). Given estimates for \(\|B\|_1\) and \(\|B^{-1}\|_1\) it is also possible to estimate \(\kappa_1(B)\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
nrmbasis
(Float64
) – An estimate for the 1-norm of the basis.nrminvbasis
(Float64
) – An estimate for the 1-norm of the inverse of the basis.
- Groups:
- bktostr¶
function bktostr(task::MSKtask, bk::Boundkey) -> str :: String
Obtains an identifier string corresponding to a bound key.
- callbackcodetostr¶
function callbackcodetostr(code::Callbackcode) -> callbackcodestr :: String
Obtains the string representation of a callback code.
- Parameters:
code
(Callbackcode
) – A callback code. (input)- Return:
callbackcodestr
(String
) – String corresponding to the callback code.- Groups:
- checkinall¶
function checkinall(env::MSKenv) function checkinall()
Check in all unused license features to the license token server.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)- Groups:
- checkinlicense¶
function checkinlicense(env::MSKenv, feature::Feature) function checkinlicense(feature::Feature)
Check in a license feature to the license server. By default all licenses consumed by functions using a single environment are kept checked out for the lifetime of the MOSEK environment. This function checks in a given license feature back to the license server immediately.
If the given license feature is not checked out at all, or it is in use by a call to
optimize
, calling this function has no effect.Please note that returning a license to the license server incurs a small overhead, so frequent calls to this function should be avoided.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)feature
(Feature
) – Feature to check in to the license system. (input)
- Groups:
- checkmem¶
function checkmem(task::MSKtask, file::AbstractString, line::Int32) function checkmem(task::MSKtask, file::Union{Nothing,AbstractString}, line::T0) where { T0<:Integer }
Checks the memory allocated by the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)file
(AbstractString
) – File from which the function is called. (input)line
(Int32
) – Line in the file from which the function is called. (input)
- Groups:
- checkoutlicense¶
function checkoutlicense(env::MSKenv, feature::Feature) function checkoutlicense(feature::Feature)
Checks out a license feature from the license server. Normally the required license features will be automatically checked out the first time they are needed by the function
optimize
. This function can be used to check out one or more features ahead of time.The feature will remain checked out until the environment is deleted or the function
checkinlicense
is called.If a given feature is already checked out when this function is called, the call has no effect.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)feature
(Feature
) – Feature to check out from the license system. (input)
- Groups:
- chgconbound¶
function chgconbound(task::MSKtask, i::Int32, lower::Int32, finite::Int32, value::Float64) function chgconbound(task::MSKtask, i::T0, lower::T1, finite::T2, value::T3) where { T0<:Integer, T1<:Integer, T2<:Integer, T3<:Number }
Changes a bound for one constraint.
If
lower
is non-zero, then the lower bound is changed as follows:\[\begin{split}\mbox{new lower bound} = \left\{ \begin{array}{ll} - \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]Otherwise if
lower
is zero, then\[\begin{split}\mbox{new upper bound} = \left\{ \begin{array}{ll} \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]Please note that this function automatically updates the bound key for the bound, in particular, if the lower and upper bounds are identical, the bound key is changed to
fixed
.- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint for which the bounds should be changed. (input)lower
(Int32
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(Int32
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(Float64
) – New value for the bound. (input)
- Groups:
Problem data - bounds, Problem data - constraints, Problem data - linear part
- chgvarbound¶
function chgvarbound(task::MSKtask, j::Int32, lower::Int32, finite::Int32, value::Float64) function chgvarbound(task::MSKtask, j::T0, lower::T1, finite::T2, value::T3) where { T0<:Integer, T1<:Integer, T2<:Integer, T3<:Number }
Changes a bound for one variable.
If
lower
is non-zero, then the lower bound is changed as follows:\[\begin{split}\mbox{new lower bound} = \left\{ \begin{array}{ll} - \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]Otherwise if
lower
is zero, then\[\begin{split}\mbox{new upper bound} = \left\{ \begin{array}{ll} \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]Please note that this function automatically updates the bound key for the bound, in particular, if the lower and upper bounds are identical, the bound key is changed to
fixed
.- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable for which the bounds should be changed. (input)lower
(Int32
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(Int32
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(Float64
) – New value for the bound. (input)
- Groups:
Problem data - bounds, Problem data - variables, Problem data - linear part
- clearcallbackfunc¶
function clearcallbackfunc(task::MSKtask)
Detaches a callback function.
- clearstreamfunc¶
function clearstreamfunc(task::MSKtask, whichstream::Streamtype)
Detaches a stream callback function.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(streamtype
) – Index of the stream. (input)
- Groups:
- commitchanges¶
function commitchanges(task::MSKtask)
Commits all cached problem changes to the task. It is usually not necessary to call this function explicitly since changes will be committed automatically when required.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Groups:
- computesparsecholesky¶
function computesparsecholesky(env::MSKenv, numthreads::Int32, ordermethod::Int32, tolsingular::Float64, anzc::Vector{Int32}, aptrc::Vector{Int64}, asubc::Vector{Int32}, avalc::Vector{Float64}) -> (perm :: Int32,diag :: Float64,lnzc :: Int32,lptrc :: Int64,lensubnval :: Int64,lsubc :: Int32,lvalc :: Float64) function computesparsecholesky(env::MSKenv, numthreads::T0, ordermethod::T1, tolsingular::T2, anzc::T3, aptrc::T4, asubc::T5, avalc::T6) where { T0<:Integer, T1<:Integer, T2<:Number, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Number} } -> (perm :: Int32,diag :: Float64,lnzc :: Int32,lptrc :: Int64,lensubnval :: Int64,lsubc :: Int32,lvalc :: Float64) function computesparsecholesky(numthreads::Int32, ordermethod::Int32, tolsingular::Float64, anzc::Vector{Int32}, aptrc::Vector{Int64}, asubc::Vector{Int32}, avalc::Vector{Float64}) -> (perm :: Int32,diag :: Float64,lnzc :: Int32,lptrc :: Int64,lensubnval :: Int64,lsubc :: Int32,lvalc :: Float64) function computesparsecholesky(numthreads::T0, ordermethod::T1, tolsingular::T2, anzc::T3, aptrc::T4, asubc::T5, avalc::T6) where { T0<:Integer, T1<:Integer, T2<:Number, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Number} } -> (perm :: Int32,diag :: Float64,lnzc :: Int32,lptrc :: Int64,lensubnval :: Int64,lsubc :: Int32,lvalc :: Float64)
The function computes a Cholesky factorization of a sparse positive semidefinite matrix. Sparsity is exploited during the computations to reduce the amount of space and work required. Both the input and output matrices are represented using the sparse format.
To be precise, given a symmetric matrix \(A \in \real^{n\times n}\) the function computes a nonsingular lower triangular matrix \(L\), a diagonal matrix \(D\) and a permutation matrix \(P\) such that
\[LL^T - D = P A P^T.\]If
ordermethod
is zero then reordering heuristics are not employed and \(P\) is the identity.If a pivot during the computation of the Cholesky factorization is less than
\[-\rho\cdot\max((PAP^T)_{jj},1.0)\]then the matrix is declared negative semidefinite. On the hand if a pivot is smaller than
\[\rho\cdot\max((PAP^T)_{jj},1.0),\]then \(D_{jj}\) is increased from zero to
\[\rho\cdot\max((PAP^T)_{jj},1.0).\]Therefore, if \(A\) is sufficiently positive definite then \(D\) will be the zero matrix. Here \(\rho\) is set equal to value of
tolsingular
.- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)numthreads
(Int32
) – The number threads that can be used to do the computation. 0 means the code makes the choice. NOTE: API change in version 10: in versions up to 9 the argument in this position indicated whether to use multithreading or not. (input)ordermethod
(Int32
) – If nonzero, then a sparsity preserving ordering will be employed. (input)tolsingular
(Float64
) – A positive parameter controlling when a pivot is declared zero. (input)anzc
(Int32
[]
) –anzc[j]
is the number of nonzeros in the \(j\)-th column of \(A\). (input)aptrc
(Int64
[]
) –aptrc[j]
is a pointer to the first element in column \(j\) of \(A\). (input)asubc
(Int32
[]
) – Row indexes for each column stored in increasing order. (input)avalc
(Float64
[]
) – The value corresponding to row indexed stored inasubc
. (input)
- Return:
perm
(Int32
) – Permutation array used to specify the permutation matrix \(P\) computed by the function.diag
(Float64
) – The diagonal elements of matrix \(D\).lnzc
(Int32
) –lnzc[j]
is the number of non zero elements in column \(j\) of \(L\).lptrc
(Int64
) –lptrc[j]
is a pointer to the first row index and value in column \(j\) of \(L\).lensubnval
(Int64
) – Number of elements inlsubc
andlvalc
.lsubc
(Int32
) – Row indexes for each column stored in increasing order.lvalc
(Float64
) – The values corresponding to row indexed stored inlsubc
.
- Groups:
- conetypetostr Deprecated¶
function conetypetostr(task::MSKtask, ct::Conetype) -> str :: String
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Obtains the cone string identifier corresponding to a cone type.
- deletesolution¶
function deletesolution(task::MSKtask, whichsol::Soltype)
Undefine a solution and free the memory it uses.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups:
- dinfitemtostr¶
function dinfitemtostr(item::Dinfitem) -> str :: String
Obtains an identifier string corresponding to a information item.
- dualsensitivity¶
function dualsensitivity(task::MSKtask, subj::Vector{Int32}) -> (leftpricej :: Vector{Float64},rightpricej :: Vector{Float64},leftrangej :: Vector{Float64},rightrangej :: Vector{Float64}) function dualsensitivity(task::MSKtask, subj::T0) where { T0<:AbstractVector{<:Integer} } -> (leftpricej :: Vector{Float64},rightpricej :: Vector{Float64},leftrangej :: Vector{Float64},rightrangej :: Vector{Float64})
Calculates sensitivity information for objective coefficients. The indexes of the coefficients to analyze are
\[\{\mathtt{subj}[i] ~|~ i = \idxbeg,\ldots,\idxend{\mathtt{numj}}\}\]The type of sensitivity analysis to perform (basis or optimal partition) is controlled by the parameter
MSK_IPAR_SENSITIVITY_TYPE
.For an example, please see Section Example: Sensitivity Analysis.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – Indexes of objective coefficients to analyze. (input)
- Return:
leftpricej
(Float64
[]
) – \(\mathtt{leftpricej}[j]\) is the left shadow price for the coefficient with index \(\mathtt{subj[j]}\).rightpricej
(Float64
[]
) – \(\mathtt{rightpricej}[j]\) is the right shadow price for the coefficient with index \(\mathtt{subj[j]}\).leftrangej
(Float64
[]
) – \(\mathtt{leftrangej}[j]\) is the left range \(\beta_1\) for the coefficient with index \(\mathtt{subj[j]}\).rightrangej
(Float64
[]
) – \(\mathtt{rightrangej}[j]\) is the right range \(\beta_2\) for the coefficient with index \(\mathtt{subj[j]}\).
- Groups:
- echointro¶
function echointro(env::MSKenv, longver::Int32) function echointro(env::MSKenv, longver::T0) where { T0<:Integer } function echointro(longver::Int32) function echointro(longver::T0) where { T0<:Integer }
Prints an intro to message stream.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)longver
(Int32
) – If non-zero, then the intro is slightly longer. (input)
- Groups:
- emptyafebarfrow¶
function emptyafebarfrow(task::MSKtask, afeidx::Int64) function emptyafebarfrow(task::MSKtask, afeidx::T0) where { T0<:Integer }
Clears a row in \(\barF\) i.e. sets \(\barF_{\mathrm{afeidx},*} = 0\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- emptyafebarfrowlist¶
function emptyafebarfrowlist(task::MSKtask, afeidxlist::Vector{Int64}) function emptyafebarfrowlist(task::MSKtask, afeidxlist::T0) where { T0<:AbstractVector{<:Integer} }
Clears a number of rows in \(\barF\) i.e. sets \(\barF_{i,*} = 0\) for all indices \(i\) in
afeidxlist
.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidxlist
(Int64
[]
) – Indices of rows in \(\barF\) to clear. (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- emptyafefcol¶
function emptyafefcol(task::MSKtask, varidx::Int32) function emptyafefcol(task::MSKtask, varidx::T0) where { T0<:Integer }
Clears one column in the affine constraint matrix \(F\), that is sets \(F_{*,\mathrm{varidx}}=0\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)varidx
(Int32
) – Index of a variable (column in \(F\)). (input)
- Groups:
- emptyafefcollist¶
function emptyafefcollist(task::MSKtask, varidx::Vector{Int32}) function emptyafefcollist(task::MSKtask, varidx::T0) where { T0<:AbstractVector{<:Integer} }
Clears a number of columns in \(F\) i.e. sets \(F_{*,j} = 0\) for all indices \(j\) in
varidx
.- Parameters:
task
(MSKtask
) – An optimization task. (input)varidx
(Int32
[]
) – Indices of variables (columns) in \(F\) to clear. (input)
- Groups:
- emptyafefrow¶
function emptyafefrow(task::MSKtask, afeidx::Int64) function emptyafefrow(task::MSKtask, afeidx::T0) where { T0<:Integer }
Clears one row in the affine constraint matrix \(F\), that is sets \(F_{\mathrm{afeidx},*}=0\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of a row in \(F\). (input)
- Groups:
- emptyafefrowlist¶
function emptyafefrowlist(task::MSKtask, afeidx::Vector{Int64}) function emptyafefrowlist(task::MSKtask, afeidx::T0) where { T0<:AbstractVector{<:Integer} }
Clears a number of rows in \(F\) i.e. sets \(F_{i,*} = 0\) for all indices \(i\) in
afeidx
.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Indices of rows in \(F\) to clear. (input)
- Groups:
- evaluateacc¶
function evaluateacc(task::MSKtask, whichsol::Soltype, accidx::Int64) -> activity :: Vector{Float64} function evaluateacc(task::MSKtask, whichsol::Soltype, accidx::T0) where { T0<:Integer } -> activity :: Vector{Float64}
Evaluates the activity of an affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)accidx
(Int64
) – The index of the affine conic constraint. (input)
- Return:
activity
(Float64
[]
) – The activity of the affine conic constraint. The array should have length equal to the dimension of the constraint.- Groups:
- evaluateaccs¶
function evaluateaccs(task::MSKtask, whichsol::Soltype) -> activity :: Vector{Float64}
Evaluates the activities of all affine conic constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
activity
(Float64
[]
) – The activity of affine conic constraints. The array should have length equal to the sum of dimensions of all affine conic constraints.- Groups:
- expirylicenses¶
function expirylicenses(env::MSKenv) -> expiry :: Int64 function expirylicenses() -> expiry :: Int64
Reports when the first license feature expires. It reports the number of days to the expiry of the first feature of all the features that were ever checked out from the start of the process, or from the last call to
resetexpirylicenses
, until now.- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)- Return:
expiry
(Int64
) – If nonnegative, then it is the minimum number days to expiry of any feature that has been checked out.- Groups:
- getaccafeidxlist¶
function getaccafeidxlist(task::MSKtask, accidx::Int64) -> afeidxlist :: Vector{Int64} function getaccafeidxlist(task::MSKtask, accidx::T0) where { T0<:Integer } -> afeidxlist :: Vector{Int64}
Obtains the list of affine expressions appearing in the affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Index of the affine conic constraint. (input)
- Return:
afeidxlist
(Int64
[]
) – List of indexes of affine expressions appearing in the constraint.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccb¶
function getaccb(task::MSKtask, accidx::Int64) -> b :: Vector{Float64} function getaccb(task::MSKtask, accidx::T0) where { T0<:Integer } -> b :: Vector{Float64}
Obtains the additional constant term vector appearing in the affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Index of the affine conic constraint. (input)
- Return:
b
(Float64
[]
) – The vector b appearing in the constraint.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccbarfblocktriplet¶
function getaccbarfblocktriplet(task::MSKtask) -> (numtrip :: Int64,acc_afe :: Vector{Int64},bar_var :: Vector{Int32},blk_row :: Vector{Int32},blk_col :: Vector{Int32},blk_val :: Vector{Float64})
Obtains \(\barF\), implied by the ACCs, in block triplet form. If the AFEs passed to the ACCs were out of order, then this function can be used to obtain the barF as seen by the ACCs.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numtrip
(Int64
) – Number of elements in the block triplet form.acc_afe
(Int64
[]
) – Index of the AFE within the concatenated list of AFEs in ACCs.bar_var
(Int32
[]
) – Symmetric matrix variable index.blk_row
(Int32
[]
) – Block row index.blk_col
(Int32
[]
) – Block column index.blk_val
(Float64
[]
) – The numerical value associated with each block triplet.
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- getaccbarfnumblocktriplets¶
function getaccbarfnumblocktriplets(task::MSKtask) -> numtrip :: Int64
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\), as used within the ACCs.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numtrip
(Int64
) – An upper bound on the number of elements in the block triplet form of \(\barF.\), as used within the ACCs.- Groups:
Problem data - semidefinite, Problem data - affine conic constraints, Inspecting the task
- getaccdomain¶
function getaccdomain(task::MSKtask, accidx::Int64) -> domidx :: Int64 function getaccdomain(task::MSKtask, accidx::T0) where { T0<:Integer } -> domidx :: Int64
Obtains the domain appearing in the affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – The index of the affine conic constraint. (input)
- Return:
domidx
(Int64
) – The index of domain in the affine conic constraint.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccdoty¶
function getaccdoty(task::MSKtask, whichsol::Soltype, accidx::Int64) -> doty :: Vector{Float64} function getaccdoty(task::MSKtask, whichsol::Soltype, accidx::T0) where { T0<:Integer } -> doty :: Vector{Float64}
Obtains the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)accidx
(Int64
) – The index of the affine conic constraint. (input)
- Return:
doty
(Float64
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint.- Groups:
- getaccdotys¶
function getaccdotys(task::MSKtask, whichsol::Soltype) -> doty :: Vector{Float64}
Obtains the \(\dot{y}\) vector for a solution (the dual values of all affine conic constraint).
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
doty
(Float64
[]
) – The dual values of affine conic constraints. The array should have length equal to the sum of dimensions of all affine conic constraints.- Groups:
- getaccfnumnz¶
function getaccfnumnz(task::MSKtask) -> accfnnz :: Int64
If the AFEs are not added sequentially to the ACCs, then the present function gives the number of nonzero elements in the F matrix that would be implied by the ordering of AFEs within ACCs.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
accfnnz
(Int64
) – Number of non-zeros in \(F\) implied by ACCs.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccftrip¶
function getaccftrip(task::MSKtask) -> (frow :: Vector{Int64},fcol :: Vector{Int32},fval :: Vector{Float64})
Obtains the \(F\) (that would be implied by the ordering of the AFEs within the ACCs) in triplet format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
frow
(Int64
[]
) – Row indices of nonzeros in the implied F matrix.fcol
(Int32
[]
) – Column indices of nonzeros in the implied F matrix.fval
(Float64
[]
) – Values of nonzero entries in the implied F matrix.
- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccgvector¶
function getaccgvector(task::MSKtask) -> g :: Vector{Float64}
If the AFEs are passed out of sequence to the ACCs, then this function can be used to obtain the vector \(g\) of constant terms used within the ACCs.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
g
(Float64
[]
) – The \(g\) used within the ACCs as a dense vector. The length is sum of the dimensions of the ACCs.- Groups:
Inspecting the task, Problem data - affine conic constraints
- getaccn¶
function getaccn(task::MSKtask, accidx::Int64) -> n :: Int64 function getaccn(task::MSKtask, accidx::T0) where { T0<:Integer } -> n :: Int64
Obtains the dimension of the affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – The index of the affine conic constraint. (input)
- Return:
n
(Int64
) – The dimension of the affine conic constraint (equal to the dimension of its domain).- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccname¶
function getaccname(task::MSKtask, accidx::Int64) -> name :: String function getaccname(task::MSKtask, accidx::T0) where { T0<:Integer } -> name :: String
Obtains the name of an affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Index of an affine conic constraint. (input)
- Return:
name
(String
) – Returns the required name.- Groups:
Names, Problem data - affine conic constraints, Inspecting the task
- getaccnamelen¶
function getaccnamelen(task::MSKtask, accidx::Int64) -> len :: Int32 function getaccnamelen(task::MSKtask, accidx::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of an affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Index of an affine conic constraint. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
Names, Problem data - affine conic constraints, Inspecting the task
- getaccntot¶
function getaccntot(task::MSKtask) -> n :: Int64
Obtains the total dimension of all affine conic constraints (the sum of all their dimensions).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
n
(Int64
) – The total dimension of all affine conic constraints.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getaccs¶
function getaccs(task::MSKtask) -> (domidxlist :: Vector{Int64},afeidxlist :: Vector{Int64},b :: Vector{Float64})
Obtains full data of all affine conic constraints. The output array
domainidxlist
must have at least length determined bygetnumacc
. The output arraysafeidxlist
andb
must have at least length determined bygetaccntot
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
domidxlist
(Int64
[]
) – The list of domains appearing in all affine conic constraints.afeidxlist
(Int64
[]
) – The concatenation of index lists of affine expressions appearing in all affine conic constraints.b
(Float64
[]
) – The concatenation of vectors b appearing in all affine conic constraints.
- Groups:
Problem data - affine conic constraints, Inspecting the task
- getacol¶
function getacol(task::MSKtask, j::Int32) -> (nzj :: Int32,subj :: Vector{Int32},valj :: Vector{Float64}) function getacol(task::MSKtask, j::T0) where { T0<:Integer } -> (nzj :: Int32,subj :: Vector{Int32},valj :: Vector{Float64})
Obtains one column of \(A\) in a sparse format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the column. (input)
- Return:
nzj
(Int32
) – Number of non-zeros in the column obtained.subj
(Int32
[]
) – Row indices of the non-zeros in the column obtained.valj
(Float64
[]
) – Numerical values in the column obtained.
- Groups:
- getacolnumnz¶
function getacolnumnz(task::MSKtask, i::Int32) -> nzj :: Int32 function getacolnumnz(task::MSKtask, i::T0) where { T0<:Integer } -> nzj :: Int32
Obtains the number of non-zero elements in one column of \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the column. (input)
- Return:
nzj
(Int32
) – Number of non-zeros in the \(j\)-th column of \(A\).- Groups:
- getacolslice¶
function getacolslice(task::MSKtask, first::Int32, last::Int32) -> (ptrb :: Vector{Int64},ptre :: Vector{Int64},sub :: Vector{Int32},val :: Vector{Float64}) function getacolslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (ptrb :: Vector{Int64},ptre :: Vector{Int64},sub :: Vector{Int32},val :: Vector{Float64})
Obtains a sequence of columns from \(A\) in sparse format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first column in the sequence. (input)last
(Int32
) – Index of the last column in the sequence plus one. (input)
- Return:
ptrb
(Int64
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th column obtained.ptre
(Int64
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th column obtained.sub
(Int32
[]
) – Contains the row subscripts.val
(Float64
[]
) – Contains the coefficient values.
- Groups:
- getacolslicenumnz¶
function getacolslicenumnz(task::MSKtask, first::Int32, last::Int32) -> numnz :: Int64 function getacolslicenumnz(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> numnz :: Int64
Obtains the number of non-zeros in a slice of columns of \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first column in the sequence. (input)last
(Int32
) – Index of the last column plus one in the sequence. (input)
- Return:
numnz
(Int64
) – Number of non-zeros in the slice.- Groups:
- getacolslicetrip¶
function getacolslicetrip(task::MSKtask, first::Int32, last::Int32) -> (subi :: Vector{Int32},subj :: Vector{Int32},val :: Vector{Float64}) function getacolslicetrip(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (subi :: Vector{Int32},subj :: Vector{Int32},val :: Vector{Float64})
Obtains a sequence of columns from \(A\) in sparse triplet format. The function returns the content of all columns whose index
j
satisfiesfirst <= j < last
. The triplets corresponding to nonzero entries are stored in the arrayssubi
,subj
andval
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first column in the sequence. (input)last
(Int32
) – Index of the last column in the sequence plus one. (input)
- Return:
subi
(Int32
[]
) – Constraint subscripts.subj
(Int32
[]
) – Column subscripts.val
(Float64
[]
) – Values.
- Groups:
- getafebarfblocktriplet¶
function getafebarfblocktriplet(task::MSKtask) -> (numtrip :: Int64,afeidx :: Vector{Int64},barvaridx :: Vector{Int32},subk :: Vector{Int32},subl :: Vector{Int32},valkl :: Vector{Float64})
Obtains \(\barF\) in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numtrip
(Int64
) – Number of elements in the block triplet form.afeidx
(Int64
[]
) – Constraint index.barvaridx
(Int32
[]
) – Symmetric matrix variable index.subk
(Int32
[]
) – Block row index.subl
(Int32
[]
) – Block column index.valkl
(Float64
[]
) – The numerical value associated with each block triplet.
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- getafebarfnumblocktriplets¶
function getafebarfnumblocktriplets(task::MSKtask) -> numtrip :: Int64
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numtrip
(Int64
) – An upper bound on the number of elements in the block triplet form of \(\barF.\)- Groups:
- getafebarfnumrowentries¶
function getafebarfnumrowentries(task::MSKtask, afeidx::Int64) -> numentr :: Int32 function getafebarfnumrowentries(task::MSKtask, afeidx::T0) where { T0<:Integer } -> numentr :: Int32
Obtains the number of nonzero entries in one row of \(\barF\), that is the number of \(j\) such that \(\barF_{\mathrm{afeidx},j}\) is not the zero matrix.
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)
- Return:
numentr
(Int32
) – Number of nonzero entries in a row of \(\barF\).- Groups:
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- getafebarfrow¶
function getafebarfrow(task::MSKtask, afeidx::Int64) -> (barvaridx :: Vector{Int32},ptrterm :: Vector{Int64},numterm :: Vector{Int64},termidx :: Vector{Int64},termweight :: Vector{Float64}) function getafebarfrow(task::MSKtask, afeidx::T0) where { T0<:Integer } -> (barvaridx :: Vector{Int32},ptrterm :: Vector{Int64},numterm :: Vector{Int64},termidx :: Vector{Int64},termweight :: Vector{Float64})
Obtains all nonzero entries in one row \(\barF_{\mathrm{afeidx},*}\) of \(\barF\). For every \(k\) there is a nonzero entry \(\barF_{\mathrm{afeidx}, \mathrm{barvaridx}[k]}\), which is represented as a weighted sum of \(\mathrm{numterm}[k]\) terms. The indices in the matrix store \(E\) and their weights for the \(k\)-th entry appear in the arrays
termidx
andtermweight
in positions\[\mathrm{ptrterm}[k],\ldots,\mathrm{ptrterm}[k]+(\mathrm{numterm}[k]-1).\]The arrays should be long enough to accommodate the data; their required lengths can be obtained with
getafebarfrowinfo
.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)
- Return:
barvaridx
(Int32
[]
) – Semidefinite variable indices of nonzero entries in the row of \(\barF\).ptrterm
(Int64
[]
) – Pointers to the start of each entry’s description.numterm
(Int64
[]
) – Number of terms in the weighted sum representation of each entry.termidx
(Int64
[]
) – Indices of semidefinite matrices from the matrix store \(E\).termweight
(Float64
[]
) – Weights appearing in the weighted sum representations of all entries.
- Groups:
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- getafebarfrowinfo¶
function getafebarfrowinfo(task::MSKtask, afeidx::Int64) -> (numentr :: Int32,numterm :: Int64) function getafebarfrowinfo(task::MSKtask, afeidx::T0) where { T0<:Integer } -> (numentr :: Int32,numterm :: Int64)
Obtains information about one row of \(\barF\): the number of nonzero entries, that is the number of \(j\) such that \(\barF_{\mathrm{afeidx},j}\) is not the zero matrix, as well as the total number of terms in the representations of all these entries as weighted sums of matrices from \(E\). This information provides the data sizes required for a call to
getafebarfrow
.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)
- Return:
numentr
(Int32
) – Number of nonzero entries in a row of \(\barF\).numterm
(Int64
) – Number of terms in the weighted sums representation of the row of \(\barF\).
- Groups:
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- getafefnumnz¶
function getafefnumnz(task::MSKtask) -> numnz :: Int64
Obtains the total number of nonzeros in \(F\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numnz
(Int64
) – Number of non-zeros in \(F\).- Groups:
- getafefrow¶
function getafefrow(task::MSKtask, afeidx::Int64) -> (numnz :: Int32,varidx :: Vector{Int32},val :: Vector{Float64}) function getafefrow(task::MSKtask, afeidx::T0) where { T0<:Integer } -> (numnz :: Int32,varidx :: Vector{Int32},val :: Vector{Float64})
Obtains one row of \(F\) in sparse format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of a row in \(F\). (input)
- Return:
numnz
(Int32
) – Number of non-zeros in the row obtained.varidx
(Int32
[]
) – Column indices of the non-zeros in the row obtained.val
(Float64
[]
) – Values of the non-zeros in the row obtained.
- Groups:
- getafefrownumnz¶
function getafefrownumnz(task::MSKtask, afeidx::Int64) -> numnz :: Int32 function getafefrownumnz(task::MSKtask, afeidx::T0) where { T0<:Integer } -> numnz :: Int32
Obtains the number of nonzeros in one row of \(F\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of a row in \(F\). (input)
- Return:
numnz
(Int32
) – Number of non-zeros in rowafeidx
of \(F\).- Groups:
- getafeftrip¶
function getafeftrip(task::MSKtask) -> (afeidx :: Vector{Int64},varidx :: Vector{Int32},val :: Vector{Float64})
Obtains the \(F\) in triplet format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
afeidx
(Int64
[]
) – Row indices of nonzeros.varidx
(Int32
[]
) – Column indices of nonzeros.val
(Float64
[]
) – Values of nonzero entries.
- Groups:
- getafeg¶
function getafeg(task::MSKtask, afeidx::Int64) -> g :: Float64 function getafeg(task::MSKtask, afeidx::T0) where { T0<:Integer } -> g :: Float64
Obtains a single coefficient in \(g\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of an element in \(g\). (input)
- Return:
g
(Float64
) – The value of \(g_{\mathrm{afeidx}}\).- Groups:
- getafegslice¶
function getafegslice(task::MSKtask, first::Int64, last::Int64) -> g :: Vector{Float64} function getafegslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> g :: Vector{Float64}
Obtains a sequence of elements from the vector \(g\) of constant terms in the affine expressions list.
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int64
) – First index in the sequence. (input)last
(Int64
) – Last index plus 1 in the sequence. (input)
- Return:
g
(Float64
[]
) – The slice \(g\) as a dense vector. The length islast-first
.- Groups:
- getaij¶
function getaij(task::MSKtask, i::Int32, j::Int32) -> aij :: Float64 function getaij(task::MSKtask, i::T0, j::T1) where { T0<:Integer, T1<:Integer } -> aij :: Float64
Obtains a single coefficient in \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Row index of the coefficient to be returned. (input)j
(Int32
) – Column index of the coefficient to be returned. (input)
- Return:
aij
(Float64
) – The required coefficient \(a_{i,j}\).- Groups:
- getapiecenumnz¶
function getapiecenumnz(task::MSKtask, firsti::Int32, lasti::Int32, firstj::Int32, lastj::Int32) -> numnz :: Int32 function getapiecenumnz(task::MSKtask, firsti::T0, lasti::T1, firstj::T2, lastj::T3) where { T0<:Integer, T1<:Integer, T2<:Integer, T3<:Integer } -> numnz :: Int32
Obtains the number non-zeros in a rectangular piece of \(A\), i.e. the number of elements in the set
\[\{ (i,j)~:~ a_{i,j} \neq 0,~ \mathtt{firsti} \leq i \leq \mathtt{lasti}-1, ~\mathtt{firstj} \leq j \leq \mathtt{lastj}-1\}\]This function is not an efficient way to obtain the number of non-zeros in one row or column. In that case use the function
getarownumnz
orgetacolnumnz
.- Parameters:
task
(MSKtask
) – An optimization task. (input)firsti
(Int32
) – Index of the first row in the rectangular piece. (input)lasti
(Int32
) – Index of the last row plus one in the rectangular piece. (input)firstj
(Int32
) – Index of the first column in the rectangular piece. (input)lastj
(Int32
) – Index of the last column plus one in the rectangular piece. (input)
- Return:
numnz
(Int32
) – Number of non-zero \(A\) elements in the rectangular piece.- Groups:
- getarow¶
function getarow(task::MSKtask, i::Int32) -> (nzi :: Int32,subi :: Vector{Int32},vali :: Vector{Float64}) function getarow(task::MSKtask, i::T0) where { T0<:Integer } -> (nzi :: Int32,subi :: Vector{Int32},vali :: Vector{Float64})
Obtains one row of \(A\) in a sparse format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the row. (input)
- Return:
nzi
(Int32
) – Number of non-zeros in the row obtained.subi
(Int32
[]
) – Column indices of the non-zeros in the row obtained.vali
(Float64
[]
) – Numerical values of the row obtained.
- Groups:
- getarownumnz¶
function getarownumnz(task::MSKtask, i::Int32) -> nzi :: Int32 function getarownumnz(task::MSKtask, i::T0) where { T0<:Integer } -> nzi :: Int32
Obtains the number of non-zero elements in one row of \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the row. (input)
- Return:
nzi
(Int32
) – Number of non-zeros in the \(i\)-th row of \(A\).- Groups:
- getarowslice¶
function getarowslice(task::MSKtask, first::Int32, last::Int32) -> (ptrb :: Vector{Int64},ptre :: Vector{Int64},sub :: Vector{Int32},val :: Vector{Float64}) function getarowslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (ptrb :: Vector{Int64},ptre :: Vector{Int64},sub :: Vector{Int32},val :: Vector{Float64})
Obtains a sequence of rows from \(A\) in sparse format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first row in the sequence. (input)last
(Int32
) – Index of the last row in the sequence plus one. (input)
- Return:
ptrb
(Int64
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th row obtained.ptre
(Int64
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th row obtained.sub
(Int32
[]
) – Contains the column subscripts.val
(Float64
[]
) – Contains the coefficient values.
- Groups:
- getarowslicenumnz¶
function getarowslicenumnz(task::MSKtask, first::Int32, last::Int32) -> numnz :: Int64 function getarowslicenumnz(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> numnz :: Int64
Obtains the number of non-zeros in a slice of rows of \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first row in the sequence. (input)last
(Int32
) – Index of the last row plus one in the sequence. (input)
- Return:
numnz
(Int64
) – Number of non-zeros in the slice.- Groups:
- getarowslicetrip¶
function getarowslicetrip(task::MSKtask, first::Int32, last::Int32) -> (subi :: Vector{Int32},subj :: Vector{Int32},val :: Vector{Float64}) function getarowslicetrip(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (subi :: Vector{Int32},subj :: Vector{Int32},val :: Vector{Float64})
Obtains a sequence of rows from \(A\) in sparse triplet format. The function returns the content of all rows whose index
i
satisfiesfirst <= i < last
. The triplets corresponding to nonzero entries are stored in the arrayssubi
,subj
andval
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – Index of the first row in the sequence. (input)last
(Int32
) – Index of the last row in the sequence plus one. (input)
- Return:
subi
(Int32
[]
) – Constraint subscripts.subj
(Int32
[]
) – Column subscripts.val
(Float64
[]
) – Values.
- Groups:
- getatrip¶
function getatrip(task::MSKtask) -> (subi :: Vector{Int32},subj :: Vector{Int32},val :: Vector{Float64})
Obtains \(A\) in sparse triplet format. The triplets corresponding to nonzero entries are stored in the arrays
subi
,subj
andval
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
subi
(Int32
[]
) – Constraint subscripts.subj
(Int32
[]
) – Column subscripts.val
(Float64
[]
) – Values.
- Groups:
- getatruncatetol¶
function getatruncatetol(task::MSKtask) -> tolzero :: Vector{Float64}
Obtains the tolerance value set with
putatruncatetol
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
tolzero
(Float64
[]
) – All elements \(|a_{i,j}|\) less than this tolerance is truncated to zero.- Groups:
- getbarablocktriplet¶
function getbarablocktriplet(task::MSKtask) -> (num :: Int64,subi :: Vector{Int32},subj :: Vector{Int32},subk :: Vector{Int32},subl :: Vector{Int32},valijkl :: Vector{Float64})
Obtains \(\barA\) in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – Number of elements in the block triplet form.subi
(Int32
[]
) – Constraint index.subj
(Int32
[]
) – Symmetric matrix variable index.subk
(Int32
[]
) – Block row index.subl
(Int32
[]
) – Block column index.valijkl
(Float64
[]
) – The numerical value associated with each block triplet.
- Groups:
- getbaraidx¶
function getbaraidx(task::MSKtask, idx::Int64) -> (i :: Int32,j :: Int32,num :: Int64,sub :: Vector{Int64},weights :: Vector{Float64}) function getbaraidx(task::MSKtask, idx::T0) where { T0<:Integer } -> (i :: Int32,j :: Int32,num :: Int64,sub :: Vector{Int64},weights :: Vector{Float64})
Obtains information about an element in \(\barA\). Since \(\barA\) is a sparse matrix of symmetric matrices, only the nonzero elements in \(\barA\) are stored in order to save space. Now \(\barA\) is stored vectorized i.e. as one long vector. This function makes it possible to obtain information such as the row index and the column index of a particular element of the vectorized form of \(\barA\).
Please observe if one element of \(\barA\) is inputted multiple times then it may be stored several times in vectorized form. In that case the element with the highest index is the one that is used.
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Position of the element in the vectorized form. (input)
- Return:
i
(Int32
) – Row index of the element at positionidx
.j
(Int32
) – Column index of the element at positionidx
.num
(Int64
) – Number of terms in weighted sum that forms the element.sub
(Int64
[]
) – A list indexes of the elements from symmetric matrix storage that appear in the weighted sum.weights
(Float64
[]
) – The weights associated with each term in the weighted sum.
- Groups:
- getbaraidxij¶
function getbaraidxij(task::MSKtask, idx::Int64) -> (i :: Int32,j :: Int32) function getbaraidxij(task::MSKtask, idx::T0) where { T0<:Integer } -> (i :: Int32,j :: Int32)
Obtains information about an element in \(\barA\). Since \(\barA\) is a sparse matrix of symmetric matrices, only the nonzero elements in \(\barA\) are stored in order to save space. Now \(\barA\) is stored vectorized i.e. as one long vector. This function makes it possible to obtain information such as the row index and the column index of a particular element of the vectorized form of \(\barA\).
Please note that if one element of \(\barA\) is inputted multiple times then it may be stored several times in vectorized form. In that case the element with the highest index is the one that is used.
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Position of the element in the vectorized form. (input)
- Return:
i
(Int32
) – Row index of the element at positionidx
.j
(Int32
) – Column index of the element at positionidx
.
- Groups:
- getbaraidxinfo¶
function getbaraidxinfo(task::MSKtask, idx::Int64) -> num :: Int64 function getbaraidxinfo(task::MSKtask, idx::T0) where { T0<:Integer } -> num :: Int64
Each nonzero element in \(\barA_{ij}\) is formed as a weighted sum of symmetric matrices. Using this function the number of terms in the weighted sum can be obtained. See description of
appendsparsesymmat
for details about the weighted sum.- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – The internal position of the element for which information should be obtained. (input)
- Return:
num
(Int64
) – Number of terms in the weighted sum that form the specified element in \(\barA\).- Groups:
- getbarasparsity¶
function getbarasparsity(task::MSKtask) -> (numnz :: Int64,idxij :: Vector{Int64})
The matrix \(\barA\) is assumed to be a sparse matrix of symmetric matrices. This implies that many of the elements in \(\barA\) are likely to be zero matrices. Therefore, in order to save space, only nonzero elements in \(\barA\) are stored on vectorized form. This function is used to obtain the sparsity pattern of \(\barA\) and the position of each nonzero element in the vectorized form of \(\barA\). From the index detailed information about each nonzero \(\barA_{i,j}\) can be obtained using
getbaraidxinfo
andgetbaraidx
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numnz
(Int64
) – Number of nonzero elements in \(\barA\).idxij
(Int64
[]
) – Position of each nonzero element in the vectorized form of \(\barA\).
- Groups:
- getbarcblocktriplet¶
function getbarcblocktriplet(task::MSKtask) -> (num :: Int64,subj :: Vector{Int32},subk :: Vector{Int32},subl :: Vector{Int32},valjkl :: Vector{Float64})
Obtains \(\barC\) in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – Number of elements in the block triplet form.subj
(Int32
[]
) – Symmetric matrix variable index.subk
(Int32
[]
) – Block row index.subl
(Int32
[]
) – Block column index.valjkl
(Float64
[]
) – The numerical value associated with each block triplet.
- Groups:
- getbarcidx¶
function getbarcidx(task::MSKtask, idx::Int64) -> (j :: Int32,num :: Int64,sub :: Vector{Int64},weights :: Vector{Float64}) function getbarcidx(task::MSKtask, idx::T0) where { T0<:Integer } -> (j :: Int32,num :: Int64,sub :: Vector{Int64},weights :: Vector{Float64})
Obtains information about an element in \(\barC\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Index of the element for which information should be obtained. (input)
- Return:
j
(Int32
) – Row index in \(\barC\).num
(Int64
) – Number of terms in the weighted sum.sub
(Int64
[]
) – Elements appearing the weighted sum.weights
(Float64
[]
) – Weights of terms in the weighted sum.
- Groups:
- getbarcidxinfo¶
function getbarcidxinfo(task::MSKtask, idx::Int64) -> num :: Int64 function getbarcidxinfo(task::MSKtask, idx::T0) where { T0<:Integer } -> num :: Int64
Obtains the number of terms in the weighted sum that forms a particular element in \(\barC\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Index of the element for which information should be obtained. The value is an index of a symmetric sparse variable. (input)
- Return:
num
(Int64
) – Number of terms that appear in the weighted sum that forms the requested element.- Groups:
- getbarcidxj¶
function getbarcidxj(task::MSKtask, idx::Int64) -> j :: Int32 function getbarcidxj(task::MSKtask, idx::T0) where { T0<:Integer } -> j :: Int32
Obtains the row index of an element in \(\barC\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Index of the element for which information should be obtained. (input)
- Return:
j
(Int32
) – Row index in \(\barC\).- Groups:
- getbarcsparsity¶
function getbarcsparsity(task::MSKtask) -> (numnz :: Int64,idxj :: Vector{Int64})
Internally only the nonzero elements of \(\barC\) are stored in a vector. This function is used to obtain the nonzero elements of \(\barC\) and their indexes in the internal vector representation (in
idx
). From the index detailed information about each nonzero \(\barC_j\) can be obtained usinggetbarcidxinfo
andgetbarcidx
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numnz
(Int64
) – Number of nonzero elements in \(\barC\).idxj
(Int64
[]
) – Internal positions of the nonzeros elements in \(\barC\).
- Groups:
- getbarsj¶
function getbarsj(task::MSKtask, whichsol::Soltype, j::Int32) -> barsj :: Vector{Float64} function getbarsj(task::MSKtask, whichsol::Soltype, j::T0) where { T0<:Integer } -> barsj :: Vector{Float64}
Obtains the dual solution for a semidefinite variable. Only the lower triangular part of \(\barS_j\) is returned because the matrix by construction is symmetric. The format is that the columns are stored sequentially in the natural order.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)j
(Int32
) – Index of the semidefinite variable. (input)
- Return:
barsj
(Float64
[]
) – Value of \(\barS_j\).- Groups:
- getbarsslice¶
function getbarsslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, slicesize::Int64) -> barsslice :: Vector{Float64} function getbarsslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, slicesize::T2) where { T0<:Integer, T1<:Integer, T2<:Integer } -> barsslice :: Vector{Float64}
Obtains the dual solution for a sequence of semidefinite variables. The format is that matrices are stored sequentially, and in each matrix the columns are stored as in
getbarsj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – Index of the first semidefinite variable in the slice. (input)last
(Int32
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(Int64
) – Denotes the length of the arraybarsslice
. (input)
- Return:
barsslice
(Float64
[]
) – Dual solution values of symmetric matrix variables in the slice, stored sequentially.- Groups:
- getbarvarname¶
function getbarvarname(task::MSKtask, i::Int32) -> name :: String function getbarvarname(task::MSKtask, i::T0) where { T0<:Integer } -> name :: String
Obtains the name of a semidefinite variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the variable. (input)
- Return:
name
(String
) – The requested name is copied to this buffer.- Groups:
- getbarvarnameindex¶
function getbarvarnameindex(task::MSKtask, somename::AbstractString) -> (asgn :: Int32,index :: Int32)
Obtains the index of semidefinite variable from its name.
- Parameters:
task
(MSKtask
) – An optimization task. (input)somename
(AbstractString
) – The name of the variable. (input)
- Return:
asgn
(Int32
) – Non-zero if the namesomename
is assigned to some semidefinite variable.index
(Int32
) – The index of a semidefinite variable with the namesomename
(if one exists).
- Groups:
- getbarvarnamelen¶
function getbarvarnamelen(task::MSKtask, i::Int32) -> len :: Int32 function getbarvarnamelen(task::MSKtask, i::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of a semidefinite variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the variable. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
- getbarxj¶
function getbarxj(task::MSKtask, whichsol::Soltype, j::Int32) -> barxj :: Vector{Float64} function getbarxj(task::MSKtask, whichsol::Soltype, j::T0) where { T0<:Integer } -> barxj :: Vector{Float64}
Obtains the primal solution for a semidefinite variable. Only the lower triangular part of \(\barX_j\) is returned because the matrix by construction is symmetric. The format is that the columns are stored sequentially in the natural order.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)j
(Int32
) – Index of the semidefinite variable. (input)
- Return:
barxj
(Float64
[]
) – Value of \(\barX_j\).- Groups:
- getbarxslice¶
function getbarxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, slicesize::Int64) -> barxslice :: Vector{Float64} function getbarxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, slicesize::T2) where { T0<:Integer, T1<:Integer, T2<:Integer } -> barxslice :: Vector{Float64}
Obtains the primal solution for a sequence of semidefinite variables. The format is that matrices are stored sequentially, and in each matrix the columns are stored as in
getbarxj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – Index of the first semidefinite variable in the slice. (input)last
(Int32
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(Int64
) – Denotes the length of the arraybarxslice
. (input)
- Return:
barxslice
(Float64
[]
) – Solution values of symmetric matrix variables in the slice, stored sequentially.- Groups:
- getc¶
function getc(task::MSKtask) -> c :: Vector{Float64}
Obtains all objective coefficients \(c\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
c
(Float64
[]
) – Linear terms of the objective as a dense vector. The length is the number of variables.- Groups:
Problem data - linear part, Inspecting the task, Problem data - variables
- getcfix¶
function getcfix(task::MSKtask) -> cfix :: Float64
Obtains the fixed term in the objective.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
cfix
(Float64
) – Fixed term in the objective.- Groups:
- getcj¶
function getcj(task::MSKtask, j::Int32) -> cj :: Float64 function getcj(task::MSKtask, j::T0) where { T0<:Integer } -> cj :: Float64
Obtains one coefficient of \(c\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable for which the \(c\) coefficient should be obtained. (input)
- Return:
cj
(Float64
) – The value of \(c_j\).- Groups:
Problem data - linear part, Inspecting the task, Problem data - variables
- getclist¶
function getclist(task::MSKtask, subj::Vector{Int32}) -> c :: Vector{Float64} function getclist(task::MSKtask, subj::T0) where { T0<:AbstractVector{<:Integer} } -> c :: Vector{Float64}
Obtains a sequence of elements in \(c\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – A list of variable indexes. (input)
- Return:
c
(Float64
[]
) – Linear terms of the requested list of the objective as a dense vector.- Groups:
- getcodedesc¶
function getcodedesc(code::Rescode) -> (symname :: String,str :: String)
Obtains a short description of the meaning of the response code given by
code
.- Parameters:
code
(Rescode
) – A valid MOSEK response code. (input)- Return:
symname
(String
) – Symbolic name corresponding tocode
.str
(String
) – Obtains a short description of a response code.
- Groups:
- getconbound¶
function getconbound(task::MSKtask, i::Int32) -> (bk :: Boundkey,bl :: Float64,bu :: Float64) function getconbound(task::MSKtask, i::T0) where { T0<:Integer } -> (bk :: Boundkey,bl :: Float64,bu :: Float64)
Obtains bound information for one constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint for which the bound information should be obtained. (input)
- Return:
bk
(Boundkey
) – Bound keys.bl
(Float64
) – Values for lower bounds.bu
(Float64
) – Values for upper bounds.
- Groups:
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- getconboundslice¶
function getconboundslice(task::MSKtask, first::Int32, last::Int32) -> (bk :: Vector{Boundkey},bl :: Vector{Float64},bu :: Vector{Float64}) function getconboundslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (bk :: Vector{Boundkey},bl :: Vector{Float64},bu :: Vector{Float64})
Obtains bounds information for a slice of the constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
bk
(Boundkey
[]
) – Bound keys.bl
(Float64
[]
) – Values for lower bounds.bu
(Float64
[]
) – Values for upper bounds.
- Groups:
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- getcone Deprecated¶
function getcone(task::MSKtask, k::Int32) -> (ct :: Conetype,conepar :: Float64,nummem :: Int32,submem :: Vector{Int32}) function getcone(task::MSKtask, k::T0) where { T0<:Integer } -> (ct :: Conetype,conepar :: Float64,nummem :: Int32,submem :: Vector{Int32})
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Index of the cone. (input)
- Return:
ct
(Conetype
) – Specifies the type of the cone.conepar
(Float64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0.nummem
(Int32
) – Number of member variables in the cone.submem
(Int32
[]
) – Variable subscripts of the members in the cone.
- Groups:
- getconeinfo Deprecated¶
function getconeinfo(task::MSKtask, k::Int32) -> (ct :: Conetype,conepar :: Float64,nummem :: Int32) function getconeinfo(task::MSKtask, k::T0) where { T0<:Integer } -> (ct :: Conetype,conepar :: Float64,nummem :: Int32)
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Index of the cone. (input)
- Return:
ct
(Conetype
) – Specifies the type of the cone.conepar
(Float64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0.nummem
(Int32
) – Number of member variables in the cone.
- Groups:
- getconename Deprecated¶
function getconename(task::MSKtask, i::Int32) -> name :: String function getconename(task::MSKtask, i::T0) where { T0<:Integer } -> name :: String
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the cone. (input)
- Return:
name
(String
) – The required name.- Groups:
Names, Problem data - cones (deprecated), Inspecting the task
- getconenameindex Deprecated¶
function getconenameindex(task::MSKtask, somename::AbstractString) -> (asgn :: Int32,index :: Int32)
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Checks whether the name
somename
has been assigned to any cone. If it has been assigned to a cone, then the index of the cone is reported.- Parameters:
task
(MSKtask
) – An optimization task. (input)somename
(AbstractString
) – The name which should be checked. (input)
- Return:
asgn
(Int32
) – Is non-zero if the namesomename
is assigned to some cone.index
(Int32
) – If the namesomename
is assigned to some cone, thenindex
is the index of the cone.
- Groups:
Names, Problem data - cones (deprecated), Inspecting the task
- getconenamelen Deprecated¶
function getconenamelen(task::MSKtask, i::Int32) -> len :: Int32 function getconenamelen(task::MSKtask, i::T0) where { T0<:Integer } -> len :: Int32
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the cone. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
Names, Problem data - cones (deprecated), Inspecting the task
- getconname¶
function getconname(task::MSKtask, i::Int32) -> name :: String function getconname(task::MSKtask, i::T0) where { T0<:Integer } -> name :: String
Obtains the name of a constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint. (input)
- Return:
name
(String
) – The required name.- Groups:
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- getconnameindex¶
function getconnameindex(task::MSKtask, somename::AbstractString) -> (asgn :: Int32,index :: Int32)
Checks whether the name
somename
has been assigned to any constraint. If so, the index of the constraint is reported.- Parameters:
task
(MSKtask
) – An optimization task. (input)somename
(AbstractString
) – The name which should be checked. (input)
- Return:
asgn
(Int32
) – Is non-zero if the namesomename
is assigned to some constraint.index
(Int32
) – If the namesomename
is assigned to a constraint, thenindex
is the index of the constraint.
- Groups:
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- getconnamelen¶
function getconnamelen(task::MSKtask, i::Int32) -> len :: Int32 function getconnamelen(task::MSKtask, i::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of a constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- getcslice¶
function getcslice(task::MSKtask, first::Int32, last::Int32) -> c :: Vector{Float64} function getcslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> c :: Vector{Float64}
Obtains a sequence of elements in \(c\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
c
(Float64
[]
) – Linear terms of the requested slice of the objective as a dense vector. The length islast-first
.- Groups:
- getdimbarvarj¶
function getdimbarvarj(task::MSKtask, j::Int32) -> dimbarvarj :: Int32 function getdimbarvarj(task::MSKtask, j::T0) where { T0<:Integer } -> dimbarvarj :: Int32
Obtains the dimension of a symmetric matrix variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the semidefinite variable whose dimension is requested. (input)
- Return:
dimbarvarj
(Int32
) – The dimension of the \(j\)-th semidefinite variable.- Groups:
- getdjcafeidxlist¶
function getdjcafeidxlist(task::MSKtask, djcidx::Int64) -> afeidxlist :: Vector{Int64} function getdjcafeidxlist(task::MSKtask, djcidx::T0) where { T0<:Integer } -> afeidxlist :: Vector{Int64}
Obtains the list of affine expression indexes in a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
afeidxlist
(Int64
[]
) – List of affine expression indexes.- Groups:
- getdjcb¶
function getdjcb(task::MSKtask, djcidx::Int64) -> b :: Vector{Float64} function getdjcb(task::MSKtask, djcidx::T0) where { T0<:Integer } -> b :: Vector{Float64}
Obtains the optional constant term vector of a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
b
(Float64
[]
) – The vector b.- Groups:
- getdjcdomainidxlist¶
function getdjcdomainidxlist(task::MSKtask, djcidx::Int64) -> domidxlist :: Vector{Int64} function getdjcdomainidxlist(task::MSKtask, djcidx::T0) where { T0<:Integer } -> domidxlist :: Vector{Int64}
Obtains the list of domain indexes in a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
domidxlist
(Int64
[]
) – List of term sizes.- Groups:
- getdjcname¶
function getdjcname(task::MSKtask, djcidx::Int64) -> name :: String function getdjcname(task::MSKtask, djcidx::T0) where { T0<:Integer } -> name :: String
Obtains the name of a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of a disjunctive constraint. (input)
- Return:
name
(String
) – Returns the required name.- Groups:
Names, Problem data - disjunctive constraints, Inspecting the task
- getdjcnamelen¶
function getdjcnamelen(task::MSKtask, djcidx::Int64) -> len :: Int32 function getdjcnamelen(task::MSKtask, djcidx::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of a disjunctive constraint. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
Names, Problem data - disjunctive constraints, Inspecting the task
- getdjcnumafe¶
function getdjcnumafe(task::MSKtask, djcidx::Int64) -> numafe :: Int64 function getdjcnumafe(task::MSKtask, djcidx::T0) where { T0<:Integer } -> numafe :: Int64
Obtains the number of affine expressions in the disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
numafe
(Int64
) – Number of affine expressions in the disjunctive constraint.- Groups:
- getdjcnumafetot¶
function getdjcnumafetot(task::MSKtask) -> numafetot :: Int64
Obtains the total number of affine expressions in all disjunctive constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numafetot
(Int64
) – Number of affine expressions in all disjunctive constraints.- Groups:
- getdjcnumdomain¶
function getdjcnumdomain(task::MSKtask, djcidx::Int64) -> numdomain :: Int64 function getdjcnumdomain(task::MSKtask, djcidx::T0) where { T0<:Integer } -> numdomain :: Int64
Obtains the number of domains in the disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
numdomain
(Int64
) – Number of domains in the disjunctive constraint.- Groups:
- getdjcnumdomaintot¶
function getdjcnumdomaintot(task::MSKtask) -> numdomaintot :: Int64
Obtains the total number of domains in all disjunctive constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numdomaintot
(Int64
) – Number of domains in all disjunctive constraints.- Groups:
- getdjcnumterm¶
function getdjcnumterm(task::MSKtask, djcidx::Int64) -> numterm :: Int64 function getdjcnumterm(task::MSKtask, djcidx::T0) where { T0<:Integer } -> numterm :: Int64
Obtains the number terms in the disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
numterm
(Int64
) – Number of terms in the disjunctive constraint.- Groups:
- getdjcnumtermtot¶
function getdjcnumtermtot(task::MSKtask) -> numtermtot :: Int64
Obtains the total number of terms in all disjunctive constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numtermtot
(Int64
) – Total number of terms in all disjunctive constraints.- Groups:
- getdjcs¶
function getdjcs(task::MSKtask) -> (domidxlist :: Vector{Int64},afeidxlist :: Vector{Int64},b :: Vector{Float64},termsizelist :: Vector{Int64},numterms :: Vector{Int64})
Obtains full data of all disjunctive constraints. The output arrays must have minimal lengths determined by the following methods:
domainidxlist
bygetdjcnumdomaintot
,afeidxlist
andb
bygetdjcnumafetot
,termsizelist
bygetdjcnumtermtot
andnumterms
bygetnumdomain
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
domidxlist
(Int64
[]
) – The concatenation of index lists of domains appearing in all disjunctive constraints.afeidxlist
(Int64
[]
) – The concatenation of index lists of affine expressions appearing in all disjunctive constraints.b
(Float64
[]
) – The concatenation of vectors b appearing in all disjunctive constraints.termsizelist
(Int64
[]
) – The concatenation of lists of term sizes appearing in all disjunctive constraints.numterms
(Int64
[]
) – The number of terms in each of the disjunctive constraints.
- Groups:
- getdjctermsizelist¶
function getdjctermsizelist(task::MSKtask, djcidx::Int64) -> termsizelist :: Vector{Int64} function getdjctermsizelist(task::MSKtask, djcidx::T0) where { T0<:Integer } -> termsizelist :: Vector{Int64}
Obtains the list of term sizes in a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)
- Return:
termsizelist
(Int64
[]
) – List of term sizes.- Groups:
- getdomainn¶
function getdomainn(task::MSKtask, domidx::Int64) -> n :: Int64 function getdomainn(task::MSKtask, domidx::T0) where { T0<:Integer } -> n :: Int64
Obtains the dimension of the domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of the domain. (input)
- Return:
n
(Int64
) – Dimension of the domain.- Groups:
- getdomainname¶
function getdomainname(task::MSKtask, domidx::Int64) -> name :: String function getdomainname(task::MSKtask, domidx::T0) where { T0<:Integer } -> name :: String
Obtains the name of a domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of a domain. (input)
- Return:
name
(String
) – Returns the required name.- Groups:
- getdomainnamelen¶
function getdomainnamelen(task::MSKtask, domidx::Int64) -> len :: Int32 function getdomainnamelen(task::MSKtask, domidx::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of a domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of a domain. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
- getdomaintype¶
function getdomaintype(task::MSKtask, domidx::Int64) -> domtype :: Domaintype function getdomaintype(task::MSKtask, domidx::T0) where { T0<:Integer } -> domtype :: Domaintype
Returns the type of the domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of the domain. (input)
- Return:
domtype
(Domaintype
) – The type of the domain.- Groups:
- getdouinf¶
function getdouinf(task::MSKtask, whichdinf::Dinfitem) -> dvalue :: Float64
Obtains a double information item from the task information database.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichdinf
(Dinfitem
) – Specifies a double information item. (input)
- Return:
dvalue
(Float64
) – The value of the required double information item.- Groups:
- getdouparam¶
function getdouparam(task::MSKtask, param::Dparam) -> parvalue :: Float64
Obtains the value of a double parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Dparam
) – Which parameter. (input)
- Return:
parvalue
(Float64
) – Parameter value.- Groups:
- getdualobj¶
function getdualobj(task::MSKtask, whichsol::Soltype) -> dualobj :: Float64
Computes the dual objective value associated with the solution. Note that if the solution is a primal infeasibility certificate, then the fixed term in the objective value is not included.
Moreover, since there is no dual solution associated with an integer solution, an error will be reported if the dual objective value is requested for the integer solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
dualobj
(Float64
) – Objective value corresponding to the dual solution.- Groups:
- getdualproblem¶
function getdualproblem(task::MSKtask) -> dualtask :: MSKtask
Returns the dual problem as a task. The dual computed by this function is intended for demonstration, educational and debugging purposes. It closely follows the dual form introduced in the documentation, but need not exactly reflect dualization taking place internally in the solver.
The function attempts to detect sparse LMIs and remove redundant linear constraints, trying to formulate the most efficient dual LMI (i.e. SDP in primal form), unless
MSK_IPAR_GETDUAL_CONVERT_LMIS
is turned off.Problems with quadratic objective or constraints are not supported. Integer variables and disjunctive constraints are ignored and only a warning is issued.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
dualtask
(MSKtask
) – A new task containing the dualized problem.- Groups:
- getdualsolutionnorms¶
function getdualsolutionnorms(task::MSKtask, whichsol::Soltype) -> (nrmy :: Float64,nrmslc :: Float64,nrmsuc :: Float64,nrmslx :: Float64,nrmsux :: Float64,nrmsnx :: Float64,nrmbars :: Float64)
Compute norms of the dual solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
nrmy
(Float64
) – The norm of the \(y\) vector.nrmslc
(Float64
) – The norm of the \(s_l^c\) vector.nrmsuc
(Float64
) – The norm of the \(s_u^c\) vector.nrmslx
(Float64
) – The norm of the \(s_l^x\) vector.nrmsux
(Float64
) – The norm of the \(s_u^x\) vector.nrmsnx
(Float64
) – The norm of the \(s_n^x\) vector.nrmbars
(Float64
) – The norm of the \(\barS\) vector.
- Groups:
- getdviolacc¶
function getdviolacc(task::MSKtask, whichsol::Soltype, accidxlist::Vector{Int64}) -> viol :: Vector{Float64} function getdviolacc(task::MSKtask, whichsol::Soltype, accidxlist::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Let \((s_n^x)^*\) be the value of variable \((s_n^x)\) for the specified solution. For simplicity let us assume that \(s_n^x\) is a member of a quadratic cone, then the violation is computed as follows
\[\begin{split}\left\{ \begin{array}{ll} \max(0,(\|s_n^x\|_{2:n}^*-(s_n^x)_1^*) / \sqrt{2}, & (s_n^x)^* \geq -\|(s_n^x)_{2:n}^*\|, \\ \|(s_n^x)^*\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]Both when the solution is a certificate of primal infeasibility or when it is a dual feasible solution the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)accidxlist
(Int64
[]
) – An array of indexes of conic constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
.- Groups:
- getdviolbarvar¶
function getdviolbarvar(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getdviolbarvar(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Let \((\barS_j)^*\) be the value of variable \(\barS_j\) for the specified solution. Then the dual violation of the solution associated with variable \(\barS_j\) is given by
\[\max(-\lambda_{\min}(\barS_j),\ 0.0).\]Both when the solution is a certificate of primal infeasibility and when it is dual feasible solution the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of \(\barX\) variables. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the solution for the constraint \(\barS_{\mathtt{sub}[k]} \in \PSD\).- Groups:
- getdviolcon¶
function getdviolcon(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getdviolcon(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
The violation of the dual solution associated with the \(i\)-th constraint is computed as follows
\[\max( \rho( (s_l^c)_i^*,(b_l^c)_i ),\ \rho( (s_u^c)_i^*, -(b_u^c)_i ),\ |-y_i+(s_l^c)_i^*-(s_u^c)_i^*| )\]where
\[\begin{split}\rho(x,l) = \left\{ \begin{array}{ll} -x, & l > -\infty , \\ |x|, & \mbox{otherwise}.\\ \end{array} \right.\end{split}\]Both when the solution is a certificate of primal infeasibility or it is a dual feasible solution the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of dual solution associated with the constraintsub[k]
.- Groups:
- getdviolcones Deprecated¶
function getdviolcones(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getdviolcones(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Let \((s_n^x)^*\) be the value of variable \((s_n^x)\) for the specified solution. For simplicity let us assume that \(s_n^x\) is a member of a quadratic cone, then the violation is computed as follows
\[\begin{split}\left\{ \begin{array}{ll} \max(0,(\|s_n^x\|_{2:n}^*-(s_n^x)_1^*) / \sqrt{2}, & (s_n^x)^* \geq -\|(s_n^x)_{2:n}^*\|, \\ \|(s_n^x)^*\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]Both when the solution is a certificate of primal infeasibility or when it is a dual feasible solution the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of conic constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
.- Groups:
- getdviolvar¶
function getdviolvar(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getdviolvar(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
The violation of the dual solution associated with the \(j\)-th variable is computed as follows
\[\max \left(\rho((s_l^x)_j^*,(b_l^x)_j),\ \rho((s_u^x)_j^*,-(b_u^x)_j),\ |\sum_{i=\idxbeg}^{\idxend{\mathtt{numcon}}} a_{ij} y_i+(s_l^x)_j^*-(s_u^x)_j^* - \tau c_j| \right)\]where
\[\begin{split}\rho(x,l) = \left\{ \begin{array}{ll} -x, & l > -\infty , \\ |x|, & \mbox{otherwise} \end{array} \right.\end{split}\]and \(\tau=0\) if the solution is a certificate of primal infeasibility and \(\tau=1\) otherwise. The formula for computing the violation is only shown for the linear case but is generalized appropriately for the more general problems. Both when the solution is a certificate of primal infeasibility or when it is a dual feasible solution the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of \(x\) variables. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of dual solution associated with the variablesub[k]
.- Groups:
- getinfeasiblesubproblem¶
function getinfeasiblesubproblem(task::MSKtask, whichsol::Soltype) -> inftask :: MSKtask
Given the solution is a certificate of primal or dual infeasibility then a primal or dual infeasible subproblem is obtained respectively. The subproblem tends to be much smaller than the original problem and hence it is easier to locate the infeasibility inspecting the subproblem than the original problem.
For the procedure to be useful it is important to assign meaningful names to constraints, variables etc. in the original task because those names will be duplicated in the subproblem.
The function is only applicable to linear and conic quadratic optimization problems.
For more information see Sec. 8.3 (Debugging infeasibility) and Sec. 14.2 (Automatic Repair of Infeasible Problems).
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Which solution to use when determining the infeasible subproblem. (input)
- Return:
inftask
(MSKtask
) – A new task containing the infeasible subproblem.- Groups:
- getinfname¶
function getinfname(task::MSKtask, inftype::Inftype, whichinf::Int32) -> infname :: String function getinfname(task::MSKtask, inftype::Inftype, whichinf::T0) where { T0<:Integer } -> infname :: String
Obtains the name of an information item.
- Parameters:
task
(MSKtask
) – An optimization task. (input)inftype
(Inftype
) – Type of the information item. (input)whichinf
(Int32
) – An information item. (input)
- Return:
infname
(String
) – Name of the information item.- Groups:
- getintinf¶
function getintinf(task::MSKtask, whichiinf::Iinfitem) -> ivalue :: Int32
Obtains an integer information item from the task information database.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichiinf
(Iinfitem
) – Specifies an integer information item. (input)
- Return:
ivalue
(Int32
) – The value of the required integer information item.- Groups:
- getintparam¶
function getintparam(task::MSKtask, param::Iparam) -> parvalue :: Int32
Obtains the value of an integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Iparam
) – Which parameter. (input)
- Return:
parvalue
(Int32
) – Parameter value.- Groups:
- getlasterror¶
function getlasterror(task::MSKtask) -> (lastrescode :: Rescode,lastmsglen :: Int64,lastmsg :: String)
Obtains the last response code and corresponding message reported in MOSEK.
If there is no previous error, warning or termination code for this task,
lastrescode
returnsMSK_RES_OK
andlastmsg
returns an empty string, otherwise the last response code different fromMSK_RES_OK
and the corresponding message are returned.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
lastrescode
(Rescode
) – Returns the last error code reported in the task.lastmsglen
(Int64
) – Returns the length of the last error message reported in the task.lastmsg
(String
) – Returns the last error message reported in the task.
- Groups:
- getlenbarvarj¶
function getlenbarvarj(task::MSKtask, j::Int32) -> lenbarvarj :: Int64 function getlenbarvarj(task::MSKtask, j::T0) where { T0<:Integer } -> lenbarvarj :: Int64
Obtains the length of the \(j\)-th semidefinite variable i.e. the number of elements in the lower triangular part.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the semidefinite variable whose length if requested. (input)
- Return:
lenbarvarj
(Int64
) – Number of scalar elements in the lower triangular part of the semidefinite variable.- Groups:
- getlintinf¶
function getlintinf(task::MSKtask, whichliinf::Liinfitem) -> ivalue :: Int64
Obtains a long integer information item from the task information database.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichliinf
(Liinfitem
) – Specifies a long information item. (input)
- Return:
ivalue
(Int64
) – The value of the required long integer information item.- Groups:
- getlintparam¶
function getlintparam(task::MSKtask, param::Iparam) -> parvalue :: Int64
Obtains the value of an integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Iparam
) – Which parameter. (input)
- Return:
parvalue
(Int64
) – Parameter value.- Groups:
- getmaxnumanz¶
function getmaxnumanz(task::MSKtask) -> maxnumanz :: Int64
Obtains number of preallocated non-zeros in \(A\). When this number of non-zeros is reached MOSEK will automatically allocate more space for \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumanz
(Int64
) – Number of preallocated non-zero linear matrix elements.- Groups:
- getmaxnumbarvar¶
function getmaxnumbarvar(task::MSKtask) -> maxnumbarvar :: Int32
Obtains maximum number of symmetric matrix variables for which space is currently preallocated.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumbarvar
(Int32
) – Maximum number of symmetric matrix variables for which space is currently preallocated.- Groups:
- getmaxnumcon¶
function getmaxnumcon(task::MSKtask) -> maxnumcon :: Int32
Obtains the number of preallocated constraints in the optimization task. When this number of constraints is reached MOSEK will automatically allocate more space for constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumcon
(Int32
) – Number of preallocated constraints in the optimization task.- Groups:
Inspecting the task, Problem data - linear part, Problem data - constraints
- getmaxnumcone Deprecated¶
function getmaxnumcone(task::MSKtask) -> maxnumcone :: Int32
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Obtains the number of preallocated cones in the optimization task. When this number of cones is reached MOSEK will automatically allocate space for more cones.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumcone
(Int32
) – Number of preallocated conic constraints in the optimization task.- Groups:
- getmaxnumqnz¶
function getmaxnumqnz(task::MSKtask) -> maxnumqnz :: Int64
Obtains the number of preallocated non-zeros for \(Q\) (both objective and constraints). When this number of non-zeros is reached MOSEK will automatically allocate more space for \(Q\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumqnz
(Int64
) – Number of non-zero elements preallocated in quadratic coefficient matrices.- Groups:
- getmaxnumvar¶
function getmaxnumvar(task::MSKtask) -> maxnumvar :: Int32
Obtains the number of preallocated variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
maxnumvar
(Int32
) – Number of preallocated variables in the optimization task.- Groups:
Inspecting the task, Problem data - linear part, Problem data - variables
- getmemusage¶
function getmemusage(task::MSKtask) -> (meminuse :: Int64,maxmemuse :: Int64)
Obtains information about the amount of memory used by a task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
meminuse
(Int64
) – Amount of memory currently used by thetask
.maxmemuse
(Int64
) – Maximum amount of memory used by thetask
until now.
- Groups:
- getnadouinf¶
function getnadouinf(task::MSKtask, infitemname::AbstractString) -> dvalue :: Float64
Obtains a named double information item from task information database.
- Parameters:
task
(MSKtask
) – An optimization task. (input)infitemname
(AbstractString
) – The name of a double information item. (input)
- Return:
dvalue
(Float64
) – The value of the required double information item.- Groups:
- getnadouparam¶
function getnadouparam(task::MSKtask, paramname::AbstractString) -> parvalue :: Float64
Obtains the value of a named double parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)
- Return:
parvalue
(Float64
) – Parameter value.- Groups:
- getnaintinf¶
function getnaintinf(task::MSKtask, infitemname::AbstractString) -> ivalue :: Int32
Obtains a named integer information item from the task information database.
- Parameters:
task
(MSKtask
) – An optimization task. (input)infitemname
(AbstractString
) – The name of an integer information item. (input)
- Return:
ivalue
(Int32
) – The value of the required integer information item.- Groups:
- getnaintparam¶
function getnaintparam(task::MSKtask, paramname::AbstractString) -> parvalue :: Int32
Obtains the value of a named integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)
- Return:
parvalue
(Int32
) – Parameter value.- Groups:
- getnastrparam¶
function getnastrparam(task::MSKtask, paramname::AbstractString, sizeparamname::Int32) -> (len :: Int32,parvalue :: String) function getnastrparam(task::MSKtask, paramname::Union{Nothing,AbstractString}, sizeparamname::T0) where { T0<:Integer } -> (len :: Int32,parvalue :: String)
Obtains the value of a named string parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)sizeparamname
(Int32
) – Size of the name bufferparvalue
. (input)
- Return:
len
(Int32
) – Length of the string inparvalue
.parvalue
(String
) – Parameter value.
- Groups:
- getnumacc¶
function getnumacc(task::MSKtask) -> num :: Int64
Obtains the number of affine conic constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – The number of affine conic constraints.- Groups:
Problem data - affine conic constraints, Inspecting the task
- getnumafe¶
function getnumafe(task::MSKtask) -> numafe :: Int64
Obtains the number of affine expressions.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numafe
(Int64
) – Number of affine expressions.- Groups:
- getnumanz¶
function getnumanz(task::MSKtask) -> numanz :: Int64
Obtains the number of non-zeros in \(A\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numanz
(Int64
) – Number of non-zero elements in the linear constraint matrix.- Groups:
- getnumbarablocktriplets¶
function getnumbarablocktriplets(task::MSKtask) -> num :: Int64
Obtains an upper bound on the number of elements in the block triplet form of \(\barA\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – An upper bound on the number of elements in the block triplet form of \(\barA.\)- Groups:
- getnumbaranz¶
function getnumbaranz(task::MSKtask) -> nz :: Int64
Get the number of nonzero elements in \(\barA\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
nz
(Int64
) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero.- Groups:
- getnumbarcblocktriplets¶
function getnumbarcblocktriplets(task::MSKtask) -> num :: Int64
Obtains an upper bound on the number of elements in the block triplet form of \(\barC\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – An upper bound on the number of elements in the block triplet form of \(\barC.\)- Groups:
- getnumbarcnz¶
function getnumbarcnz(task::MSKtask) -> nz :: Int64
Obtains the number of nonzero elements in \(\barC\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
nz
(Int64
) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero.- Groups:
- getnumbarvar¶
function getnumbarvar(task::MSKtask) -> numbarvar :: Int32
Obtains the number of semidefinite variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numbarvar
(Int32
) – Number of semidefinite variables in the problem.- Groups:
- getnumcon¶
function getnumcon(task::MSKtask) -> numcon :: Int32
Obtains the number of constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numcon
(Int32
) – Number of constraints.- Groups:
Problem data - linear part, Problem data - constraints, Inspecting the task
- getnumcone Deprecated¶
function getnumcone(task::MSKtask) -> numcone :: Int32
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numcone
(Int32
) – Number of conic constraints.- Groups:
- getnumconemem Deprecated¶
function getnumconemem(task::MSKtask, k::Int32) -> nummem :: Int32 function getnumconemem(task::MSKtask, k::T0) where { T0<:Integer } -> nummem :: Int32
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Index of the cone. (input)
- Return:
nummem
(Int32
) – Number of member variables in the cone.- Groups:
- getnumdjc¶
function getnumdjc(task::MSKtask) -> num :: Int64
Obtains the number of disjunctive constraints.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – The number of disjunctive constraints.- Groups:
- getnumdomain¶
function getnumdomain(task::MSKtask) -> numdomain :: Int64
Obtain the number of domains defined.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numdomain
(Int64
) – Number of domains in the task.- Groups:
- getnumintvar¶
function getnumintvar(task::MSKtask) -> numintvar :: Int32
Obtains the number of integer-constrained variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numintvar
(Int32
) – Number of integer variables.- Groups:
- getnumparam¶
function getnumparam(task::MSKtask, partype::Parametertype) -> numparam :: Int32
Obtains the number of parameters of a given type.
- Parameters:
task
(MSKtask
) – An optimization task. (input)partype
(Parametertype
) – Parameter type. (input)
- Return:
numparam
(Int32
) – The number of parameters of typepartype
.- Groups:
- getnumqconknz¶
function getnumqconknz(task::MSKtask, k::Int32) -> numqcnz :: Int64 function getnumqconknz(task::MSKtask, k::T0) where { T0<:Integer } -> numqcnz :: Int64
Obtains the number of non-zero quadratic terms in a constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Index of the constraint for which the number quadratic terms should be obtained. (input)
- Return:
numqcnz
(Int64
) – Number of quadratic terms.- Groups:
Inspecting the task, Problem data - constraints, Problem data - quadratic part
- getnumqobjnz¶
function getnumqobjnz(task::MSKtask) -> numqonz :: Int64
Obtains the number of non-zero quadratic terms in the objective.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numqonz
(Int64
) – Number of non-zero elements in the quadratic objective terms.- Groups:
- getnumsymmat¶
function getnumsymmat(task::MSKtask) -> num :: Int64
Obtains the number of symmetric matrices stored in the vector \(E\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
num
(Int64
) – The number of symmetric sparse matrices.- Groups:
- getnumvar¶
function getnumvar(task::MSKtask) -> numvar :: Int32
Obtains the number of variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numvar
(Int32
) – Number of variables.- Groups:
- getobjname¶
function getobjname(task::MSKtask) -> objname :: String
Obtains the name assigned to the objective function.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
objname
(String
) – Assigned the objective name.- Groups:
- getobjnamelen¶
function getobjnamelen(task::MSKtask) -> len :: Int32
Obtains the length of the name assigned to the objective function.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
len
(Int32
) – Assigned the length of the objective name.- Groups:
- getobjsense¶
function getobjsense(task::MSKtask) -> sense :: Objsense
Gets the objective sense of the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
sense
(Objsense
) – The returned objective sense.- Groups:
- getparamname¶
function getparamname(task::MSKtask, partype::Parametertype, param::Int32) -> parname :: String function getparamname(task::MSKtask, partype::Parametertype, param::T0) where { T0<:Integer } -> parname :: String
Obtains the name for a parameter
param
of typepartype
.- Parameters:
task
(MSKtask
) – An optimization task. (input)partype
(Parametertype
) – Parameter type. (input)param
(Int32
) – Which parameter. (input)
- Return:
parname
(String
) – Parameter name.- Groups:
- getpowerdomainalpha¶
function getpowerdomainalpha(task::MSKtask, domidx::Int64) -> alpha :: Vector{Float64} function getpowerdomainalpha(task::MSKtask, domidx::T0) where { T0<:Integer } -> alpha :: Vector{Float64}
Obtains the exponent vector \(\alpha\) of a primal or dual power cone domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of the domain. (input)
- Return:
alpha
(Float64
[]
) – The vector \(\alpha\).- Groups:
- getpowerdomaininfo¶
function getpowerdomaininfo(task::MSKtask, domidx::Int64) -> (n :: Int64,nleft :: Int64) function getpowerdomaininfo(task::MSKtask, domidx::T0) where { T0<:Integer } -> (n :: Int64,nleft :: Int64)
Obtains structural information about a primal or dual power cone domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of the domain. (input)
- Return:
n
(Int64
) – Dimension of the domain.nleft
(Int64
) – Number of variables on the left hand side.
- Groups:
- getprimalobj¶
function getprimalobj(task::MSKtask, whichsol::Soltype) -> primalobj :: Float64
Computes the primal objective value for the desired solution. Note that if the solution is an infeasibility certificate, then the fixed term in the objective is not included.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
primalobj
(Float64
) – Objective value corresponding to the primal solution.- Groups:
- getprimalsolutionnorms¶
function getprimalsolutionnorms(task::MSKtask, whichsol::Soltype) -> (nrmxc :: Float64,nrmxx :: Float64,nrmbarx :: Float64)
Compute norms of the primal solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
nrmxc
(Float64
) – The norm of the \(x^c\) vector.nrmxx
(Float64
) – The norm of the \(x\) vector.nrmbarx
(Float64
) – The norm of the \(\barX\) vector.
- Groups:
- getprobtype¶
function getprobtype(task::MSKtask) -> probtype :: Problemtype
Obtains the problem type.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
probtype
(Problemtype
) – The problem type.- Groups:
- getprosta¶
function getprosta(task::MSKtask, whichsol::Soltype) -> problemsta :: Prosta
Obtains the problem status.
- getpviolacc¶
function getpviolacc(task::MSKtask, whichsol::Soltype, accidxlist::Vector{Int64}) -> viol :: Vector{Float64} function getpviolacc(task::MSKtask, whichsol::Soltype, accidxlist::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Computes the primal solution violation for a set of affine conic constraints. Let \(x^*\) be the value of the variable \(x\) for the specified solution. For simplicity let us assume that \(x\) is a member of a quadratic cone, then the violation is computed as follows
\[\begin{split}\left\{ \begin{array}{ll} \max(0,\|x_{2:n}\|-x_1) / \sqrt{2}, & x_1 \geq -\|x_{2:n}\|, \\ \|x\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]Both when the solution is a certificate of dual infeasibility or when it is primal feasible the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)accidxlist
(Int64
[]
) – An array of indexes of conic constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the solution associated with the affine conic constraint numberaccidxlist[k]
.- Groups:
- getpviolbarvar¶
function getpviolbarvar(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getpviolbarvar(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Computes the primal solution violation for a set of semidefinite variables. Let \((\barX_j)^*\) be the value of the variable \(\barX_j\) for the specified solution. Then the primal violation of the solution associated with variable \(\barX_j\) is given by
\[\max(-\lambda_{\min}(\barX_j),\ 0.0).\]Both when the solution is a certificate of dual infeasibility or when it is primal feasible the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of \(\barX\) variables. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is how much the solution violates the constraint \(\barX_{\mathtt{sub}[k]} \in \PSD\).- Groups:
- getpviolcon¶
function getpviolcon(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getpviolcon(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Computes the primal solution violation for a set of constraints. The primal violation of the solution associated with the \(i\)-th constraint is given by
\[\max(\tau l_i^c - (x_i^c)^*,\ (x_i^c)^* - \tau u_i^c),\ |\sum_{j=\idxbeg}^{\idxend{\mathtt{numvar}}} a_{ij} x_j^* - x_i^c|)\]where \(\tau=0\) if the solution is a certificate of dual infeasibility and \(\tau=1\) otherwise. Both when the solution is a certificate of dual infeasibility and when it is primal feasible the violation should be small. The above formula applies for the linear case but is appropriately generalized in other cases.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation associated with the solution for the constraintsub[k]
.- Groups:
- getpviolcones Deprecated¶
function getpviolcones(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getpviolcones(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Computes the primal solution violation for a set of conic constraints. Let \(x^*\) be the value of the variable \(x\) for the specified solution. For simplicity let us assume that \(x\) is a member of a quadratic cone, then the violation is computed as follows
\[\begin{split}\left\{ \begin{array}{ll} \max(0,\|x_{2:n}\|-x_1) / \sqrt{2}, & x_1 \geq -\|x_{2:n}\|, \\ \|x\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]Both when the solution is a certificate of dual infeasibility or when it is primal feasible the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of conic constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the solution associated with the conic constraint numbersub[k]
.- Groups:
- getpvioldjc¶
function getpvioldjc(task::MSKtask, whichsol::Soltype, djcidxlist::Vector{Int64}) -> viol :: Vector{Float64} function getpvioldjc(task::MSKtask, whichsol::Soltype, djcidxlist::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Computes the primal solution violation for a set of disjunctive constraints. For a single DJC the violation is defined as
\[\mathrm{viol}\left(\bigvee_{i=1}^t \bigwedge_{j=1}^{s_i} T_{i,j}\right) = \min_{i=1,\ldots,t}\left(\max_{j=1,\ldots,s_j}(\mathrm{viol}(T_{i,j}))\right)\]where the violation of each simple term \(T_{i,j}\) is defined as for an ordinary linear constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)djcidxlist
(Int64
[]
) – An array of indexes of disjunctive constraints. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation of the solution associated with the disjunctive constraint numberdjcidxlist[k]
.- Groups:
- getpviolvar¶
function getpviolvar(task::MSKtask, whichsol::Soltype, sub::Vector{Int32}) -> viol :: Vector{Float64} function getpviolvar(task::MSKtask, whichsol::Soltype, sub::T0) where { T0<:AbstractVector{<:Integer} } -> viol :: Vector{Float64}
Computes the primal solution violation associated to a set of variables. Let \(x_j^*\) be the value of \(x_j\) for the specified solution. Then the primal violation of the solution associated with variable \(x_j\) is given by
\[\max( \tau l_j^x - x_j^*,\ x_j^* - \tau u_j^x,\ 0).\]where \(\tau=0\) if the solution is a certificate of dual infeasibility and \(\tau=1\) otherwise. Both when the solution is a certificate of dual infeasibility and when it is primal feasible the violation should be small.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sub
(Int32
[]
) – An array of indexes of \(x\) variables. (input)
- Return:
viol
(Float64
[]
) –viol[k]
is the violation associated with the solution for the variable \(x_\mathtt{sub[k]}\).- Groups:
- getqconk¶
function getqconk(task::MSKtask, k::Int32) -> (numqcnz :: Int64,qcsubi :: Vector{Int32},qcsubj :: Vector{Int32},qcval :: Vector{Float64}) function getqconk(task::MSKtask, k::T0) where { T0<:Integer } -> (numqcnz :: Int64,qcsubi :: Vector{Int32},qcsubj :: Vector{Int32},qcval :: Vector{Float64})
Obtains all the quadratic terms in a constraint. The quadratic terms are stored sequentially in
qcsubi
,qcsubj
, andqcval
.- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Which constraint. (input)
- Return:
numqcnz
(Int64
) – Number of quadratic terms.qcsubi
(Int32
[]
) – Row subscripts for quadratic constraint matrix.qcsubj
(Int32
[]
) – Column subscripts for quadratic constraint matrix.qcval
(Float64
[]
) – Quadratic constraint coefficient values.
- Groups:
Inspecting the task, Problem data - quadratic part, Problem data - constraints
- getqobj¶
function getqobj(task::MSKtask) -> (numqonz :: Int64,qosubi :: Vector{Int32},qosubj :: Vector{Int32},qoval :: Vector{Float64})
Obtains the quadratic terms in the objective. The required quadratic terms are stored sequentially in
qosubi
,qosubj
, andqoval
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
numqonz
(Int64
) – Number of non-zero elements in the quadratic objective terms.qosubi
(Int32
[]
) – Row subscripts for quadratic objective coefficients.qosubj
(Int32
[]
) – Column subscripts for quadratic objective coefficients.qoval
(Float64
[]
) – Quadratic objective coefficient values.
- Groups:
- getqobjij¶
function getqobjij(task::MSKtask, i::Int32, j::Int32) -> qoij :: Float64 function getqobjij(task::MSKtask, i::T0, j::T1) where { T0<:Integer, T1<:Integer } -> qoij :: Float64
Obtains one coefficient \(q_{ij}^o\) in the quadratic term of the objective.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Row index of the coefficient. (input)j
(Int32
) – Column index of coefficient. (input)
- Return:
qoij
(Float64
) – The required coefficient.- Groups:
- getreducedcosts¶
function getreducedcosts(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> redcosts :: Vector{Float64} function getreducedcosts(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> redcosts :: Vector{Float64}
Computes the reduced costs for a slice of variables and returns them in the array
redcosts
i.e.(15.2)¶\[\mathtt{redcosts} = \left[ (s_l^x)_j-(s_u^x)_j, ~j=\mathtt{first},\ldots,\mathtt{last}-1 \right]\]- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – The index of the first variable in the sequence. (input)last
(Int32
) – The index of the last variable in the sequence plus 1. (input)
- Return:
redcosts
(Float64
[]
) – The reduced costs for the required slice of variables.- Groups:
- getskc¶
function getskc(task::MSKtask, whichsol::Soltype) -> skc :: Vector{Stakey}
Obtains the status keys for the constraints.
- getskcslice¶
function getskcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> skc :: Vector{Stakey} function getskcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> skc :: Vector{Stakey}
Obtains the status keys for a slice of the constraints.
- getskn¶
function getskn(task::MSKtask, whichsol::Soltype) -> skn :: Vector{Stakey}
Obtains the status keys for the conic constraints.
- getskx¶
function getskx(task::MSKtask, whichsol::Soltype) -> skx :: Vector{Stakey}
Obtains the status keys for the scalar variables.
- getskxslice¶
function getskxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> skx :: Vector{Stakey} function getskxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> skx :: Vector{Stakey}
Obtains the status keys for a slice of the scalar variables.
- getslc¶
function getslc(task::MSKtask, whichsol::Soltype) -> slc :: Vector{Float64}
Obtains the \(s_l^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints.- Groups:
- getslcslice¶
function getslcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> slc :: Vector{Float64} function getslcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> slc :: Vector{Float64}
Obtains a slice of the \(s_l^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints.- Groups:
- getslx¶
function getslx(task::MSKtask, whichsol::Soltype) -> slx :: Vector{Float64}
Obtains the \(s_l^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables.- Groups:
- getslxslice¶
function getslxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> slx :: Vector{Float64} function getslxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> slx :: Vector{Float64}
Obtains a slice of the \(s_l^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables.- Groups:
- getsnx¶
function getsnx(task::MSKtask, whichsol::Soltype) -> snx :: Vector{Float64}
Obtains the \(s_n^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables.- Groups:
- getsnxslice¶
function getsnxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> snx :: Vector{Float64} function getsnxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> snx :: Vector{Float64}
Obtains a slice of the \(s_n^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables.- Groups:
- getsolsta¶
function getsolsta(task::MSKtask, whichsol::Soltype) -> solutionsta :: Solsta
Obtains the solution status.
- getsolution¶
function getsolution(task::MSKtask, whichsol::Soltype) -> (problemsta :: Prosta,solutionsta :: Solsta,skc :: Vector{Stakey},skx :: Vector{Stakey},skn :: Vector{Stakey},xc :: Vector{Float64},xx :: Vector{Float64},y :: Vector{Float64},slc :: Vector{Float64},suc :: Vector{Float64},slx :: Vector{Float64},sux :: Vector{Float64},snx :: Vector{Float64})
Obtains the complete solution.
Consider the case of linear programming. The primal problem is given by
\[\begin{split}\begin{array}{lccccl} \mbox{minimize} & & & c^T x+c^f & & \\ \mbox{subject to} & l^c & \leq & A x & \leq & u^c, \\ & l^x & \leq & x & \leq & u^x. \\ \end{array}\end{split}\]and the corresponding dual problem is
\[\begin{split}\begin{array}{lccl} \mbox{maximize} & (l^c)^T s_l^c - (u^c)^T s_u^c & \\ & + (l^x)^T s_l^x - (u^x)^T s_u^x + c^f & \\ \mbox{subject to} & A^T y + s_l^x - s_u^x & = & c, \\ & -y + s_l^c - s_u^c & = & 0, \\ & s_l^c,s_u^c,s_l^x,s_u^x \geq 0. & & \\ \end{array}\end{split}\]A conic optimization problem has the same primal variables as in the linear case. Recall that the dual of a conic optimization problem is given by:
\[\begin{split}\begin{array}{lccccc} \mbox{maximize} & (l^c)^T s_l^c - (u^c)^T s_u^c & & \\ & +(l^x)^T s_l^x - (u^x)^T s_u^x + c^f & & \\ \mbox{subject to} & A^T y + s_l^x - s_u^x + s_n^x & = & c, \\ & -y + s_l^c - s_u^c & = & 0, \\ & s_l^c,s_u^c,s_l^x,s_u^x & \geq & 0, \\ & s_n^x \in \K^* & & \\ \end{array}\end{split}\]The mapping between variables and arguments to the function is as follows:
xx
: Corresponds to variable \(x\) (also denoted \(x^x\)).xc
: Corresponds to \(x^c:=Ax\).y
: Corresponds to variable \(y\).slc
: Corresponds to variable \(s_l^c\).suc
: Corresponds to variable \(s_u^c\).slx
: Corresponds to variable \(s_l^x\).sux
: Corresponds to variable \(s_u^x\).snx
: Corresponds to variable \(s_n^x\).
The meaning of the values returned by this function depend on the solution status returned in the argument
solsta
. The most important possible values ofsolsta
are:MSK_SOL_STA_OPTIMAL
: An optimal solution satisfying the optimality criteria for continuous problems is returned.MSK_SOL_STA_INTEGER_OPTIMAL
: An optimal solution satisfying the optimality criteria for integer problems is returned.MSK_SOL_STA_PRIM_FEAS
: A solution satisfying the feasibility criteria.MSK_SOL_STA_PRIM_INFEAS_CER
: A primal certificate of infeasibility is returned.MSK_SOL_STA_DUAL_INFEAS_CER
: A dual certificate of infeasibility is returned.
In order to retrieve the primal and dual values of semidefinite variables see
getbarxj
andgetbarsj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
problemsta
(Prosta
) – Problem status.solutionsta
(Solsta
) – Solution status.skc
(Stakey
[]
) – Status keys for the constraints.skx
(Stakey
[]
) – Status keys for the variables.skn
(Stakey
[]
) – Status keys for the conic constraints.xc
(Float64
[]
) – Primal constraint solution.xx
(Float64
[]
) – Primal variable solution.y
(Float64
[]
) – Vector of dual variables corresponding to the constraints.slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints.suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints.slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables.sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables.snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables.
- Groups:
- getsolutioninfo¶
function getsolutioninfo(task::MSKtask, whichsol::Soltype) -> (pobj :: Float64,pviolcon :: Float64,pviolvar :: Float64,pviolbarvar :: Float64,pviolcone :: Float64,pviolitg :: Float64,dobj :: Float64,dviolcon :: Float64,dviolvar :: Float64,dviolbarvar :: Float64,dviolcone :: Float64)
Obtains information about a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
pobj
(Float64
) – The primal objective value as computed bygetprimalobj
.pviolcon
(Float64
) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed bygetpviolcon
.pviolvar
(Float64
) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed bygetpviolvar
.pviolbarvar
(Float64
) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed bygetpviolbarvar
.pviolcone
(Float64
) – Maximal primal violation of solution for the conic constraints where the violations are computed bygetpviolcones
.pviolitg
(Float64
) – Maximal violation in the integer constraints. The violation for an integer variable \(x_j\) is given by \(\min(x_j-\lfloor x_j \rfloor,\lceil x_j \rceil - x_j)\). This number is always zero for the interior-point and basic solutions.dobj
(Float64
) – Dual objective value as computed bygetdualobj
.dviolcon
(Float64
) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed bygetdviolcon
.dviolvar
(Float64
) – Maximal violation of the dual solution associated with the \(x\) variable as computed bygetdviolvar
.dviolbarvar
(Float64
) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed bygetdviolbarvar
.dviolcone
(Float64
) – Maximal violation of the dual solution associated with the dual conic constraints as computed bygetdviolcones
.
- Groups:
- getsolutioninfonew¶
function getsolutioninfonew(task::MSKtask, whichsol::Soltype) -> (pobj :: Float64,pviolcon :: Float64,pviolvar :: Float64,pviolbarvar :: Float64,pviolcone :: Float64,pviolacc :: Float64,pvioldjc :: Float64,pviolitg :: Float64,dobj :: Float64,dviolcon :: Float64,dviolvar :: Float64,dviolbarvar :: Float64,dviolcone :: Float64,dviolacc :: Float64)
Obtains information about a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
pobj
(Float64
) – The primal objective value as computed bygetprimalobj
.pviolcon
(Float64
) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed bygetpviolcon
.pviolvar
(Float64
) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed bygetpviolvar
.pviolbarvar
(Float64
) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed bygetpviolbarvar
.pviolcone
(Float64
) – Maximal primal violation of solution for the conic constraints where the violations are computed bygetpviolcones
.pviolacc
(Float64
) – Maximal primal violation of solution for the affine conic constraints where the violations are computed bygetpviolacc
.pvioldjc
(Float64
) – Maximal primal violation of solution for the disjunctive constraints where the violations are computed bygetpvioldjc
.pviolitg
(Float64
) – Maximal violation in the integer constraints. The violation for an integer variable \(x_j\) is given by \(\min(x_j-\lfloor x_j \rfloor,\lceil x_j \rceil - x_j)\). This number is always zero for the interior-point and basic solutions.dobj
(Float64
) – Dual objective value as computed bygetdualobj
.dviolcon
(Float64
) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed bygetdviolcon
.dviolvar
(Float64
) – Maximal violation of the dual solution associated with the \(x\) variable as computed bygetdviolvar
.dviolbarvar
(Float64
) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed bygetdviolbarvar
.dviolcone
(Float64
) – Maximal violation of the dual solution associated with the dual conic constraints as computed bygetdviolcones
.dviolacc
(Float64
) – Maximal violation of the dual solution associated with the affine conic constraints as computed bygetdviolacc
.
- Groups:
- getsolutionnew¶
function getsolutionnew(task::MSKtask, whichsol::Soltype) -> (problemsta :: Prosta,solutionsta :: Solsta,skc :: Vector{Stakey},skx :: Vector{Stakey},skn :: Vector{Stakey},xc :: Vector{Float64},xx :: Vector{Float64},y :: Vector{Float64},slc :: Vector{Float64},suc :: Vector{Float64},slx :: Vector{Float64},sux :: Vector{Float64},snx :: Vector{Float64},doty :: Vector{Float64})
Obtains the complete solution. See
getsolution
for further information.In order to retrieve the primal and dual values of semidefinite variables see
getbarxj
andgetbarsj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
problemsta
(Prosta
) – Problem status.solutionsta
(Solsta
) – Solution status.skc
(Stakey
[]
) – Status keys for the constraints.skx
(Stakey
[]
) – Status keys for the variables.skn
(Stakey
[]
) – Status keys for the conic constraints.xc
(Float64
[]
) – Primal constraint solution.xx
(Float64
[]
) – Primal variable solution.y
(Float64
[]
) – Vector of dual variables corresponding to the constraints.slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints.suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints.slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables.sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables.snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables.doty
(Float64
[]
) – Dual variables corresponding to affine conic constraints.
- Groups:
- getsolutionslice¶
function getsolutionslice(task::MSKtask, whichsol::Soltype, solitem::Solitem, first::Int32, last::Int32) -> values :: Vector{Float64} function getsolutionslice(task::MSKtask, whichsol::Soltype, solitem::Solitem, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> values :: Vector{Float64}
Obtains a slice of one item from the solution. The format of the solution is exactly as in
getsolution
. The parametersolitem
determines which of the solution vectors should be returned.- Parameters:
- Return:
values
(Float64
[]
) – The values in the required sequence are stored sequentially invalues
.- Groups:
- getsparsesymmat¶
function getsparsesymmat(task::MSKtask, idx::Int64) -> (subi :: Vector{Int32},subj :: Vector{Int32},valij :: Vector{Float64}) function getsparsesymmat(task::MSKtask, idx::T0) where { T0<:Integer } -> (subi :: Vector{Int32},subj :: Vector{Int32},valij :: Vector{Float64})
Get a single symmetric matrix from the matrix store.
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Index of the matrix to retrieve. (input)
- Return:
subi
(Int32
[]
) – Row subscripts of the matrix non-zero elements.subj
(Int32
[]
) – Column subscripts of the matrix non-zero elements.valij
(Float64
[]
) – Coefficients of the matrix non-zero elements.
- Groups:
- getstrparam¶
function getstrparam(task::MSKtask, param::Sparam) -> (len :: Int32,parvalue :: String)
Obtains the value of a string parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Sparam
) – Which parameter. (input)
- Return:
len
(Int32
) – The length of the parameter value.parvalue
(String
) – Parameter value.
- Groups:
- getstrparamlen¶
function getstrparamlen(task::MSKtask, param::Sparam) -> len :: Int32
Obtains the length of a string parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Sparam
) – Which parameter. (input)
- Return:
len
(Int32
) – The length of the parameter value.- Groups:
- getsuc¶
function getsuc(task::MSKtask, whichsol::Soltype) -> suc :: Vector{Float64}
Obtains the \(s_u^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints.- Groups:
- getsucslice¶
function getsucslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> suc :: Vector{Float64} function getsucslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> suc :: Vector{Float64}
Obtains a slice of the \(s_u^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints.- Groups:
- getsux¶
function getsux(task::MSKtask, whichsol::Soltype) -> sux :: Vector{Float64}
Obtains the \(s_u^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables.- Groups:
- getsuxslice¶
function getsuxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> sux :: Vector{Float64} function getsuxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> sux :: Vector{Float64}
Obtains a slice of the \(s_u^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables.- Groups:
- getsymmatinfo¶
function getsymmatinfo(task::MSKtask, idx::Int64) -> (dim :: Int32,nz :: Int64,mattype :: Symmattype) function getsymmatinfo(task::MSKtask, idx::T0) where { T0<:Integer } -> (dim :: Int32,nz :: Int64,mattype :: Symmattype)
MOSEK maintains a vector denoted by \(E\) of symmetric data matrices. This function makes it possible to obtain important information about a single matrix in \(E\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)idx
(Int64
) – Index of the matrix for which information is requested. (input)
- Return:
dim
(Int32
) – Returns the dimension of the requested matrix.nz
(Int64
) – Returns the number of non-zeros in the requested matrix.mattype
(Symmattype
) – Returns the type of the requested matrix.
- Groups:
- gettaskname¶
function gettaskname(task::MSKtask) -> taskname :: String
Obtains the name assigned to the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
taskname
(String
) – Returns the task name.- Groups:
- gettasknamelen¶
function gettasknamelen(task::MSKtask) -> len :: Int32
Obtains the length the task name.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
len
(Int32
) – Returns the length of the task name.- Groups:
- getvarbound¶
function getvarbound(task::MSKtask, i::Int32) -> (bk :: Boundkey,bl :: Float64,bu :: Float64) function getvarbound(task::MSKtask, i::T0) where { T0<:Integer } -> (bk :: Boundkey,bl :: Float64,bu :: Float64)
Obtains bound information for one variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the variable for which the bound information should be obtained. (input)
- Return:
bk
(Boundkey
) – Bound keys.bl
(Float64
) – Values for lower bounds.bu
(Float64
) – Values for upper bounds.
- Groups:
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- getvarboundslice¶
function getvarboundslice(task::MSKtask, first::Int32, last::Int32) -> (bk :: Vector{Boundkey},bl :: Vector{Float64},bu :: Vector{Float64}) function getvarboundslice(task::MSKtask, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> (bk :: Vector{Boundkey},bl :: Vector{Float64},bu :: Vector{Float64})
Obtains bounds information for a slice of the variables.
- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
bk
(Boundkey
[]
) – Bound keys.bl
(Float64
[]
) – Values for lower bounds.bu
(Float64
[]
) – Values for upper bounds.
- Groups:
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- getvarname¶
function getvarname(task::MSKtask, j::Int32) -> name :: String function getvarname(task::MSKtask, j::T0) where { T0<:Integer } -> name :: String
Obtains the name of a variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of a variable. (input)
- Return:
name
(String
) – Returns the required name.- Groups:
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- getvarnameindex¶
function getvarnameindex(task::MSKtask, somename::AbstractString) -> (asgn :: Int32,index :: Int32)
Checks whether the name
somename
has been assigned to any variable. If so, the index of the variable is reported.- Parameters:
task
(MSKtask
) – An optimization task. (input)somename
(AbstractString
) – The name which should be checked. (input)
- Return:
asgn
(Int32
) – Is non-zero if the namesomename
is assigned to a variable.index
(Int32
) – If the namesomename
is assigned to a variable, thenindex
is the index of the variable.
- Groups:
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- getvarnamelen¶
function getvarnamelen(task::MSKtask, i::Int32) -> len :: Int32 function getvarnamelen(task::MSKtask, i::T0) where { T0<:Integer } -> len :: Int32
Obtains the length of the name of a variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of a variable. (input)
- Return:
len
(Int32
) – Returns the length of the indicated name.- Groups:
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- getvartype¶
function getvartype(task::MSKtask, j::Int32) -> vartype :: Variabletype function getvartype(task::MSKtask, j::T0) where { T0<:Integer } -> vartype :: Variabletype
Gets the variable type of one variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)
- Return:
vartype
(Variabletype
) – Variable type of the \(j\)-th variable.- Groups:
- getvartypelist¶
function getvartypelist(task::MSKtask, subj::Vector{Int32}) -> vartype :: Vector{Variabletype} function getvartypelist(task::MSKtask, subj::T0) where { T0<:AbstractVector{<:Integer} } -> vartype :: Vector{Variabletype}
Obtains the variable type of one or more variables. Upon return
vartype[k]
is the variable type of variablesubj[k]
.- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – A list of variable indexes. (input)
- Return:
vartype
(Variabletype
[]
) – The variables types corresponding to the variables specified bysubj
.- Groups:
- getversion¶
function getversion() -> (major :: Int32,minor :: Int32,revision :: Int32)
Obtains MOSEK version information.
- Return:
major
(Int32
) – Major version number.minor
(Int32
) – Minor version number.revision
(Int32
) – Revision number.
- Groups:
- getxc¶
function getxc(task::MSKtask, whichsol::Soltype) -> xc :: Vector{Float64}
Obtains the \(x^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
xc
(Float64
[]
) – Primal constraint solution.- Groups:
- getxcslice¶
function getxcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> xc :: Vector{Float64} function getxcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> xc :: Vector{Float64}
Obtains a slice of the \(x^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
xc
(Float64
[]
) – Primal constraint solution.- Groups:
- getxx¶
function getxx(task::MSKtask, whichsol::Soltype) -> xx :: Vector{Float64}
Obtains the \(x^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
xx
(Float64
[]
) – Primal variable solution.- Groups:
- getxxslice¶
function getxxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> xx :: Vector{Float64} function getxxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> xx :: Vector{Float64}
Obtains a slice of the \(x^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
xx
(Float64
[]
) – Primal variable solution.- Groups:
- gety¶
function gety(task::MSKtask, whichsol::Soltype) -> y :: Vector{Float64}
Obtains the \(y\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
y
(Float64
[]
) – Vector of dual variables corresponding to the constraints.- Groups:
- getyslice¶
function getyslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32) -> y :: Vector{Float64} function getyslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1) where { T0<:Integer, T1<:Integer } -> y :: Vector{Float64}
Obtains a slice of the \(y\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)
- Return:
y
(Float64
[]
) – Vector of dual variables corresponding to the constraints.- Groups:
- iinfitemtostr¶
function iinfitemtostr(item::Iinfitem) -> str :: String
Obtains an identifier string corresponding to a information item.
- infeasibilityreport¶
function infeasibilityreport(task::MSKtask, whichstream::Streamtype, whichsol::Soltype)
Prints the infeasibility report to an output stream.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups:
- initbasissolve¶
function initbasissolve(task::MSKtask) -> basis :: Vector{Int32}
Prepare a task for use with the
solvewithbasis
function.This function should be called
immediately before the first call to
solvewithbasis
, andimmediately before any subsequent call to
solvewithbasis
if the task has been modified.
If the basis is singular i.e. not invertible, then the error
MSK_RES_ERR_BASIS_SINGULAR
is reported.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
basis
(Int32
[]
) – The array of basis indexes to use. The array is interpreted as follows: If \(\mathtt{basis}[i] \leq \idxend{numcon}\), then \(x_{\mathtt{basis}[i]}^c\) is in the basis at position \(i\), otherwise \(x_{\mathtt{basis}[i]-\mathtt{numcon}}\) is in the basis at position \(i\).- Groups:
- inputdata¶
function inputdata(task::MSKtask, maxnumcon::Int32, maxnumvar::Int32, c::Union{Nothing,Vector{Float64}}, cfix::Float64, aptrb::Vector{Int64}, aptre::Vector{Int64}, asub::Vector{Int32}, aval::Vector{Float64}, bkc::Vector{Boundkey}, blc::Vector{Float64}, buc::Vector{Float64}, bkx::Vector{Boundkey}, blx::Vector{Float64}, bux::Vector{Float64}) function inputdata(task::MSKtask, maxnumcon::T0, maxnumvar::T1, c::T2, cfix::T3, aptrb::T4, aptre::T5, asub::T6, aval::T7, bkc::Vector{Boundkey}, blc::T8, buc::T9, bkx::Vector{Boundkey}, blx::T10, bux::T11) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number}, T3<:Number, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Integer}, T7<:AbstractVector{<:Number}, T8<:AbstractVector{<:Number}, T9<:AbstractVector{<:Number}, T10<:AbstractVector{<:Number}, T11<:AbstractVector{<:Number} } function inputdata(task::MSKtask, maxnumcon::T0, maxnumvar::T1, c::T2, cfix::T3, A:: SparseMatrixCSC{Float64}, bkc::Vector{Boundkey}, blc::T8, buc::T9, bkx::Vector{Boundkey}, blx::T10, bux::T11) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number}, T3<:Number, T8<:AbstractVector{<:Number}, T9<:AbstractVector{<:Number}, T10<:AbstractVector{<:Number}, T11<:AbstractVector{<:Number} }
Input the linear part of an optimization problem.
The non-zeros of \(A\) are inputted column-wise in the format described in Section Column or Row Ordered Sparse Matrix.
For an explained code example see Section Linear Optimization and Section Matrix Formats.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumcon
(Int32
) – Number of preallocated constraints in the optimization task. (input)maxnumvar
(Int32
) – Number of preallocated variables in the optimization task. (input)c
(Float64
[]
) – Linear terms of the objective as a dense vector. The length is the number of variables. (input)cfix
(Float64
) – Fixed term in the objective. (input)aptrb
(Int64
[]
) – Row or column start pointers. (input)aptre
(Int64
[]
) – Row or column end pointers. (input)asub
(Int32
[]
) – Coefficient subscripts. (input)aval
(Float64
[]
) – Coefficient values. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(Float64
[]
) – Lower bounds for the constraints. (input)buc
(Float64
[]
) – Upper bounds for the constraints. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(Float64
[]
) – Lower bounds for the variables. (input)bux
(Float64
[]
) – Upper bounds for the variables. (input)A
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
Problem data - linear part, Problem data - bounds, Problem data - constraints
- isdouparname¶
function isdouparname(task::MSKtask, parname::AbstractString) -> param :: Dparam
Checks whether
parname
is a valid double parameter name.- Parameters:
task
(MSKtask
) – An optimization task. (input)parname
(AbstractString
) – Parameter name. (input)
- Return:
param
(Dparam
) – Returns the parameter corresponding to the name, if one exists.- Groups:
- isintparname¶
function isintparname(task::MSKtask, parname::AbstractString) -> param :: Iparam
Checks whether
parname
is a valid integer parameter name.- Parameters:
task
(MSKtask
) – An optimization task. (input)parname
(AbstractString
) – Parameter name. (input)
- Return:
param
(Iparam
) – Returns the parameter corresponding to the name, if one exists.- Groups:
- isstrparname¶
function isstrparname(task::MSKtask, parname::AbstractString) -> param :: Sparam
Checks whether
parname
is a valid string parameter name.- Parameters:
task
(MSKtask
) – An optimization task. (input)parname
(AbstractString
) – Parameter name. (input)
- Return:
param
(Sparam
) – Returns the parameter corresponding to the name, if one exists.- Groups:
- licensecleanup¶
function licensecleanup()
Stops all threads and deletes all handles used by the license system. If this function is called, it must be called as the last MOSEK API call. No other MOSEK API calls are valid after this.
- Groups:
- liinfitemtostr¶
function liinfitemtostr(item::Liinfitem) -> str :: String
Obtains an identifier string corresponding to a information item.
- linkfiletostream¶
function linkfiletostream(task::MSKtask, whichstream::Streamtype, filename::AbstractString, append::Int32) function linkfiletostream(task::MSKtask, whichstream::Streamtype, filename::Union{Nothing,AbstractString}, append::T0) where { T0<:Integer }
Directs all output from a task stream
whichstream
to a filefilename
.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)filename
(AbstractString
) – A valid file name. (input)append
(Int32
) – If this argument is 0 the output file will be overwritten, otherwise it will be appended to. (input)
- Groups:
- linkfiletostream¶
function linkfiletostream(env::MSKenv, whichstream::Streamtype, filename::AbstractString, append::Int32) function linkfiletostream(env::MSKenv, whichstream::Streamtype, filename::Union{Nothing,AbstractString}, append::T0) where { T0<:Integer } function linkfiletostream(whichstream::Streamtype, filename::AbstractString, append::Int32) function linkfiletostream(whichstream::Streamtype, filename::Union{Nothing,AbstractString}, append::T0) where { T0<:Integer }
Sends all output from the stream defined by
whichstream
to the file given byfilename
.- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)whichstream
(Streamtype
) – Index of the stream. (input)filename
(AbstractString
) – A valid file name. (input)append
(Int32
) – If this argument is 0 the file will be overwritten, otherwise it will be appended to. (input)
- Groups:
- makeenv¶
function makeenv() -> newenv :: Env
Creates a new environment.
- Return:
newenv
(MSKenv
) – A new environment.- Groups:
- maketask¶
function maketask() -> newtask :: Task function maketask(task::Task) -> newtask :: Task function maketask(env::Env) -> newtask :: Task
Creates a new task.
- Parameters:
task
(MSKtask
) – A task that will be cloned. (input)env
(MSKenv
) – Parent environment. (input)
- Return:
newtask
(MSKtask
) – A new task.- Groups:
- onesolutionsummary¶
function onesolutionsummary(task::MSKtask, whichstream::Streamtype, whichsol::Soltype)
Prints a short summary of a specified solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups:
- optimize¶
function optimize(task::MSKtask) -> trmcode :: Rescode
Calls the optimizer. Depending on the problem type and the selected optimizer this will call one of the optimizers in MOSEK. By default the interior point optimizer will be selected for continuous problems. The optimizer may be selected manually by setting the parameter
MSK_IPAR_OPTIMIZER
.- Parameters:
task
(MSKtask
) – An optimization task. (input)- Return:
trmcode
(Rescode
) – Is eitherMSK_RES_OK
or a termination response code.- Groups:
- optimizebatch¶
function optimizebatch(env::MSKenv, israce::Bool, maxtime::Float64, numthreads::Int32, task::Vector{MSKtask}) -> (trmcode :: Vector{Rescode},rcode :: Vector{Rescode}) function optimizebatch(env::MSKenv, israce::Bool, maxtime::T0, numthreads::T1, task::Vector{MSKtask}) where { T0<:Number, T1<:Integer } -> (trmcode :: Vector{Rescode},rcode :: Vector{Rescode}) function optimizebatch(israce::Bool, maxtime::Float64, numthreads::Int32, task::Vector{MSKtask}) -> (trmcode :: Vector{Rescode},rcode :: Vector{Rescode}) function optimizebatch(israce::Bool, maxtime::T0, numthreads::T1, task::Vector{MSKtask}) where { T0<:Number, T1<:Integer } -> (trmcode :: Vector{Rescode},rcode :: Vector{Rescode})
Optimize a number of tasks in parallel using a specified number of threads. All callbacks and log output streams are disabled.
Assuming that each task takes about same time and there many more tasks than number of threads then a linear speedup can be achieved, also known as strong scaling. A typical application of this method is to solve many small tasks of similar type; in this case it is recommended that each of them is allocated a single thread by setting
MSK_IPAR_NUM_THREADS
to \(1\).If the parameters
israce
ormaxtime
are used, then the result may not be deterministic, in the sense that the tasks which complete first may vary between runs.The remaining behavior, including termination and response codes returned for each task, are the same as if each task was optimized separately.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)israce
(Bool
) – If nonzero, then the function is terminated after the first task has been completed. (input)maxtime
(Float64
) – Time limit for the function: if nonnegative, then the function is terminated after maxtime (seconds) has expired. (input)numthreads
(Int32
) – Number of threads to be employed. (input)task
(MSKtask
[]
) – An array of tasks to optimize in parallel. (input)
- Return:
- Groups:
- optimizermt¶
function optimizermt(task::MSKtask, address::AbstractString, accesstoken::AbstractString) -> trmcode :: Rescode
Offload the optimization task to an instance of OptServer specified by
addr
, which should be a valid URL, for examplehttp://server:port
orhttps://server:port
. The call will block until a result is available or the connection closes.If the server requires authentication, the authentication token can be passed in the
accesstoken
argument.If the server requires encryption, the keys can be passed using one of the solver parameters
MSK_SPAR_REMOTE_TLS_CERT
orMSK_SPAR_REMOTE_TLS_CERT_PATH
.- Parameters:
task
(MSKtask
) – An optimization task. (input)address
(AbstractString
) – Address of the OptServer. (input)accesstoken
(AbstractString
) – Access token. (input)
- Return:
trmcode
(Rescode
) – Is eitherMSK_RES_OK
or a termination response code.- Groups:
- optimizersummary¶
function optimizersummary(task::MSKtask, whichstream::Streamtype)
Prints a short summary with optimizer statistics from last optimization.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)
- Groups:
- primalrepair¶
function primalrepair(task::MSKtask, wlc::Union{Nothing,Vector{Float64}}, wuc::Union{Nothing,Vector{Float64}}, wlx::Union{Nothing,Vector{Float64}}, wux::Union{Nothing,Vector{Float64}}) function primalrepair(task::MSKtask, wlc::T0, wuc::T1, wlx::T2, wux::T3) where { T0<:AbstractVector{<:Number}, T1<:AbstractVector{<:Number}, T2<:AbstractVector{<:Number}, T3<:AbstractVector{<:Number} }
The function repairs a primal infeasible optimization problem by adjusting the bounds on the constraints and variables where the adjustment is computed as the minimal weighted sum of relaxations to the bounds on the constraints and variables. Observe the function only repairs the problem but does not solve it. If an optimal solution is required the problem should be optimized after the repair.
The function is applicable to linear and conic problems possibly with integer variables.
Observe that when computing the minimal weighted relaxation the termination tolerance specified by the parameters of the task is employed. For instance the parameter
MSK_IPAR_MIO_MODE
can be used to make MOSEK ignore the integer constraints during the repair which usually leads to a much faster repair. However, the drawback is of course that the repaired problem may not have an integer feasible solution.Note the function modifies the task in place. If this is not desired, then apply the function to a cloned task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)wlc
(Float64
[]
) – \((w_l^c)_i\) is the weight associated with relaxing the lower bound on constraint \(i\). If the weight is negative, then the lower bound is not relaxed. Moreover, if the argument isnothing
, then all the weights are assumed to be \(1\). (input)wuc
(Float64
[]
) – \((w_u^c)_i\) is the weight associated with relaxing the upper bound on constraint \(i\). If the weight is negative, then the upper bound is not relaxed. Moreover, if the argument isnothing
, then all the weights are assumed to be \(1\). (input)wlx
(Float64
[]
) – \((w_l^x)_j\) is the weight associated with relaxing the lower bound on variable \(j\). If the weight is negative, then the lower bound is not relaxed. Moreover, if the argument isnothing
, then all the weights are assumed to be \(1\). (input)wux
(Float64
[]
) – \((w_l^x)_i\) is the weight associated with relaxing the upper bound on variable \(j\). If the weight is negative, then the upper bound is not relaxed. Moreover, if the argument isnothing
, then all the weights are assumed to be \(1\). (input)
- Groups:
- primalsensitivity¶
function primalsensitivity(task::MSKtask, subi::Vector{Int32}, marki::Vector{Mark}, subj::Vector{Int32}, markj::Vector{Mark}) -> (leftpricei :: Vector{Float64},rightpricei :: Vector{Float64},leftrangei :: Vector{Float64},rightrangei :: Vector{Float64},leftpricej :: Vector{Float64},rightpricej :: Vector{Float64},leftrangej :: Vector{Float64},rightrangej :: Vector{Float64}) function primalsensitivity(task::MSKtask, subi::T0, marki::Vector{Mark}, subj::T1, markj::Vector{Mark}) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer} } -> (leftpricei :: Vector{Float64},rightpricei :: Vector{Float64},leftrangei :: Vector{Float64},rightrangei :: Vector{Float64},leftpricej :: Vector{Float64},rightpricej :: Vector{Float64},leftrangej :: Vector{Float64},rightrangej :: Vector{Float64})
Calculates sensitivity information for bounds on variables and constraints. For details on sensitivity analysis, the definitions of shadow price and linearity interval and an example see Section Sensitivity Analysis.
The type of sensitivity analysis to be performed (basis or optimal partition) is controlled by the parameter
MSK_IPAR_SENSITIVITY_TYPE
.- Parameters:
task
(MSKtask
) – An optimization task. (input)subi
(Int32
[]
) – Indexes of constraints to analyze. (input)marki
(Mark
[]
) – The value ofmarki[i]
indicates for which bound of constraintsubi[i]
sensitivity analysis is performed. Ifmarki[i]
=MSK_MARK_UP
the upper bound of constraintsubi[i]
is analyzed, and ifmarki[i]
=MSK_MARK_LO
the lower bound is analyzed. Ifsubi[i]
is an equality constraint, eitherMSK_MARK_LO
orMSK_MARK_UP
can be used to select the constraint for sensitivity analysis. (input)subj
(Int32
[]
) – Indexes of variables to analyze. (input)markj
(Mark
[]
) – The value ofmarkj[j]
indicates for which bound of variablesubj[j]
sensitivity analysis is performed. Ifmarkj[j]
=MSK_MARK_UP
the upper bound of variablesubj[j]
is analyzed, and ifmarkj[j]
=MSK_MARK_LO
the lower bound is analyzed. Ifsubj[j]
is a fixed variable, eitherMSK_MARK_LO
orMSK_MARK_UP
can be used to select the bound for sensitivity analysis. (input)
- Return:
leftpricei
(Float64
[]
) –leftpricei[i]
is the left shadow price for the boundmarki[i]
of constraintsubi[i]
.rightpricei
(Float64
[]
) –rightpricei[i]
is the right shadow price for the boundmarki[i]
of constraintsubi[i]
.leftrangei
(Float64
[]
) –leftrangei[i]
is the left range \(\beta_1\) for the boundmarki[i]
of constraintsubi[i]
.rightrangei
(Float64
[]
) –rightrangei[i]
is the right range \(\beta_2\) for the boundmarki[i]
of constraintsubi[i]
.leftpricej
(Float64
[]
) –leftpricej[j]
is the left shadow price for the boundmarkj[j]
of variablesubj[j]
.rightpricej
(Float64
[]
) –rightpricej[j]
is the right shadow price for the boundmarkj[j]
of variablesubj[j]
.leftrangej
(Float64
[]
) –leftrangej[j]
is the left range \(\beta_1\) for the boundmarkj[j]
of variablesubj[j]
.rightrangej
(Float64
[]
) –rightrangej[j]
is the right range \(\beta_2\) for the boundmarkj[j]
of variablesubj[j]
.
- Groups:
- printparam¶
function printparam(task::MSKtask)
Prints the current parameter settings to the message stream.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Groups:
- probtypetostr¶
function probtypetostr(task::MSKtask, probtype::Problemtype) -> str :: String
Obtains a string containing the name of a given problem type.
- Parameters:
task
(MSKtask
) – An optimization task. (input)probtype
(Problemtype
) – Problem type. (input)
- Return:
str
(String
) – String corresponding to the problem type keyprobtype
.- Groups:
- prostatostr¶
function prostatostr(task::MSKtask, problemsta::Prosta) -> str :: String
Obtains a string containing the name of a given problem status.
- Parameters:
task
(MSKtask
) – An optimization task. (input)problemsta
(Prosta
) – Problem status. (input)
- Return:
str
(String
) – String corresponding to the status keyprosta
.- Groups:
- putacc¶
function putacc(task::MSKtask, accidx::Int64, domidx::Int64, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}) function putacc(task::MSKtask, accidx::T0, domidx::T1, afeidxlist::T2, b::T3) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
Puts an affine conic constraint. This method overwrites an existing affine conic constraint number
accidx
with new data specified in the same format as inappendacc
.- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Affine conic constraint index. (input)domidx
(Int64
) – Domain index. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- putaccb¶
function putaccb(task::MSKtask, accidx::Int64, b::Union{Nothing,Vector{Float64}}) function putaccb(task::MSKtask, accidx::T0, b::T1) where { T0<:Integer, T1<:AbstractVector{<:Number} }
Updates an existing affine conic constraint number
accidx
by putting a new vector \(b\).- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Affine conic constraint index. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- putaccbj¶
function putaccbj(task::MSKtask, accidx::Int64, j::Int64, bj::Float64) function putaccbj(task::MSKtask, accidx::T0, j::T1, bj::T2) where { T0<:Integer, T1<:Integer, T2<:Number }
Sets one value \(b[j]\) in the \(b\) vector for the affine conic constraint number
accidx
.- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Affine conic constraint index. (input)j
(Int64
) – The index of an element in b to change. (input)bj
(Float64
) – The new value of \(b[j]\). (input)
- Groups:
- putaccdoty¶
function putaccdoty(task::MSKtask, whichsol::Soltype, accidx::Int64) -> doty :: Vector{Float64} function putaccdoty(task::MSKtask, whichsol::Soltype, accidx::T0) where { T0<:Integer } -> doty :: Vector{Float64}
Puts the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)accidx
(Int64
) – The index of the affine conic constraint. (input)
- Return:
doty
(Float64
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint.- Groups:
- putacclist¶
function putacclist(task::MSKtask, accidxs::Vector{Int64}, domidxs::Vector{Int64}, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}) function putacclist(task::MSKtask, accidxs::T0, domidxs::T1, afeidxlist::T2, b::T3) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
Puts affine conic constraints. This method overwrites existing affine conic constraints whose numbers are provided in the list
accidxs
with new data which is a concatenation of individual constraint descriptions in the same format as inappendacc
(see alsoappendaccs
).- Parameters:
task
(MSKtask
) – An optimization task. (input)accidxs
(Int64
[]
) – Affine conic constraint indices. (input)domidxs
(Int64
[]
) – Domain indices. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)
- Groups:
- putaccname¶
function putaccname(task::MSKtask, accidx::Int64, name::Union{Nothing,AbstractString}) function putaccname(task::MSKtask, accidx::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of an affine conic constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)accidx
(Int64
) – Index of the affine conic constraint. (input)name
(AbstractString
) – The name of the affine conic constraint. (input)
- Groups:
- putacol¶
function putacol(task::MSKtask, j::Int32, subj::Vector{Int32}, valj::Vector{Float64}) function putacol(task::MSKtask, j::T0, subj::T1, valj::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Change one column of the linear constraint matrix \(A\). Resets all the elements in column \(j\) to zero and then sets
\[a_{\mathtt{subj}[k],\mathtt{j}} = \mathtt{valj}[k], \quad k=\idxbeg,\ldots,\idxend{\mathtt{nzj}}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of a column in \(A\). (input)subj
(Int32
[]
) – Row indexes of non-zero values in column \(j\) of \(A\). (input)valj
(Float64
[]
) – New non-zero values of column \(j\) in \(A\). (input)
- Groups:
- putacollist¶
function putacollist(task::MSKtask, sub::Vector{Int32}, ptrb::Vector{Int64}, ptre::Vector{Int64}, asub::Vector{Int32}, aval::Vector{Float64}) function putacollist(task::MSKtask, sub::T0, ptrb::T1, ptre::T2, asub::T3, aval::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} } function putacollist(task::MSKtask, sub::T0, A:: SparseMatrixCSC{Float64}) where { T0<:AbstractVector{<:Integer} }
Change a set of columns in the linear constraint matrix \(A\) with data in sparse triplet format. The requested columns are set to zero and then updated with:
\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\idxbeg,\ldots,\idxend{\mathtt{num}}\\ & a_{\mathtt{asub}[k],\mathtt{sub}[i]} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i],\ldots,\mathtt{ptre}[i]-1. \end{array}\end{split}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – Indexes of columns that should be replaced, no duplicates. (input)ptrb
(Int64
[]
) – Array of pointers to the first element in each column. (input)ptre
(Int64
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(Int32
[]
) – Row indexes of new elements. (input)aval
(Float64
[]
) – Coefficient values. (input)A
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putacolslice¶
function putacolslice(task::MSKtask, first::Int32, last::Int32, ptrb::Vector{Int64}, ptre::Vector{Int64}, asub::Vector{Int32}, aval::Vector{Float64}) function putacolslice(task::MSKtask, first::T0, last::T1, ptrb::T2, ptre::T3, asub::T4, aval::T5) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Number} } function putacolslice(task::MSKtask, first::T0, last::T1, A:: SparseMatrixCSC{Float64}) where { T0<:Integer, T1<:Integer }
Change a slice of columns in the linear constraint matrix \(A\) with data in sparse triplet format. The requested columns are set to zero and then updated with:
\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\mathtt{first},\ldots,\mathtt{last}-1\\ & a_{\mathtt{asub}[k],i} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i-\mathtt{first}\idxorg],\ldots,\mathtt{ptre}[i-\mathtt{first}\idxorg]-1. \end{array}\end{split}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First column in the slice. (input)last
(Int32
) – Last column plus one in the slice. (input)ptrb
(Int64
[]
) – Array of pointers to the first element in each column. (input)ptre
(Int64
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(Int32
[]
) – Row indexes of new elements. (input)aval
(Float64
[]
) – Coefficient values. (input)A
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putafebarfblocktriplet¶
function putafebarfblocktriplet(task::MSKtask, afeidx::Vector{Int64}, barvaridx::Vector{Int32}, subk::Vector{Int32}, subl::Vector{Int32}, valkl::Vector{Float64}) function putafebarfblocktriplet(task::MSKtask, afeidx::T0, barvaridx::T1, subk::T2, subl::T3, valkl::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} }
Inputs the \(\barF\) matrix data in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Constraint index. (input)barvaridx
(Int32
[]
) – Symmetric matrix variable index. (input)subk
(Int32
[]
) – Block row index. (input)subl
(Int32
[]
) – Block column index. (input)valkl
(Float64
[]
) – The numerical value associated with each block triplet. (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- putafebarfentry¶
function putafebarfentry(task::MSKtask, afeidx::Int64, barvaridx::Int32, termidx::Vector{Int64}, termweight::Vector{Float64}) function putafebarfentry(task::MSKtask, afeidx::T0, barvaridx::T1, termidx::T2, termweight::T3) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
This function sets one entry \(\barF_{ij}\) where \(i=\mathrm{afeidx}\) is the row index in the store of affine expressions and \(j=\mathrm{barvaridx}\) is the index of a symmetric variable. That is, the expression
\[\langle \barF_{ij}, \barX_j\rangle\]will be added to the \(i\)-th affine expression.
The matrix \(\barF_{ij}\) is specified as a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barF_{ij}\) is a symmetric matrix, precisely:
\[\barF_{\mathrm{afeidx},\mathrm{barvaridx}} = \sum_{k} \mathrm{termweight}[k] \cdot E_{\mathrm{termidx}[k]}.\]By default all elements in \(\barF\) are 0, so only non-zero elements need be added. Setting the same entry again will overwrite the earlier entry.
The symmetric matrices from \(E\) are defined separately using the function
appendsparsesymmat
.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)barvaridx
(Int32
) – Semidefinite variable index. (input)termidx
(Int64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for the \(\barF\) entry being specified. (input)termweight
(Float64
[]
) –termweight[k]
is the coefficient of thetermidx[k]
-th element of \(E\) in the weighted sum the \(\barF\) entry being specified. (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- putafebarfentrylist¶
function putafebarfentrylist(task::MSKtask, afeidx::Vector{Int64}, barvaridx::Vector{Int32}, numterm::Vector{Int64}, ptrterm::Vector{Int64}, termidx::Vector{Int64}, termweight::Vector{Float64}) function putafebarfentrylist(task::MSKtask, afeidx::T0, barvaridx::T1, numterm::T2, ptrterm::T3, termidx::T4, termweight::T5) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Number} }
This function sets a list of entries in \(\barF\). Each entry should be described as in
putafebarfentry
and all those descriptions should be combined (for example concatenated) in the input to this method. That means the \(k\)-th entry set will have row indexafeidx[k]
, symmetric variable indexbarvaridx[k]
and the description of this term consists of indices in \(E\) and weights appearing in positions\[\mathrm{ptrterm}[k],\ldots,\mathrm{ptrterm}[k] + (\mathrm{lenterm}[k] - 1)\]in the corresponding arrays
termidx
andtermweight
. Seeputafebarfentry
for details.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Row indexes of \(\barF\). (input)barvaridx
(Int32
[]
) – Semidefinite variable indexes. (input)numterm
(Int64
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(Int64
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(Int64
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) being specified. (input)termweight
(Float64
[]
) – Concatenated lists of weights appearing in the weighted sums forming the \(\barF\) elements being specified. (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- putafebarfrow¶
function putafebarfrow(task::MSKtask, afeidx::Int64, barvaridx::Vector{Int32}, numterm::Vector{Int64}, ptrterm::Vector{Int64}, termidx::Vector{Int64}, termweight::Vector{Float64}) function putafebarfrow(task::MSKtask, afeidx::T0, barvaridx::T1, numterm::T2, ptrterm::T3, termidx::T4, termweight::T5) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Number} }
This function inputs one row in \(\barF\). It first clears the row, i.e. sets \(\barF_{\mathrm{afeidx},*}=0\) and then sets the new entries. Each entry should be described as in
putafebarfentry
and all those descriptions should be combined (for example concatenated) in the input to this method. That means the \(k\)-th entry set will have row indexafeidx
, symmetric variable indexbarvaridx[k]
and the description of this term consists of indices in \(E\) and weights appearing in positions\[\mathrm{ptrterm}[k],\ldots,\mathrm{ptrterm}[k] + (\mathrm{numterm}[k] - 1)\]in the corresponding arrays
termidx
andtermweight
. Seeputafebarfentry
for details.- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index of \(\barF\). (input)barvaridx
(Int32
[]
) – Semidefinite variable indexes. (input)numterm
(Int64
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(Int64
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(Int64
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) entries in the row. (input)termweight
(Float64
[]
) – Concatenated lists of weights appearing in the weighted sums forming the \(\barF\) entries in the row. (input)
- Groups:
Problem data - affine expressions, Problem data - semidefinite
- putafefcol¶
function putafefcol(task::MSKtask, varidx::Int32, afeidx::Vector{Int64}, val::Vector{Float64}) function putafefcol(task::MSKtask, varidx::T0, afeidx::T1, val::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Change one column of the matrix \(F\) of affine expressions. Resets all the elements in column
varidx
to zero and then sets\[F_{\mathtt{afeidx}[k],\mathtt{varidx}} = \mathtt{val}[k], \quad k=\idxbeg,\ldots,\idxend{\mathtt{numnz}}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)varidx
(Int32
) – Index of a column in \(F\). (input)afeidx
(Int64
[]
) – Row indexes of non-zero values in the column of \(F\). (input)val
(Float64
[]
) – New non-zero values in the column of \(F\). (input)
- Groups:
- putafefentry¶
function putafefentry(task::MSKtask, afeidx::Int64, varidx::Int32, value::Float64) function putafefentry(task::MSKtask, afeidx::T0, varidx::T1, value::T2) where { T0<:Integer, T1<:Integer, T2<:Number }
Replaces one entry in the affine expression store \(F\), that is it sets:
\[F_{\mathrm{afeidx}, \mathrm{varidx}} = \mathrm{value}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Row index in \(F\). (input)varidx
(Int32
) – Column index in \(F\). (input)value
(Float64
) – Value of \(F_{\mathrm{afeidx},\mathrm{varidx}}\). (input)
- Groups:
- putafefentrylist¶
function putafefentrylist(task::MSKtask, afeidx::Vector{Int64}, varidx::Vector{Int32}, val::Vector{Float64}) function putafefentrylist(task::MSKtask, afeidx::T0, varidx::T1, val::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Replaces a number of entries in the affine expression store \(F\), that is it sets:
\[F_{\mathrm{afeidxs}[k], \mathrm{varidx}[k]} = \mathrm{val}[k]\]for all \(k\).
- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Row indices in \(F\). (input)varidx
(Int32
[]
) – Column indices in \(F\). (input)val
(Float64
[]
) – Values of the entries in \(F\). (input)
- Groups:
- putafefrow¶
function putafefrow(task::MSKtask, afeidx::Int64, varidx::Vector{Int32}, val::Vector{Float64}) function putafefrow(task::MSKtask, afeidx::T0, varidx::T1, val::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Change one row of the matrix \(F\) of affine expressions. Resets all the elements in row
afeidx
to zero and then sets\[F_{\mathtt{afeidx},\mathtt{varidx}[k]} = \mathtt{val}[k], \quad k=\idxbeg,\ldots,\idxend{\mathtt{numnz}}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of a row in \(F\). (input)varidx
(Int32
[]
) – Column indexes of non-zero values in the row of \(F\). (input)val
(Float64
[]
) – New non-zero values in the row of \(F\). (input)
- Groups:
- putafefrowlist¶
function putafefrowlist(task::MSKtask, afeidx::Vector{Int64}, numnzrow::Vector{Int32}, ptrrow::Vector{Int64}, varidx::Vector{Int32}, val::Vector{Float64}) function putafefrowlist(task::MSKtask, afeidx::T0, numnzrow::T1, ptrrow::T2, varidx::T3, val::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} }
Clears and then changes a number of rows of the matrix \(F\) of affine expressions. The \(k\)-th of the rows to be changed has index \(i = \mathrm{afeidx}[k]\), contains \(\mathrm{numnzrow}[k]\) nonzeros and its description as in
putafefrow
starts in position \(\mathrm{ptrrow}[k]\) of the arraysvaridx
andval
. Formally, the row with index \(i\) is cleared and then set as:\[F_{i,\mathrm{varidx}[\mathrm{ptrrow}[k]+j]} = \mathrm{val}[\mathrm{ptrrow}[k] + j], \quad j=0,\ldots,\mathrm{numnzrow}[k]-1.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Indices of rows in \(F\). (input)numnzrow
(Int32
[]
) – Number of non-zeros in each of the modified rows of \(F\). (input)ptrrow
(Int64
[]
) – Pointer to the first nonzero in each row of \(F\). (input)varidx
(Int32
[]
) – Column indexes of non-zero values. (input)val
(Float64
[]
) – New non-zero values in the rows of \(F\). (input)
- Groups:
- putafeg¶
function putafeg(task::MSKtask, afeidx::Int64, g::Float64) function putafeg(task::MSKtask, afeidx::T0, g::T1) where { T0<:Integer, T1<:Number }
Change one element of the vector \(g\) in affine expressions i.e.
\[g_{\mathtt{afeidx}} = \mathtt{gi}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
) – Index of an entry in \(g\). (input)g
(Float64
) – New value for \(g_{\mathrm{afeidx}}\). (input)
- Groups:
- putafeglist¶
function putafeglist(task::MSKtask, afeidx::Vector{Int64}, g::Vector{Float64}) function putafeglist(task::MSKtask, afeidx::T0, g::T1) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Number} }
Changes a list of elements of the vector \(g\) in affine expressions i.e. for all \(k\) it sets
\[g_{\mathrm{afeidx}[k]} = \mathrm{glist}[k].\]- Parameters:
task
(MSKtask
) – An optimization task. (input)afeidx
(Int64
[]
) – Indices of entries in \(g\). (input)g
(Float64
[]
) – New values for \(g\). (input)
- Groups:
- putafegslice¶
function putafegslice(task::MSKtask, first::Int64, last::Int64, slice::Vector{Float64}) function putafegslice(task::MSKtask, first::T0, last::T1, slice::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Modifies a slice in the vector \(g\) of constant terms in affine expressions using the principle
\[g_{\mathtt{j}} = \mathtt{slice[j-first\idxorg]}, \quad j=\mathrm{first},..,\mathrm{last}-1\]- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int64
) – First index in the sequence. (input)last
(Int64
) – Last index plus 1 in the sequence. (input)slice
(Float64
[]
) – The slice of \(g\) as a dense vector. The length islast-first
. (input)
- Groups:
- putaij¶
function putaij(task::MSKtask, i::Int32, j::Int32, aij::Float64) function putaij(task::MSKtask, i::T0, j::T1, aij::T2) where { T0<:Integer, T1<:Integer, T2<:Number }
Changes a coefficient in the linear coefficient matrix \(A\) using the method
\[a_{i,j} = \mathtt{aij}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Constraint (row) index. (input)j
(Int32
) – Variable (column) index. (input)aij
(Float64
) – New coefficient for \(a_{i,j}\). (input)
- Groups:
- putaijlist¶
function putaijlist(task::MSKtask, subi::Vector{Int32}, subj::Vector{Int32}, valij::Vector{Float64}) function putaijlist(task::MSKtask, subi::T0, subj::T1, valij::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Changes one or more coefficients in \(A\) using the method
\[a_{\mathtt{subi[k]},\mathtt{subj[k]}} = \mathtt{valij[k]}, \quad k=\idxbeg,\ldots,\idxend{\mathtt{num}}.\]Duplicates are not allowed.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subi
(Int32
[]
) – Constraint (row) indices. (input)subj
(Int32
[]
) – Variable (column) indices. (input)valij
(Float64
[]
) – New coefficient values for \(a_{i,j}\). (input)
- Groups:
- putarow¶
function putarow(task::MSKtask, i::Int32, subi::Vector{Int32}, vali::Vector{Float64}) function putarow(task::MSKtask, i::T0, subi::T1, vali::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
Change one row of the linear constraint matrix \(A\). Resets all the elements in row \(i\) to zero and then sets
\[a_{\mathtt{i},\mathtt{subi}[k]} = \mathtt{vali}[k], \quad k=\idxbeg,\ldots,\idxend{\mathtt{nzi}}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of a row in \(A\). (input)subi
(Int32
[]
) – Column indexes of non-zero values in row \(i\) of \(A\). (input)vali
(Float64
[]
) – New non-zero values of row \(i\) in \(A\). (input)
- Groups:
- putarowlist¶
function putarowlist(task::MSKtask, sub::Vector{Int32}, ptrb::Vector{Int64}, ptre::Vector{Int64}, asub::Vector{Int32}, aval::Vector{Float64}) function putarowlist(task::MSKtask, sub::T0, ptrb::T1, ptre::T2, asub::T3, aval::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} } function putarowlist(task::MSKtask, sub::T0, At:: SparseMatrixCSC{Float64}) where { T0<:AbstractVector{<:Integer} }
Change a set of rows in the linear constraint matrix \(A\) with data in sparse triplet format. The requested rows are set to zero and then updated with:
\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\idxbeg,\ldots,\idxend{\mathtt{num}} \\ & a_{\mathtt{sub}[i],\mathtt{asub}[k]} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i],\ldots,\mathtt{ptre}[i]-1. \end{array}\end{split}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – Indexes of rows that should be replaced, no duplicates. (input)ptrb
(Int64
[]
) – Array of pointers to the first element in each row. (input)ptre
(Int64
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(Int32
[]
) – Column indexes of new elements. (input)aval
(Float64
[]
) – Coefficient values. (input)At
(SparseMatrixCSC{Float64}
) – Transposed matrix defining the row values. Note that for efficiency reasons the columns of this matrix defines the rows to be replaced (input)
- Groups:
- putarowslice¶
function putarowslice(task::MSKtask, first::Int32, last::Int32, ptrb::Vector{Int64}, ptre::Vector{Int64}, asub::Vector{Int32}, aval::Vector{Float64}) function putarowslice(task::MSKtask, first::T0, last::T1, ptrb::T2, ptre::T3, asub::T4, aval::T5) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Number} } function putarowslice(task::MSKtask, first::T0, last::T1, At:: SparseMatrixCSC{Float64}) where { T0<:Integer, T1<:Integer }
Change a slice of rows in the linear constraint matrix \(A\) with data in sparse triplet format. The requested rows are set to zero and then updated with:
\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\mathtt{first},\ldots,\mathtt{last}-1 \\ & a_{i,\mathtt{asub}[k]} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i-\mathtt{first}\idxorg],\ldots,\mathtt{ptre}[i-\mathtt{first}\idxorg]-1. \end{array}\end{split}\]- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First row in the slice. (input)last
(Int32
) – Last row plus one in the slice. (input)ptrb
(Int64
[]
) – Array of pointers to the first element in each row. (input)ptre
(Int64
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(Int32
[]
) – Column indexes of new elements. (input)aval
(Float64
[]
) – Coefficient values. (input)At
(SparseMatrixCSC{Float64}
) – Transposed matrix defining the row values. Note that for efficiency reasons the columns of this matrix defines the rows to be replaced (input)
- Groups:
- putatruncatetol¶
function putatruncatetol(task::MSKtask, tolzero::Float64) function putatruncatetol(task::MSKtask, tolzero::T0) where { T0<:Number }
Truncates (sets to zero) all elements in \(A\) that satisfy
\[|a_{i,j}| \leq \mathtt{tolzero}.\]- Parameters:
task
(MSKtask
) – An optimization task. (input)tolzero
(Float64
) – Truncation tolerance. (input)
- Groups:
- putbarablocktriplet¶
function putbarablocktriplet(task::MSKtask, subi::Vector{Int32}, subj::Vector{Int32}, subk::Vector{Int32}, subl::Vector{Int32}, valijkl::Vector{Float64}) function putbarablocktriplet(task::MSKtask, subi::T0, subj::T1, subk::T2, subl::T3, valijkl::T4) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number} }
Inputs the \(\barA\) matrix in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subi
(Int32
[]
) – Constraint index. (input)subj
(Int32
[]
) – Symmetric matrix variable index. (input)subk
(Int32
[]
) – Block row index. (input)subl
(Int32
[]
) – Block column index. (input)valijkl
(Float64
[]
) – The numerical value associated with each block triplet. (input)
- Groups:
- putbaraij¶
function putbaraij(task::MSKtask, i::Int32, j::Int32, sub::Vector{Int64}, weights::Vector{Float64}) function putbaraij(task::MSKtask, i::T0, j::T1, sub::T2, weights::T3) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
This function sets one element in the \(\barA\) matrix.
Each element in the \(\barA\) matrix is a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barA_{ij}\) is a symmetric matrix. By default all elements in \(\barA\) are 0, so only non-zero elements need be added. Setting the same element again will overwrite the earlier entry.
The symmetric matrices from \(E\) are defined separately using the function
appendsparsesymmat
.- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Row index of \(\barA\). (input)j
(Int32
) – Column index of \(\barA\). (input)sub
(Int64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(Float64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
- Groups:
- putbaraijlist¶
function putbaraijlist(task::MSKtask, subi::Vector{Int32}, subj::Vector{Int32}, alphaptrb::Vector{Int64}, alphaptre::Vector{Int64}, matidx::Vector{Int64}, weights::Vector{Float64}) function putbaraijlist(task::MSKtask, subi::T0, subj::T1, alphaptrb::T2, alphaptre::T3, matidx::T4, weights::T5) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Number} } function putbaraijlist(task::MSKtask, subi::T0, subj::T1, A:: SparseMatrixCSC{Float64}) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer} }
This function sets a list of elements in the \(\barA\) matrix.
Each element in the \(\barA\) matrix is a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barA_{ij}\) is a symmetric matrix. By default all elements in \(\barA\) are 0, so only non-zero elements need be added. Setting the same element again will overwrite the earlier entry.
The symmetric matrices from \(E\) are defined separately using the function
appendsparsesymmat
.- Parameters:
task
(MSKtask
) – An optimization task. (input)subi
(Int32
[]
) – Row index of \(\barA\). (input)subj
(Int32
[]
) – Column index of \(\barA\). (input)alphaptrb
(Int64
[]
) – Start entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)alphaptre
(Int64
[]
) – End entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)matidx
(Int64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(Float64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)A
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putbararowlist¶
function putbararowlist(task::MSKtask, subi::Vector{Int32}, ptrb::Vector{Int64}, ptre::Vector{Int64}, subj::Vector{Int32}, nummat::Vector{Int64}, matidx::Vector{Int64}, weights::Vector{Float64}) function putbararowlist(task::MSKtask, subi::T0, ptrb::T1, ptre::T2, subj::T3, nummat::T4, matidx::T5, weights::T6) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Number} } function putbararowlist(task::MSKtask, subi::T0, A:: SparseMatrixCSC{Float64}, matidx::T5, weights::T6) where { T0<:AbstractVector{<:Integer}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Number} }
This function replaces a list of rows in the \(\barA\) matrix.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subi
(Int32
[]
) – Row indexes of \(\barA\). (input)ptrb
(Int64
[]
) – Start of rows in \(\barA\). (input)ptre
(Int64
[]
) – End of rows in \(\barA\). (input)subj
(Int32
[]
) – Column index of \(\barA\). (input)nummat
(Int64
[]
) – Number of entries in weighted sum of matrixes. (input)matidx
(Int64
[]
) – Matrix indexes for weighted sum of matrixes. (input)weights
(Float64
[]
) – Weights for weighted sum of matrixes. (input)A
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putbarcblocktriplet¶
function putbarcblocktriplet(task::MSKtask, subj::Vector{Int32}, subk::Vector{Int32}, subl::Vector{Int32}, valjkl::Vector{Float64}) function putbarcblocktriplet(task::MSKtask, subj::T0, subk::T1, subl::T2, valjkl::T3) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
Inputs the \(\barC\) matrix in block triplet form.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – Symmetric matrix variable index. (input)subk
(Int32
[]
) – Block row index. (input)subl
(Int32
[]
) – Block column index. (input)valjkl
(Float64
[]
) – The numerical value associated with each block triplet. (input)
- Groups:
- putbarcj¶
function putbarcj(task::MSKtask, j::Int32, sub::Vector{Int64}, weights::Vector{Float64}) function putbarcj(task::MSKtask, j::T0, sub::T1, weights::T2) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} }
This function sets one entry in the \(\barC\) vector.
Each element in the \(\barC\) vector is a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barC_{j}\) is a symmetric matrix. By default all elements in \(\barC\) are 0, so only non-zero elements need be added. Setting the same element again will overwrite the earlier entry.
The symmetric matrices from \(E\) are defined separately using the function
appendsparsesymmat
.- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the element in \(\barC\) that should be changed. (input)sub
(Int64
[]
) – Indices in \(E\) of matrices appearing in the weighted sum for \(\barC_j\) (input)weights
(Float64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barC_j\). (input)
- Groups:
- putbarsj¶
function putbarsj(task::MSKtask, whichsol::Soltype, j::Int32, barsj::Vector{Float64}) function putbarsj(task::MSKtask, whichsol::Soltype, j::T0, barsj::T1) where { T0<:Integer, T1<:AbstractVector{<:Number} }
Sets the dual solution for a semidefinite variable.
- Parameters:
- Groups:
- putbarvarname¶
function putbarvarname(task::MSKtask, j::Int32, name::Union{Nothing,AbstractString}) function putbarvarname(task::MSKtask, j::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of a semidefinite variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)name
(AbstractString
) – The variable name. (input)
- Groups:
- putbarxj¶
function putbarxj(task::MSKtask, whichsol::Soltype, j::Int32, barxj::Vector{Float64}) function putbarxj(task::MSKtask, whichsol::Soltype, j::T0, barxj::T1) where { T0<:Integer, T1<:AbstractVector{<:Number} }
Sets the primal solution for a semidefinite variable.
- Parameters:
- Groups:
- putcallbackfunc¶
function putcallbackfunc(task::MSKtask, f::Function)
Receive callbacks with solver status and information during optimization.
- Parameters:
task
(MSKtask
) – An optimization task. (input)f
(Function
) – The callback function. (input)
- Groups:
- putcfix¶
function putcfix(task::MSKtask, cfix::Float64) function putcfix(task::MSKtask, cfix::T0) where { T0<:Number }
Replaces the fixed term in the objective by a new one.
- Parameters:
task
(MSKtask
) – An optimization task. (input)cfix
(Float64
) – Fixed term in the objective. (input)
- Groups:
- putcj¶
function putcj(task::MSKtask, j::Int32, cj::Float64) function putcj(task::MSKtask, j::T0, cj::T1) where { T0<:Integer, T1<:Number }
Modifies one coefficient in the linear objective vector \(c\), i.e.
\[c_{\mathtt{j}} = \mathtt{cj}.\]If the absolute value exceeds
MSK_DPAR_DATA_TOL_C_HUGE
an error is generated. If the absolute value exceedsMSK_DPAR_DATA_TOL_CJ_LARGE
, a warning is generated, but the coefficient is inputted as specified.- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable for which \(c\) should be changed. (input)cj
(Float64
) – New value of \(c_j\). (input)
- Groups:
- putclist¶
function putclist(task::MSKtask, subj::Vector{Int32}, val::Vector{Float64}) function putclist(task::MSKtask, subj::T0, val::T1) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Number} }
Modifies the coefficients in the linear term \(c\) in the objective using the principle
\[c_{\mathtt{subj[t]}} = \mathtt{val[t]}, \quad t=\idxbeg,\ldots,\idxend{\mathtt{num}}.\]If a variable index is specified multiple times in
subj
only the last entry is used. Data checks are performed as inputcj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – Indices of variables for which the coefficient in \(c\) should be changed. (input)val
(Float64
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - objective
- putconbound¶
function putconbound(task::MSKtask, i::Int32, bkc::Boundkey, blc::Float64, buc::Float64) function putconbound(task::MSKtask, i::T0, bkc::Boundkey, blc::T1, buc::T2) where { T0<:Integer, T1<:Number, T2<:Number }
Changes the bounds for one constraint.
If the bound value specified is numerically larger than
MSK_DPAR_DATA_TOL_BOUND_INF
it is considered infinite and the bound key is changed accordingly. If a bound value is numerically larger thanMSK_DPAR_DATA_TOL_BOUND_WRN
, a warning will be displayed, but the bound is inputted as specified.- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint. (input)bkc
(Boundkey
) – New bound key. (input)blc
(Float64
) – New lower bound. (input)buc
(Float64
) – New upper bound. (input)
- Groups:
Problem data - linear part, Problem data - constraints, Problem data - bounds
- putconboundlist¶
function putconboundlist(task::MSKtask, sub::Vector{Int32}, bkc::Vector{Boundkey}, blc::Vector{Float64}, buc::Vector{Float64}) function putconboundlist(task::MSKtask, sub::T0, bkc::Vector{Boundkey}, blc::T1, buc::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Number}, T2<:AbstractVector{<:Number} }
Changes the bounds for a list of constraints. If multiple bound changes are specified for a constraint, then only the last change takes effect. Data checks are performed as in
putconbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – List of constraint indexes. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(Float64
[]
) – Lower bounds for the constraints. (input)buc
(Float64
[]
) – Upper bounds for the constraints. (input)
- Groups:
Problem data - linear part, Problem data - constraints, Problem data - bounds
- putconboundlistconst¶
function putconboundlistconst(task::MSKtask, sub::Vector{Int32}, bkc::Boundkey, blc::Float64, buc::Float64) function putconboundlistconst(task::MSKtask, sub::T0, bkc::Boundkey, blc::T1, buc::T2) where { T0<:AbstractVector{<:Integer}, T1<:Number, T2<:Number }
Changes the bounds for one or more constraints. Data checks are performed as in
putconbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – List of constraint indexes. (input)bkc
(Boundkey
) – New bound key for all constraints in the list. (input)blc
(Float64
) – New lower bound for all constraints in the list. (input)buc
(Float64
) – New upper bound for all constraints in the list. (input)
- Groups:
Problem data - linear part, Problem data - constraints, Problem data - bounds
- putconboundslice¶
function putconboundslice(task::MSKtask, first::Int32, last::Int32, bkc::Vector{Boundkey}, blc::Vector{Float64}, buc::Vector{Float64}) function putconboundslice(task::MSKtask, first::T0, last::T1, bkc::Vector{Boundkey}, blc::T2, buc::T3) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number}, T3<:AbstractVector{<:Number} }
Changes the bounds for a slice of the constraints. Data checks are performed as in
putconbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(Float64
[]
) – Lower bounds for the constraints. (input)buc
(Float64
[]
) – Upper bounds for the constraints. (input)
- Groups:
Problem data - linear part, Problem data - constraints, Problem data - bounds
- putconboundsliceconst¶
function putconboundsliceconst(task::MSKtask, first::Int32, last::Int32, bkc::Boundkey, blc::Float64, buc::Float64) function putconboundsliceconst(task::MSKtask, first::T0, last::T1, bkc::Boundkey, blc::T2, buc::T3) where { T0<:Integer, T1<:Integer, T2<:Number, T3<:Number }
Changes the bounds for a slice of the constraints. Data checks are performed as in
putconbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)bkc
(Boundkey
) – New bound key for all constraints in the slice. (input)blc
(Float64
) – New lower bound for all constraints in the slice. (input)buc
(Float64
) – New upper bound for all constraints in the slice. (input)
- Groups:
Problem data - linear part, Problem data - constraints, Problem data - bounds
- putcone Deprecated¶
function putcone(task::MSKtask, k::Int32, ct::Conetype, conepar::Float64, submem::Vector{Int32}) function putcone(task::MSKtask, k::T0, ct::Conetype, conepar::T1, submem::T2) where { T0<:Integer, T1<:Number, T2<:AbstractVector{<:Integer} }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – Index of the cone. (input)ct
(Conetype
) – Specifies the type of the cone. (input)conepar
(Float64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(Int32
[]
) – Variable subscripts of the members in the cone. (input)
- Groups:
- putconename Deprecated¶
function putconename(task::MSKtask, j::Int32, name::Union{Nothing,AbstractString}) function putconename(task::MSKtask, j::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the cone. (input)name
(AbstractString
) – The name of the cone. (input)
- Groups:
- putconname¶
function putconname(task::MSKtask, i::Int32, name::Union{Nothing,AbstractString}) function putconname(task::MSKtask, i::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of a constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint. (input)name
(AbstractString
) – The name of the constraint. (input)
- Groups:
Names, Problem data - constraints, Problem data - linear part
- putconsolutioni¶
function putconsolutioni(task::MSKtask, i::Int32, whichsol::Soltype, sk::Stakey, x::Float64, sl::Float64, su::Float64) function putconsolutioni(task::MSKtask, i::T0, whichsol::Soltype, sk::Stakey, x::T1, sl::T2, su::T3) where { T0<:Integer, T1<:Number, T2<:Number, T3<:Number }
Sets the primal and dual solution information for a single constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the constraint. (input)whichsol
(Soltype
) – Selects a solution. (input)sk
(Stakey
) – Status key of the constraint. (input)x
(Float64
) – Primal solution value of the constraint. (input)sl
(Float64
) – Solution value of the dual variable associated with the lower bound. (input)su
(Float64
) – Solution value of the dual variable associated with the upper bound. (input)
- Groups:
- putcslice¶
function putcslice(task::MSKtask, first::Int32, last::Int32, slice::Vector{Float64}) function putcslice(task::MSKtask, first::T0, last::T1, slice::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Modifies a slice in the linear term \(c\) in the objective using the principle
\[c_{\mathtt{j}} = \mathtt{slice[j-first\idxorg]}, \quad j=\mathtt{first},..,\mathtt{last}-1\]Data checks are performed as in
putcj
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First element in the slice of \(c\). (input)last
(Int32
) – Last element plus 1 of the slice in \(c\) to be changed. (input)slice
(Float64
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups:
- putdjc¶
function putdjc(task::MSKtask, djcidx::Int64, domidxlist::Vector{Int64}, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}, termsizelist::Vector{Int64}) function putdjc(task::MSKtask, djcidx::T0, domidxlist::T1, afeidxlist::T2, b::T3, termsizelist::T4) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number}, T4<:AbstractVector{<:Integer} }
Inputs a disjunctive constraint. The constraint has the form
\[T_1\ \mathrm{or}\ T_2\ \mathrm{or}\ \cdots\ \mathrm{or}\ T_{\mathrm{numterms}}\]For each \(i=1,\ldots\mathrm{numterms}\) the \(i\)-th clause (term) \(T_i\) has the form a sequence of affine expressions belongs to a product of domains, where the number of domains is \(\mathrm{termsizelist}[i]\) and the number of affine expressions is equal to the sum of dimensions of all domains appearing in \(T_i\).
All the domains and all the affine expressions appearing in the above description are arranged sequentially in the lists
domidxlist
andafeidxlist
, respectively. In particular, the length ofdomidxlist
must be equal to the sum of elements oftermsizelist
, and the length ofafeidxlist
must be equal to the sum of dimensions of all the domains appearing indomidxlist
.The elements of
domidxlist
are indexes of domains previously defined with one of theappend...domain
functions.The elements of
afeidxlist
are indexes to the store of affine expressions, i.e. the \(k\)-th affine expression appearing in the disjunctive constraint is going to be\[F_{\mathrm{afeidxlist}[k],:}x + g_{\mathrm{afeidxlist}[k]}\]If an optional vector
b
of the same length asafeidxlist
is specified then the \(k\)-th affine expression appearing in the disjunctive constraint will be taken as\[F_{\mathrm{afeidxlist}[k],:}x + g_{\mathrm{afeidxlist}[k]} - b_k\]- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)domidxlist
(Int64
[]
) – List of domain indexes. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. (input)termsizelist
(Int64
[]
) – List of term sizes. (input)
- Groups:
- putdjcname¶
function putdjcname(task::MSKtask, djcidx::Int64, name::Union{Nothing,AbstractString}) function putdjcname(task::MSKtask, djcidx::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of a disjunctive constraint.
- Parameters:
task
(MSKtask
) – An optimization task. (input)djcidx
(Int64
) – Index of the disjunctive constraint. (input)name
(AbstractString
) – The name of the disjunctive constraint. (input)
- Groups:
- putdjcslice¶
function putdjcslice(task::MSKtask, idxfirst::Int64, idxlast::Int64, domidxlist::Vector{Int64}, afeidxlist::Vector{Int64}, b::Union{Nothing,Vector{Float64}}, termsizelist::Vector{Int64}, termsindjc::Vector{Int64}) function putdjcslice(task::MSKtask, idxfirst::T0, idxlast::T1, domidxlist::T2, afeidxlist::T3, b::T4, termsizelist::T5, termsindjc::T6) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Integer}, T4<:AbstractVector{<:Number}, T5<:AbstractVector{<:Integer}, T6<:AbstractVector{<:Integer} }
Inputs a slice of disjunctive constraints.
The array
termsindjc
should have length \(\mathrm{idxlast}-\mathrm{idxfirst}\) and contain the number of terms in consecutive constraints forming the slice.The rest of the input consists of concatenated descriptions of individual constraints, where each constraint is described as in
putdjc
.- Parameters:
task
(MSKtask
) – An optimization task. (input)idxfirst
(Int64
) – Index of the first disjunctive constraint in the slice. (input)idxlast
(Int64
) – Index of the last disjunctive constraint in the slice plus 1. (input)domidxlist
(Int64
[]
) – List of domain indexes. (input)afeidxlist
(Int64
[]
) – List of affine expression indexes. (input)b
(Float64
[]
) – The vector of constant terms modifying affine expressions. Optional, can benothing
if not required. (input)termsizelist
(Int64
[]
) – List of term sizes. (input)termsindjc
(Int64
[]
) – Number of terms in each of the disjunctive constraints in the slice. (input)
- Groups:
- putdomainname¶
function putdomainname(task::MSKtask, domidx::Int64, name::Union{Nothing,AbstractString}) function putdomainname(task::MSKtask, domidx::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of a domain.
- Parameters:
task
(MSKtask
) – An optimization task. (input)domidx
(Int64
) – Index of the domain. (input)name
(AbstractString
) – The name of the domain. (input)
- Groups:
- putdouparam¶
function putdouparam(task::MSKtask, param::Dparam, parvalue::Float64) function putdouparam(task::MSKtask, param::Dparam, parvalue::T0) where { T0<:Number }
Sets the value of a double parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Dparam
) – Which parameter. (input)parvalue
(Float64
) – Parameter value. (input)
- Groups:
- putintparam¶
function putintparam(task::MSKtask, param::Iparam, parvalue::Int32) function putintparam(task::MSKtask, param::Iparam, parvalue::T0) where { T0<:Integer }
Sets the value of an integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Iparam
) – Which parameter. (input)parvalue
(Int32
) – Parameter value. (input)
- Groups:
- putlicensecode¶
function putlicensecode(env::MSKenv, code::Union{Nothing,Vector{Int32}}) function putlicensecode(env::MSKenv, code::T0) where { T0<:AbstractVector{<:Integer} } function putlicensecode(code::Union{Nothing,Vector{Int32}}) function putlicensecode(code::T0) where { T0<:AbstractVector{<:Integer} }
Input a runtime license code. This function has an effect only before the first optimization.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)code
(Int32
[]
) – A runtime license code. (input)
- Groups:
- putlicensedebug¶
function putlicensedebug(env::MSKenv, licdebug::Int32) function putlicensedebug(env::MSKenv, licdebug::T0) where { T0<:Integer } function putlicensedebug(licdebug::Int32) function putlicensedebug(licdebug::T0) where { T0<:Integer }
Enables debug information for the license system. If
licdebug
is non-zero, then MOSEK will print debug info regarding the license checkout.- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)licdebug
(Int32
) – Whether license checkout debug info should be printed. (input)
- Groups:
- putlicensepath¶
function putlicensepath(env::MSKenv, licensepath::Union{Nothing,AbstractString}) function putlicensepath(licensepath::Union{Nothing,AbstractString})
Set the path to the license file. This function has an effect only before the first optimization.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)licensepath
(AbstractString
) – A path specifying where to search for the license. (input)
- Groups:
- putlicensewait¶
function putlicensewait(env::MSKenv, licwait::Int32) function putlicensewait(env::MSKenv, licwait::T0) where { T0<:Integer } function putlicensewait(licwait::Int32) function putlicensewait(licwait::T0) where { T0<:Integer }
Control whether MOSEK should wait for an available license if no license is available. If
licwait
is non-zero, then MOSEK will wait forlicwait-1
milliseconds between each check for an available license.- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)licwait
(Int32
) – Whether MOSEK should wait for a license if no license is available. (input)
- Groups:
- putlintparam¶
function putlintparam(task::MSKtask, param::Iparam, parvalue::Int64) function putlintparam(task::MSKtask, param::Iparam, parvalue::T0) where { T0<:Integer }
Sets the value of an integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Iparam
) – Which parameter. (input)parvalue
(Int64
) – Parameter value. (input)
- Groups:
- putmaxnumacc¶
function putmaxnumacc(task::MSKtask, maxnumacc::Int64) function putmaxnumacc(task::MSKtask, maxnumacc::T0) where { T0<:Integer }
Sets the number of preallocated affine conic constraints in the optimization task. When this number is reached MOSEK will automatically allocate more space. It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumacc
(Int64
) – Number of preallocated affine conic constraints. (input)
- Groups:
Environment and task management, Problem data - affine conic constraints
- putmaxnumafe¶
function putmaxnumafe(task::MSKtask, maxnumafe::Int64) function putmaxnumafe(task::MSKtask, maxnumafe::T0) where { T0<:Integer }
Sets the number of preallocated affine expressions in the optimization task. When this number is reached MOSEK will automatically allocate more space for affine expressions. It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumafe
(Int64
) – Number of preallocated affine expressions. (input)
- Groups:
Environment and task management, Problem data - affine expressions
- putmaxnumanz¶
function putmaxnumanz(task::MSKtask, maxnumanz::Int64) function putmaxnumanz(task::MSKtask, maxnumanz::T0) where { T0<:Integer }
Sets the number of preallocated non-zero entries in \(A\).
MOSEK stores only the non-zero elements in the linear coefficient matrix \(A\) and it cannot predict how much storage is required to store \(A\). Using this function it is possible to specify the number of non-zeros to preallocate for storing \(A\).
If the number of non-zeros in the problem is known, it is a good idea to set
maxnumanz
slightly larger than this number, otherwise a rough estimate can be used. In general, if \(A\) is inputted in many small chunks, setting this value may speed up the data input phase.It is not mandatory to call this function, since MOSEK will reallocate internal structures whenever it is necessary.
The function call has no effect if both
maxnumcon
andmaxnumvar
are zero.- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumanz
(Int64
) – Number of preallocated non-zeros in \(A\). (input)
- Groups:
- putmaxnumbarvar¶
function putmaxnumbarvar(task::MSKtask, maxnumbarvar::Int32) function putmaxnumbarvar(task::MSKtask, maxnumbarvar::T0) where { T0<:Integer }
Sets the number of preallocated symmetric matrix variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.
It is not mandatory to call this function. It only gives a hint about the amount of data to preallocate for efficiency reasons.
Please note that
maxnumbarvar
must be larger than the current number of symmetric matrix variables in the task.- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumbarvar
(Int32
) – Number of preallocated symmetric matrix variables. (input)
- Groups:
Environment and task management, Problem data - semidefinite
- putmaxnumcon¶
function putmaxnumcon(task::MSKtask, maxnumcon::Int32) function putmaxnumcon(task::MSKtask, maxnumcon::T0) where { T0<:Integer }
Sets the number of preallocated constraints in the optimization task. When this number of constraints is reached MOSEK will automatically allocate more space for constraints.
It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
Please note that
maxnumcon
must be larger than the current number of constraints in the task.- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumcon
(Int32
) – Number of preallocated constraints in the optimization task. (input)
- Groups:
- putmaxnumcone Deprecated¶
function putmaxnumcone(task::MSKtask, maxnumcone::Int32) function putmaxnumcone(task::MSKtask, maxnumcone::T0) where { T0<:Integer }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Sets the number of preallocated conic constraints in the optimization task. When this number of conic constraints is reached MOSEK will automatically allocate more space for conic constraints.
It is not mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
Please note that
maxnumcon
must be larger than the current number of conic constraints in the task.- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumcone
(Int32
) – Number of preallocated conic constraints in the optimization task. (input)
- Groups:
Environment and task management, Problem data - cones (deprecated)
- putmaxnumdjc¶
function putmaxnumdjc(task::MSKtask, maxnumdjc::Int64) function putmaxnumdjc(task::MSKtask, maxnumdjc::T0) where { T0<:Integer }
Sets the number of preallocated disjunctive constraints in the optimization task. When this number is reached MOSEK will automatically allocate more space. It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumdjc
(Int64
) – Number of preallocated disjunctive constraints in the task. (input)
- Groups:
Environment and task management, Problem data - disjunctive constraints
- putmaxnumdomain¶
function putmaxnumdomain(task::MSKtask, maxnumdomain::Int64) function putmaxnumdomain(task::MSKtask, maxnumdomain::T0) where { T0<:Integer }
Sets the number of preallocated domains in the optimization task. When this number is reached MOSEK will automatically allocate more space. It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumdomain
(Int64
) – Number of preallocated domains. (input)
- Groups:
- putmaxnumqnz¶
function putmaxnumqnz(task::MSKtask, maxnumqnz::Int64) function putmaxnumqnz(task::MSKtask, maxnumqnz::T0) where { T0<:Integer }
Sets the number of preallocated non-zero entries in quadratic terms.
MOSEK stores only the non-zero elements in \(Q\). Therefore, MOSEK cannot predict how much storage is required to store \(Q\). Using this function it is possible to specify the number non-zeros to preallocate for storing \(Q\) (both objective and constraints).
It may be advantageous to reserve more non-zeros for \(Q\) than actually needed since it may improve the internal efficiency of MOSEK, however, it is never worthwhile to specify more than the double of the anticipated number of non-zeros in \(Q\).
It is not mandatory to call this function, since MOSEK will reallocate internal structures whenever it is necessary.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumqnz
(Int64
) – Number of non-zero elements preallocated in quadratic coefficient matrices. (input)
- Groups:
Environment and task management, Problem data - quadratic part
- putmaxnumvar¶
function putmaxnumvar(task::MSKtask, maxnumvar::Int32) function putmaxnumvar(task::MSKtask, maxnumvar::T0) where { T0<:Integer }
Sets the number of preallocated variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.
It is not mandatory to call this function. It only gives a hint about the amount of data to preallocate for efficiency reasons.
Please note that
maxnumvar
must be larger than the current number of variables in the task.- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumvar
(Int32
) – Number of preallocated variables in the optimization task. (input)
- Groups:
- putnadouparam¶
function putnadouparam(task::MSKtask, paramname::AbstractString, parvalue::Float64) function putnadouparam(task::MSKtask, paramname::Union{Nothing,AbstractString}, parvalue::T0) where { T0<:Number }
Sets the value of a named double parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)parvalue
(Float64
) – Parameter value. (input)
- Groups:
- putnaintparam¶
function putnaintparam(task::MSKtask, paramname::AbstractString, parvalue::Int32) function putnaintparam(task::MSKtask, paramname::Union{Nothing,AbstractString}, parvalue::T0) where { T0<:Integer }
Sets the value of a named integer parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)parvalue
(Int32
) – Parameter value. (input)
- Groups:
- putnastrparam¶
function putnastrparam(task::MSKtask, paramname::AbstractString, parvalue::AbstractString)
Sets the value of a named string parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)paramname
(AbstractString
) – Name of a parameter. (input)parvalue
(AbstractString
) – Parameter value. (input)
- Groups:
- putobjname¶
function putobjname(task::MSKtask, objname::AbstractString)
Assigns a new name to the objective.
- Parameters:
task
(MSKtask
) – An optimization task. (input)objname
(AbstractString
) – Name of the objective. (input)
- Groups:
- putobjsense¶
function putobjsense(task::MSKtask, sense::Objsense)
Sets the objective sense of the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)sense
(Objsense
) – The objective sense of the task. The valuesMSK_OBJECTIVE_SENSE_MAXIMIZE
andMSK_OBJECTIVE_SENSE_MINIMIZE
mean that the problem is maximized or minimized respectively. (input)
- Groups:
- putoptserverhost¶
function putoptserverhost(task::MSKtask, host::Union{Nothing,AbstractString})
Specify an OptServer URL for remote calls. The URL should contain protocol, host and port in the form
http://server:port
orhttps://server:port
. If the URL is set using this function, all subsequent calls to any MOSEK function that involves synchronous optimization will be sent to the specified OptServer instead of being executed locally. Passingnothing
or empty string deactivates this redirection.Has the same effect as setting the parameter
MSK_SPAR_REMOTE_OPTSERVER_HOST
.- Parameters:
task
(MSKtask
) – An optimization task. (input)host
(AbstractString
) – A URL specifying the optimization server to be used. (input)
- Groups:
- putparam¶
function putparam(task::MSKtask, parname::AbstractString, parvalue::AbstractString)
Checks if
parname
is valid parameter name. If it is, the parameter is assigned the value specified byparvalue
.- Parameters:
task
(MSKtask
) – An optimization task. (input)parname
(AbstractString
) – Parameter name. (input)parvalue
(AbstractString
) – Parameter value. (input)
- Groups:
- putqcon¶
function putqcon(task::MSKtask, qcsubk::Vector{Int32}, qcsubi::Vector{Int32}, qcsubj::Vector{Int32}, qcval::Vector{Float64}) function putqcon(task::MSKtask, qcsubk::T0, qcsubi::T1, qcsubj::T2, qcval::T3) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
Replace all quadratic entries in the constraints. The list of constraints has the form
\[l_k^c \leq \half \sum_{i=\idxbeg}^{\idxend{\mathtt{numvar}}} \sum_{j=\idxbeg}^{\idxend{\mathtt{numvar}}} q_{ij}^k x_i x_j + \sum_{j=\idxbeg}^{\idxend{\mathtt{numvar}}} a_{kj} x_j \leq u_k^c, ~\ k=\idxbeg,\ldots,\idxend{m}.\]This function sets all the quadratic terms to zero and then performs the update:
\[q_{\mathtt{qcsubi[t]},\mathtt{qcsubj[t]}}^{\mathtt{qcsubk[t]}} = q_{\mathtt{\mathtt{qcsubj[t]},qcsubi[t]}}^{\mathtt{qcsubk[t]}} = q_{\mathtt{\mathtt{qcsubj[t]},qcsubi[t]}}^{\mathtt{qcsubk[t]}} + \mathtt{qcval[t]},\]for \(t=\idxbeg,\ldots,\idxend{\mathtt{numqcnz}}\).
Please note that:
For large problems it is essential for the efficiency that the function
putmaxnumqnz
is employed to pre-allocate space.Only the lower triangular parts should be specified because the \(Q\) matrices are symmetric. Specifying entries where \(i < j\) will result in an error.
Only non-zero elements should be specified.
The order in which the non-zero elements are specified is insignificant.
Duplicate elements are added together as shown above. Hence, it is usually not recommended to specify the same entry multiple times.
For a code example see Section Quadratic Optimization
- Parameters:
task
(MSKtask
) – An optimization task. (input)qcsubk
(Int32
[]
) – Constraint subscripts for quadratic coefficients. (input)qcsubi
(Int32
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(Int32
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(Float64
[]
) – Quadratic constraint coefficient values. (input)
- Groups:
- putqconk¶
function putqconk(task::MSKtask, k::Int32, qcsubi::Vector{Int32}, qcsubj::Vector{Int32}, qcval::Vector{Float64}) function putqconk(task::MSKtask, k::T0, qcsubi::T1, qcsubj::T2, qcval::T3) where { T0<:Integer, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} } function putqconk(task::MSKtask, k::T0, Qk:: SparseMatrixCSC{Float64}) where { T0<:Integer }
Replaces all the quadratic entries in one constraint. This function performs the same operations as
putqcon
but only with respect to constraint numberk
and it does not modify the other constraints. See the description ofputqcon
for definitions and important remarks.- Parameters:
task
(MSKtask
) – An optimization task. (input)k
(Int32
) – The constraint in which the new \(Q\) elements are inserted. (input)qcsubi
(Int32
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(Int32
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(Float64
[]
) – Quadratic constraint coefficient values. (input)Qk
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putqobj¶
function putqobj(task::MSKtask, qosubi::Vector{Int32}, qosubj::Vector{Int32}, qoval::Vector{Float64}) function putqobj(task::MSKtask, qosubi::T0, qosubj::T1, qoval::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Number} } function putqobj(task::MSKtask, Qk:: SparseMatrixCSC{Float64})
Replace all quadratic terms in the objective. If the objective has the form
\[\half \sum_{i=\idxbeg}^{\idxend{\mathtt{numvar}}} \sum_{j=\idxbeg}^{\idxend{\mathtt{numvar}}} q_{ij}^o x_i x_j + \sum_{j=\idxbeg}^{\idxend{\mathtt{numvar}}} c_{j} x_j + c^f\]then this function sets all the quadratic terms to zero and then performs the update:
\[q_{\mathtt{qosubi[t]},\mathtt{qosubj[t]}}^{o} = q_{\mathtt{\mathtt{qosubj[t]},qosubi[t]}}^{o} = q_{\mathtt{\mathtt{qosubj[t]},qosubi[t]}}^{o} + \mathtt{qoval[t]},\]for \(t=\idxbeg,\ldots,\idxend{\mathtt{numqonz}}\).
See the description of
putqcon
for important remarks and example.- Parameters:
task
(MSKtask
) – An optimization task. (input)qosubi
(Int32
[]
) – Row subscripts for quadratic objective coefficients. (input)qosubj
(Int32
[]
) – Column subscripts for quadratic objective coefficients. (input)qoval
(Float64
[]
) – Quadratic objective coefficient values. (input)Qk
(SparseMatrixCSC{Float64}
) – Sparse matrix defining the column values (input)
- Groups:
- putqobjij¶
function putqobjij(task::MSKtask, i::Int32, j::Int32, qoij::Float64) function putqobjij(task::MSKtask, i::T0, j::T1, qoij::T2) where { T0<:Integer, T1<:Integer, T2<:Number }
Replaces one coefficient in the quadratic term in the objective. The function performs the assignment
\[q_{ij}^o = q_{ji}^o = \mathtt{qoij}.\]Only the elements in the lower triangular part are accepted. Setting \(q_{ij}\) with \(j>i\) will cause an error.
Please note that replacing all quadratic elements one by one is more computationally expensive than replacing them all at once. Use
putqobj
instead whenever possible.- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Row index for the coefficient to be replaced. (input)j
(Int32
) – Column index for the coefficient to be replaced. (input)qoij
(Float64
) – The new value for \(q_{ij}^o\). (input)
- Groups:
- putskc¶
function putskc(task::MSKtask, whichsol::Soltype, skc::Vector{Stakey})
Sets the status keys for the constraints.
- Parameters:
- Groups:
- putskcslice¶
function putskcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, skc::Vector{Stakey}) function putskcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, skc::Vector{Stakey}) where { T0<:Integer, T1<:Integer }
Sets the status keys for a slice of the constraints.
- Parameters:
- Groups:
- putskx¶
function putskx(task::MSKtask, whichsol::Soltype, skx::Vector{Stakey})
Sets the status keys for the scalar variables.
- Parameters:
- Groups:
- putskxslice¶
function putskxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, skx::Vector{Stakey}) function putskxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, skx::Vector{Stakey}) where { T0<:Integer, T1<:Integer }
Sets the status keys for a slice of the variables.
- Parameters:
- Groups:
- putslc¶
function putslc(task::MSKtask, whichsol::Soltype, slc::Vector{Float64}) function putslc(task::MSKtask, whichsol::Soltype, slc::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(s_l^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups:
- putslcslice¶
function putslcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, slc::Vector{Float64}) function putslcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, slc::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(s_l^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups:
- putslx¶
function putslx(task::MSKtask, whichsol::Soltype, slx::Vector{Float64}) function putslx(task::MSKtask, whichsol::Soltype, slx::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(s_l^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups:
- putslxslice¶
function putslxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, slx::Vector{Float64}) function putslxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, slx::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(s_l^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups:
- putsnx¶
function putsnx(task::MSKtask, whichsol::Soltype, sux::Vector{Float64}) function putsnx(task::MSKtask, whichsol::Soltype, sux::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(s_n^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups:
- putsnxslice¶
function putsnxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, snx::Vector{Float64}) function putsnxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, snx::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(s_n^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups:
- putsolution¶
function putsolution(task::MSKtask, whichsol::Soltype, skc::Vector{Stakey}, skx::Vector{Stakey}, skn::Vector{Stakey}, xc::Union{Nothing,Vector{Float64}}, xx::Union{Nothing,Vector{Float64}}, y::Union{Nothing,Vector{Float64}}, slc::Union{Nothing,Vector{Float64}}, suc::Union{Nothing,Vector{Float64}}, slx::Union{Nothing,Vector{Float64}}, sux::Union{Nothing,Vector{Float64}}, snx::Union{Nothing,Vector{Float64}}) function putsolution(task::MSKtask, whichsol::Soltype, skc::Vector{Stakey}, skx::Vector{Stakey}, skn::Vector{Stakey}, xc::T0, xx::T1, y::T2, slc::T3, suc::T4, slx::T5, sux::T6, snx::T7) where { T0<:AbstractVector{<:Number}, T1<:AbstractVector{<:Number}, T2<:AbstractVector{<:Number}, T3<:AbstractVector{<:Number}, T4<:AbstractVector{<:Number}, T5<:AbstractVector{<:Number}, T6<:AbstractVector{<:Number}, T7<:AbstractVector{<:Number} }
Inserts a solution into the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)skc
(Stakey
[]
) – Status keys for the constraints. (input)skx
(Stakey
[]
) – Status keys for the variables. (input)skn
(Stakey
[]
) – Status keys for the conic constraints. (input)xc
(Float64
[]
) – Primal constraint solution. (input)xx
(Float64
[]
) – Primal variable solution. (input)y
(Float64
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups:
- putsolutionnew¶
function putsolutionnew(task::MSKtask, whichsol::Soltype, skc::Vector{Stakey}, skx::Vector{Stakey}, skn::Vector{Stakey}, xc::Union{Nothing,Vector{Float64}}, xx::Union{Nothing,Vector{Float64}}, y::Union{Nothing,Vector{Float64}}, slc::Union{Nothing,Vector{Float64}}, suc::Union{Nothing,Vector{Float64}}, slx::Union{Nothing,Vector{Float64}}, sux::Union{Nothing,Vector{Float64}}, snx::Union{Nothing,Vector{Float64}}, doty::Union{Nothing,Vector{Float64}}) function putsolutionnew(task::MSKtask, whichsol::Soltype, skc::Vector{Stakey}, skx::Vector{Stakey}, skn::Vector{Stakey}, xc::T0, xx::T1, y::T2, slc::T3, suc::T4, slx::T5, sux::T6, snx::T7, doty::T8) where { T0<:AbstractVector{<:Number}, T1<:AbstractVector{<:Number}, T2<:AbstractVector{<:Number}, T3<:AbstractVector{<:Number}, T4<:AbstractVector{<:Number}, T5<:AbstractVector{<:Number}, T6<:AbstractVector{<:Number}, T7<:AbstractVector{<:Number}, T8<:AbstractVector{<:Number} }
Inserts a solution into the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)skc
(Stakey
[]
) – Status keys for the constraints. (input)skx
(Stakey
[]
) – Status keys for the variables. (input)skn
(Stakey
[]
) – Status keys for the conic constraints. (input)xc
(Float64
[]
) – Primal constraint solution. (input)xx
(Float64
[]
) – Primal variable solution. (input)y
(Float64
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(Float64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(Float64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(Float64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)doty
(Float64
[]
) – Dual variables corresponding to affine conic constraints. (input)
- Groups:
- putsolutionyi¶
function putsolutionyi(task::MSKtask, i::Int32, whichsol::Soltype, y::Float64) function putsolutionyi(task::MSKtask, i::T0, whichsol::Soltype, y::T1) where { T0<:Integer, T1<:Number }
Inputs the dual variable of a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)i
(Int32
) – Index of the dual variable. (input)whichsol
(Soltype
) – Selects a solution. (input)y
(Float64
) – Solution value of the dual variable. (input)
- Groups:
- putstreamfunc¶
function putstreamfunc(task::MSKtask, whichstream::Streamtype, f::Function)
Directs all output from a task stream to a stream callback function. The function should accept a string.
Can for example be called as:
putstreamfunc(task, MSK_STREAM_LOG, msg -> print(msg))
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(streamtype
) – Index of the stream. (input)f
(Function
) – The stream handler function. (input)
- Groups:
- putstrparam¶
function putstrparam(task::MSKtask, param::Sparam, parvalue::AbstractString)
Sets the value of a string parameter.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Sparam
) – Which parameter. (input)parvalue
(AbstractString
) – Parameter value. (input)
- Groups:
- putsuc¶
function putsuc(task::MSKtask, whichsol::Soltype, suc::Vector{Float64}) function putsuc(task::MSKtask, whichsol::Soltype, suc::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(s_u^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups:
- putsucslice¶
function putsucslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, suc::Vector{Float64}) function putsucslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, suc::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(s_u^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)suc
(Float64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups:
- putsux¶
function putsux(task::MSKtask, whichsol::Soltype, sux::Vector{Float64}) function putsux(task::MSKtask, whichsol::Soltype, sux::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(s_u^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups:
- putsuxslice¶
function putsuxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, sux::Vector{Float64}) function putsuxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, sux::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(s_u^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)sux
(Float64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups:
- puttaskname¶
function puttaskname(task::MSKtask, taskname::AbstractString)
Assigns a new name to the task.
- Parameters:
task
(MSKtask
) – An optimization task. (input)taskname
(AbstractString
) – Name assigned to the task. (input)
- Groups:
- putvarbound¶
function putvarbound(task::MSKtask, j::Int32, bkx::Boundkey, blx::Float64, bux::Float64) function putvarbound(task::MSKtask, j::T0, bkx::Boundkey, blx::T1, bux::T2) where { T0<:Integer, T1<:Number, T2<:Number }
Changes the bounds for one variable.
If the bound value specified is numerically larger than
MSK_DPAR_DATA_TOL_BOUND_INF
it is considered infinite and the bound key is changed accordingly. If a bound value is numerically larger thanMSK_DPAR_DATA_TOL_BOUND_WRN
, a warning will be displayed, but the bound is inputted as specified.- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)bkx
(Boundkey
) – New bound key. (input)blx
(Float64
) – New lower bound. (input)bux
(Float64
) – New upper bound. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - bounds
- putvarboundlist¶
function putvarboundlist(task::MSKtask, sub::Vector{Int32}, bkx::Vector{Boundkey}, blx::Vector{Float64}, bux::Vector{Float64}) function putvarboundlist(task::MSKtask, sub::T0, bkx::Vector{Boundkey}, blx::T1, bux::T2) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Number}, T2<:AbstractVector{<:Number} }
Changes the bounds for one or more variables. If multiple bound changes are specified for a variable, then only the last change takes effect. Data checks are performed as in
putvarbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – List of variable indexes. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(Float64
[]
) – Lower bounds for the variables. (input)bux
(Float64
[]
) – Upper bounds for the variables. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - bounds
- putvarboundlistconst¶
function putvarboundlistconst(task::MSKtask, sub::Vector{Int32}, bkx::Boundkey, blx::Float64, bux::Float64) function putvarboundlistconst(task::MSKtask, sub::T0, bkx::Boundkey, blx::T1, bux::T2) where { T0<:AbstractVector{<:Integer}, T1<:Number, T2<:Number }
Changes the bounds for one or more variables. Data checks are performed as in
putvarbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)sub
(Int32
[]
) – List of variable indexes. (input)bkx
(Boundkey
) – New bound key for all variables in the list. (input)blx
(Float64
) – New lower bound for all variables in the list. (input)bux
(Float64
) – New upper bound for all variables in the list. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - bounds
- putvarboundslice¶
function putvarboundslice(task::MSKtask, first::Int32, last::Int32, bkx::Vector{Boundkey}, blx::Vector{Float64}, bux::Vector{Float64}) function putvarboundslice(task::MSKtask, first::T0, last::T1, bkx::Vector{Boundkey}, blx::T2, bux::T3) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number}, T3<:AbstractVector{<:Number} }
Changes the bounds for a slice of the variables. Data checks are performed as in
putvarbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(Float64
[]
) – Lower bounds for the variables. (input)bux
(Float64
[]
) – Upper bounds for the variables. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - bounds
- putvarboundsliceconst¶
function putvarboundsliceconst(task::MSKtask, first::Int32, last::Int32, bkx::Boundkey, blx::Float64, bux::Float64) function putvarboundsliceconst(task::MSKtask, first::T0, last::T1, bkx::Boundkey, blx::T2, bux::T3) where { T0<:Integer, T1<:Integer, T2<:Number, T3<:Number }
Changes the bounds for a slice of the variables. Data checks are performed as in
putvarbound
.- Parameters:
task
(MSKtask
) – An optimization task. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)bkx
(Boundkey
) – New bound key for all variables in the slice. (input)blx
(Float64
) – New lower bound for all variables in the slice. (input)bux
(Float64
) – New upper bound for all variables in the slice. (input)
- Groups:
Problem data - linear part, Problem data - variables, Problem data - bounds
- putvarname¶
function putvarname(task::MSKtask, j::Int32, name::Union{Nothing,AbstractString}) function putvarname(task::MSKtask, j::T0, name::Union{Nothing,AbstractString}) where { T0<:Integer }
Sets the name of a variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)name
(AbstractString
) – The variable name. (input)
- Groups:
- putvarsolutionj¶
function putvarsolutionj(task::MSKtask, j::Int32, whichsol::Soltype, sk::Stakey, x::Float64, sl::Float64, su::Float64, sn::Float64) function putvarsolutionj(task::MSKtask, j::T0, whichsol::Soltype, sk::Stakey, x::T1, sl::T2, su::T3, sn::T4) where { T0<:Integer, T1<:Number, T2<:Number, T3<:Number, T4<:Number }
Sets the primal and dual solution information for a single variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)whichsol
(Soltype
) – Selects a solution. (input)sk
(Stakey
) – Status key of the variable. (input)x
(Float64
) – Primal solution value of the variable. (input)sl
(Float64
) – Solution value of the dual variable associated with the lower bound. (input)su
(Float64
) – Solution value of the dual variable associated with the upper bound. (input)sn
(Float64
) – Solution value of the dual variable associated with the conic constraint. (input)
- Groups:
- putvartype¶
function putvartype(task::MSKtask, j::Int32, vartype::Variabletype) function putvartype(task::MSKtask, j::T0, vartype::Variabletype) where { T0<:Integer }
Sets the variable type of one variable.
- Parameters:
task
(MSKtask
) – An optimization task. (input)j
(Int32
) – Index of the variable. (input)vartype
(Variabletype
) – The new variable type. (input)
- Groups:
- putvartypelist¶
function putvartypelist(task::MSKtask, subj::Vector{Int32}, vartype::Vector{Variabletype}) function putvartypelist(task::MSKtask, subj::T0, vartype::Vector{Variabletype}) where { T0<:AbstractVector{<:Integer} }
Sets the variable type for one or more variables. If the same index is specified multiple times in
subj
only the last entry takes effect.- Parameters:
task
(MSKtask
) – An optimization task. (input)subj
(Int32
[]
) – A list of variable indexes for which the variable type should be changed. (input)vartype
(Variabletype
[]
) – A list of variable types that should be assigned to the variables specified bysubj
. (input)
- Groups:
- putxc¶
function putxc(task::MSKtask, whichsol::Soltype) -> xc :: Vector{Float64}
Sets the \(x^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
xc
(Float64
[]
) – Primal constraint solution.- Groups:
- putxcslice¶
function putxcslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, xc::Vector{Float64}) function putxcslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, xc::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(x^c\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)xc
(Float64
[]
) – Primal constraint solution. (input)
- Groups:
- putxx¶
function putxx(task::MSKtask, whichsol::Soltype, xx::Vector{Float64}) function putxx(task::MSKtask, whichsol::Soltype, xx::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(x^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)xx
(Float64
[]
) – Primal variable solution. (input)
- Groups:
- putxxslice¶
function putxxslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, xx::Vector{Float64}) function putxxslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, xx::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(x^x\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)xx
(Float64
[]
) – Primal variable solution. (input)
- Groups:
- puty¶
function puty(task::MSKtask, whichsol::Soltype, y::Vector{Float64}) function puty(task::MSKtask, whichsol::Soltype, y::T0) where { T0<:AbstractVector{<:Number} }
Sets the \(y\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)y
(Float64
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups:
- putyslice¶
function putyslice(task::MSKtask, whichsol::Soltype, first::Int32, last::Int32, y::Vector{Float64}) function putyslice(task::MSKtask, whichsol::Soltype, first::T0, last::T1, y::T2) where { T0<:Integer, T1<:Integer, T2<:AbstractVector{<:Number} }
Sets a slice of the \(y\) vector for a solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)first
(Int32
) – First index in the sequence. (input)last
(Int32
) – Last index plus 1 in the sequence. (input)y
(Float64
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups:
- readbsolution¶
function readbsolution(task::MSKtask, filename::AbstractString, compress::Compresstype)
Read a binary dump of the task solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)compress
(Compresstype
) – Data compression type. (input)
- Groups:
- readdata¶
function readdata(task::MSKtask, filename::AbstractString)
Reads an optimization problem and associated data from a file.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- readdataformat¶
function readdataformat(task::MSKtask, filename::AbstractString, format::Dataformat, compress::Compresstype)
Reads an optimization problem and associated data from a file.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)format
(Dataformat
) – File data format. (input)compress
(Compresstype
) – File compression type. (input)
- Groups:
- readjsonsol¶
function readjsonsol(task::MSKtask, filename::AbstractString)
Reads a solution file in JSON format (JSOL file) and inserts it in the task. Only the section
Task/solutions
is taken into consideration.- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- readjsonstring¶
function readjsonstring(task::MSKtask, data::AbstractString)
Load task data from a JSON string, replacing any data that already exists in the task object. All problem data, parameters and other settings are resorted, but if the string contains solutions, the solution status after loading a file is set to unknown, even if it is optimal or otherwise well-defined.
- Parameters:
task
(MSKtask
) – An optimization task. (input)data
(AbstractString
) – Problem data in text format. (input)
- Groups:
- readlpstring¶
function readlpstring(task::MSKtask, data::AbstractString)
Load task data from a string in LP format, replacing any data that already exists in the task object.
- Parameters:
task
(MSKtask
) – An optimization task. (input)data
(AbstractString
) – Problem data in text format. (input)
- Groups:
- readopfstring¶
function readopfstring(task::MSKtask, data::AbstractString)
Load task data from a string in OPF format, replacing any data that already exists in the task object.
- Parameters:
task
(MSKtask
) – An optimization task. (input)data
(AbstractString
) – Problem data in text format. (input)
- Groups:
- readparamfile¶
function readparamfile(task::MSKtask, filename::AbstractString)
Reads MOSEK parameters from a file. Data is read from the file
filename
if it is a nonempty string. Otherwise data is read from the file specified byMSK_SPAR_PARAM_READ_FILE_NAME
.The parameter file must begin with
BEGIN MOSEK
and end withEND MOSEK
; empty lines and lines starting from a%
sign are ignored; each remaining line contains a valid MOSEK parameter name followed by its value (using generic names as in the command-line tool syntax). Example:BEGIN MOSEK % This is a comment. MSK_IPAR_PRESOLVE_USE MSK_OFF MSK_DPAR_INTPNT_TOL_PFEAS 1.0e-9 END MOSEK
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- readptfstring¶
function readptfstring(task::MSKtask, data::AbstractString)
Load task data from a PTF string, replacing any data that already exists in the task object. All problem data, parameters and other settings are resorted, but if the string contains solutions, the solution status after loading a file is set to unknown, even if it is optimal or otherwise well-defined.
- Parameters:
task
(MSKtask
) – An optimization task. (input)data
(AbstractString
) – Problem data in text format. (input)
- Groups:
- readsolution¶
function readsolution(task::MSKtask, whichsol::Soltype, filename::AbstractString)
Reads a solution file and inserts it as a specified solution in the task. Data is read from the file
filename
if it is a nonempty string. Otherwise data is read from one of the files specified byMSK_SPAR_BAS_SOL_FILE_NAME
,MSK_SPAR_ITR_SOL_FILE_NAME
orMSK_SPAR_INT_SOL_FILE_NAME
depending on which solution is chosen.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- readsolutionfile¶
function readsolutionfile(task::MSKtask, filename::AbstractString)
Read solution file in format determined by the filename
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- readsummary¶
function readsummary(task::MSKtask, whichstream::Streamtype)
Prints a short summary of last file that was read.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)
- Groups:
- readtask¶
function readtask(task::MSKtask, filename::AbstractString)
Load task data from a file, replacing any data that already exists in the task object. All problem data, parameters and other settings are resorted, but if the file contains solutions, the solution status after loading a file is set to unknown, even if it was optimal or otherwise well-defined when the file was dumped.
See section The Task Format for a description of the Task format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- removebarvars¶
function removebarvars(task::MSKtask, subset::Vector{Int32}) function removebarvars(task::MSKtask, subset::T0) where { T0<:AbstractVector{<:Integer} }
The function removes a subset of the symmetric matrices from the optimization task. This implies that the remaining symmetric matrices are renumbered.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subset
(Int32
[]
) – Indexes of symmetric matrices which should be removed. (input)
- Groups:
- removecones Deprecated¶
function removecones(task::MSKtask, subset::Vector{Int32}) function removecones(task::MSKtask, subset::T0) where { T0<:AbstractVector{<:Integer} }
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Removes a number of conic constraints from the problem. This implies that the remaining conic constraints are renumbered. In general, it is much more efficient to remove a cone with a high index than a low index.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subset
(Int32
[]
) – Indexes of cones which should be removed. (input)
- Groups:
- removecons¶
function removecons(task::MSKtask, subset::Vector{Int32}) function removecons(task::MSKtask, subset::T0) where { T0<:AbstractVector{<:Integer} }
The function removes a subset of the constraints from the optimization task. This implies that the remaining constraints are renumbered.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subset
(Int32
[]
) – Indexes of constraints which should be removed. (input)
- Groups:
- removevars¶
function removevars(task::MSKtask, subset::Vector{Int32}) function removevars(task::MSKtask, subset::T0) where { T0<:AbstractVector{<:Integer} }
The function removes a subset of the variables from the optimization task. This implies that the remaining variables are renumbered.
- Parameters:
task
(MSKtask
) – An optimization task. (input)subset
(Int32
[]
) – Indexes of variables which should be removed. (input)
- Groups:
- rescodetostr¶
function rescodetostr(res::Rescode) -> str :: String
Obtains an identifier string corresponding to a response code.
- resetdouparam¶
function resetdouparam(task::MSKtask, param::Dparam)
Resets a double parameter to its default value.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Dparam
) – Which parameter. (input)
- Groups:
- resetexpirylicenses¶
function resetexpirylicenses(env::MSKenv) function resetexpirylicenses()
Reset the license expiry reporting startpoint.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)- Groups:
- resetintparam¶
function resetintparam(task::MSKtask, param::Iparam)
Resets an integer parameter to its default value.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Iparam
) – Which parameter. (input)
- Groups:
- resetparameters¶
function resetparameters(task::MSKtask)
Resets all the parameters to their default values.
- Parameters:
task
(MSKtask
) – An optimization task. (input)- Groups:
- resetstrparam¶
function resetstrparam(task::MSKtask, param::Sparam)
Resets a string parameter to its defalt value.
- Parameters:
task
(MSKtask
) – An optimization task. (input)param
(Sparam
) – Which parameter. (input)
- Groups:
- resizetask¶
function resizetask(task::MSKtask, maxnumcon::Int32, maxnumvar::Int32, maxnumcone::Int32, maxnumanz::Int64, maxnumqnz::Int64) function resizetask(task::MSKtask, maxnumcon::T0, maxnumvar::T1, maxnumcone::T2, maxnumanz::T3, maxnumqnz::T4) where { T0<:Integer, T1<:Integer, T2<:Integer, T3<:Integer, T4<:Integer }
Sets the amount of preallocated space assigned for each type of data in an optimization task.
It is never mandatory to call this function, since it only gives a hint about the amount of data to preallocate for efficiency reasons.
Please note that the procedure is destructive in the sense that all existing data stored in the task is destroyed.
- Parameters:
task
(MSKtask
) – An optimization task. (input)maxnumcon
(Int32
) – New maximum number of constraints. (input)maxnumvar
(Int32
) – New maximum number of variables. (input)maxnumcone
(Int32
) – New maximum number of cones. (input)maxnumanz
(Int64
) – New maximum number of non-zeros in \(A\). (input)maxnumqnz
(Int64
) – New maximum number of non-zeros in all \(Q\) matrices. (input)
- Groups:
- sensitivityreport¶
function sensitivityreport(task::MSKtask, whichstream::Streamtype)
Reads a sensitivity format file from a location given by
MSK_SPAR_SENSITIVITY_FILE_NAME
and writes the result to the streamwhichstream
. IfMSK_SPAR_SENSITIVITY_RES_FILE_NAME
is set to a non-empty string, then the sensitivity report is also written to a file of this name.- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)
- Groups:
- solutiondef¶
function solutiondef(task::MSKtask, whichsol::Soltype) -> isdef :: Bool
Checks whether a solution is defined.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Return:
isdef
(Bool
) – Is non-zero if the requested solution is defined.- Groups:
- solutionsummary¶
function solutionsummary(task::MSKtask, whichstream::Streamtype)
Prints a short summary of the current solutions.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichstream
(Streamtype
) – Index of the stream. (input)
- Groups:
- solvewithbasis¶
function solvewithbasis(task::MSKtask, transp::Bool, numnz::Int32, sub::Vector{Int32}, val::Vector{Float64}) -> numnzout :: Int32 function solvewithbasis(task::MSKtask, transp::Bool, numnz::T0, sub::Vector{Int32}, val::Vector{Float64}) where { T0<:Integer } -> numnzout :: Int32
If a basic solution is available, then exactly \(numcon\) basis variables are defined. These \(numcon\) basis variables are denoted the basis. Associated with the basis is a basis matrix denoted \(B\). This function solves either the linear equation system
(15.3)¶\[B \barX = b\]or the system
(15.4)¶\[B^T \barX = b\]for the unknowns \(\barX\), with \(b\) being a user-defined vector. In order to make sense of the solution \(\barX\) it is important to know the ordering of the variables in the basis because the ordering specifies how \(B\) is constructed. When calling
initbasissolve
an ordering of the basis variables is obtained, which can be used to deduce how MOSEK has constructed \(B\). Indeed if the \(k\)-th basis variable is variable \(x_j\) it implies that\[B_{i,k} = A_{i,j}, ~i=\idxbeg,\ldots,\idxend{\mathtt{numcon}}.\]Otherwise if the \(k\)-th basis variable is variable \(x_j^c\) it implies that
\[\begin{split}B_{i,k} = \left\{ \begin{array}{ll} -1, & i = j, \\ 0 , & i \neq j. \\ \end{array} \right.\end{split}\]The function
initbasissolve
must be called before a call to this function. Please note that this function exploits the sparsity in the vector \(b\) to speed up the computations.- Parameters:
task
(MSKtask
) – An optimization task. (input)transp
(Bool
) – If this argument is zero, then (15.3) is solved, if non-zero then (15.4) is solved. (input)numnz
(Int32
) – The number of non-zeros in \(b\). (input)sub
(Int32
[]
) – As input it contains the positions of non-zeros in \(b\). As output it contains the positions of the non-zeros in \(\barX\). It must have room for \(numcon\) elements. (input/output)val
(Float64
[]
) – As input it is the vector \(b\) as a dense vector (although the positions of non-zeros are specified insub
it is required that \(\mathtt{val}[i] = 0\) when \(b[i] = 0\)). As outputval
is the vector \(\barX\) as a dense vector. It must have length \(numcon\). (input/output)
- Return:
numnzout
(Int32
) – The number of non-zeros in \(\barX\).- Groups:
- sparsetriangularsolvedense¶
function sparsetriangularsolvedense(env::MSKenv, transposed::Transpose, lnzc::Vector{Int32}, lptrc::Vector{Int64}, lsubc::Vector{Int32}, lvalc::Vector{Float64}, b::Vector{Float64}) function sparsetriangularsolvedense(env::MSKenv, transposed::Transpose, lnzc::T0, lptrc::T1, lsubc::T2, lvalc::T3, b::Vector{Float64}) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} } function sparsetriangularsolvedense(transposed::Transpose, lnzc::Vector{Int32}, lptrc::Vector{Int64}, lsubc::Vector{Int32}, lvalc::Vector{Float64}, b::Vector{Float64}) function sparsetriangularsolvedense(transposed::Transpose, lnzc::T0, lptrc::T1, lsubc::T2, lvalc::T3, b::Vector{Float64}) where { T0<:AbstractVector{<:Integer}, T1<:AbstractVector{<:Integer}, T2<:AbstractVector{<:Integer}, T3<:AbstractVector{<:Number} }
The function solves a triangular system of the form
\[L x = b\]or
\[L^T x = b\]where \(L\) is a sparse lower triangular nonsingular matrix. This implies in particular that diagonals in \(L\) are nonzero.
- Parameters:
env
(MSKenv
) – The MOSEK environment. (input)transposed
(Transpose
) – Controls whether to use with \(L\) or \(L^T\). (input)lnzc
(Int32
[]
) –lnzc[j]
is the number of nonzeros in columnj
. (input)lptrc
(Int64
[]
) –lptrc[j]
is a pointer to the first row index and value in columnj
. (input)lsubc
(Int32
[]
) – Row indexes for each column stored sequentially. Must be stored in increasing order for each column. (input)lvalc
(Float64
[]
) – The value corresponding to the row index stored inlsubc
. (input)b
(Float64
[]
) – The right-hand side of linear equation system to be solved as a dense vector. (input/output)
- Groups:
- strtoconetype Deprecated¶
function strtoconetype(task::MSKtask, str::AbstractString) -> conetype :: Conetype
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Obtains cone type code corresponding to a cone type string.
- strtosk¶
function strtosk(task::MSKtask, str::AbstractString) -> sk :: Stakey
Obtains the status key corresponding to an abbreviation string.
- updatesolutioninfo¶
function updatesolutioninfo(task::MSKtask, whichsol::Soltype)
Update the information items related to the solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups:
- writebsolution¶
function writebsolution(task::MSKtask, filename::AbstractString, compress::Compresstype)
Write a binary dump of the task solution.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)compress
(Compresstype
) – Data compression type. (input)
- Groups:
- writedata¶
function writedata(task::MSKtask, filename::AbstractString)
Writes problem data associated with the optimization task to a file in one of the supported formats. See Section Supported File Formats for the complete list.
The data file format is determined by the file name extension. To write in compressed format append the extension
.gz
. E.g to write a gzip compressed MPS file use the extensionmps.gz
.Please note that MPS, LP and OPF files require all variables to have unique names. If a task contains no names, it is possible to write the file with automatically generated anonymous names by setting the
MSK_IPAR_WRITE_GENERIC_NAMES
parameter toMSK_ON
.Data is written to the file
filename
if it is a nonempty string. Otherwise data is written to the file specified byMSK_SPAR_DATA_FILE_NAME
.- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- writedatastream¶
function writedatastream(task::Task, format::Dataformat, compress::Compresstype, stream::OutputStream)
Writes problem data associated with the optimization task to a stream in one of the supported formats.
Example:
writedatastream(task,MSK_DATA_FORMAT_TASK, MSK_COMPRESS_NONE, open("outfile.task", "w")) writedatastream(task,MSK_DATA_FORMAT_PTF, MSK_COMPRESS_NONE, stdout)
- Parameters:
task
(MSKtask
) – An optimization task. (input)format
(mosek.dataformat
) – Data format. (input)compress
(mosek.compresstype
) – Selects compression type. (input)stream
(OutputStream
) – The output stream. (input)
- Groups:
- writejsonsol¶
function writejsonsol(task::MSKtask, filename::AbstractString)
Saves the current solutions and solver information items in a JSON file. If the file name has the extensions .gz or .zst, then the file is gzip or Zstd compressed respectively.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- writeparamfile¶
function writeparamfile(task::MSKtask, filename::AbstractString)
Writes all the parameters to a parameter file.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- writesolution¶
function writesolution(task::MSKtask, whichsol::Soltype, filename::AbstractString)
Saves the current basic, interior-point, or integer solution to a file.
- Parameters:
task
(MSKtask
) – An optimization task. (input)whichsol
(Soltype
) – Selects a solution. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- writesolutionfile¶
function writesolutionfile(task::MSKtask, filename::AbstractString)
Write solution file in format determined by the filename
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups:
- writetask¶
function writetask(task::MSKtask, filename::AbstractString)
Write a binary dump of the task data. This format saves all problem data, coefficients and parameter settings. See section The Task Format for a description of the Task format.
- Parameters:
task
(MSKtask
) – An optimization task. (input)filename
(AbstractString
) – A valid file name. (input)
- Groups: