15.4 Class Task¶
- mosek.Task¶
Represents an optimization task.
- Task.Task¶
Task()
Task( int numcon, int numvar)
Task(mosek.Env env)
Task( mosek.Env env, int numcon, int numvar)
Task(mosek.Task task)
Constructor of a new optimization task.
- Task.analyzenames¶
public synchronized void analyzenames (streamtype whichstream, nametype nametype)
The function analyzes the names and issues an error if a name is invalid.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)nametype
(nametype
) – The type of names e.g. valid in MPS or LP files. (input)
- Groups
- Task.analyzeproblem¶
public synchronized void analyzeproblem(streamtype whichstream)
The function analyzes the data of a task and writes out a report.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)- Groups
- Task.analyzesolution¶
public synchronized void analyzesolution (streamtype whichstream, soltype whichsol)
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:
iparam.ana_sol_basis
enables or disables printing of statistics specific to the basis solution (condition number, number of basic variables etc.). Default is on.iparam.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.dparam.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
whichstream
(streamtype
) – Index of the stream. (input)whichsol
(soltype
) – Selects a solution. (input)
- Groups
- Task.appendacc¶
public synchronized void appendacc (long domidx, long[] afeidxlist, double[] b)
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
domidx
(long
) – Domain index. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.appendaccs¶
public synchronized void appendaccs (long[] domidxs, long[] afeidxlist, double[] b)
Appends
numaccs
affine conic constraint to the task. Each single affine conic constraint should be specified as inTask.appendacc
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
domidxs
(long
[]
) – Domain indices. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.appendaccseq¶
public synchronized void appendaccseq (long domidx, long afeidxfirst, double[] b)
Appends an affine conic constraint to the task, as in
Task.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
domidx
(long
) – Domain index. (input)afeidxfirst
(long
) – Index of the first affine expression. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.appendaccsseq¶
public synchronized void appendaccsseq (long[] domidxs, long numafeidx, long afeidxfirst, double[] b)
Appends
numaccs
affine conic constraint to the task. It is the block variant ofTask.appendaccs
, 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
domidxs
(long
[]
) – Domain indices. (input)numafeidx
(long
) – Number of affine expressions in the affine expression list (must equal the sum of dimensions of the domains). (input)afeidxfirst
(long
) – Index of the first affine expression. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.appendafes¶
public synchronized void appendafes(long num)
Appends a number of empty affine expressions to the task.
- Parameters
num
(long
) – Number of empty affine expressions which should be appended. (input)- Groups
- Task.appendbarvars¶
public synchronized void appendbarvars(int[] dim)
Appends positive semidefinite matrix variables of dimensions given by
dim
to the problem.- Parameters
dim
(int
[]
) – Dimensions of symmetric matrix variables to be added. (input)- Groups
- Task.appendcone Deprecated¶
public synchronized void appendcone (conetype ct, double conepar, int[] submem)
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 (
conetype.quad
, requires \(\mathtt{nummem}\geq 1\)):\[\hat{x}_0 \geq \sqrt{\sum_{i=1}^{i<\mathtt{nummem}} \hat{x}_i^2}\]Rotated quadratic cone (
conetype.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 (
conetype.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 (
conetype.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 (
conetype.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 (
conetype.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 (
conetype.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
ct
(conetype
) – Specifies the type of the cone. (input)conepar
(double
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(int
[]
) – Variable subscripts of the members in the cone. (input)
- Groups
- Task.appendconeseq Deprecated¶
public synchronized void appendconeseq (conetype ct, double conepar, int nummem, int j)
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
Task.appendcone
. The function assumes the members of cone are sequential where the first member has indexj
and the lastj+nummem-1
.- Parameters
ct
(conetype
) – Specifies the type of the cone. (input)conepar
(double
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(int
) – Number of member variables in the cone. (input)j
(int
) – Index of the first variable in the conic constraint. (input)
- Groups
- Task.appendconesseq Deprecated¶
public synchronized void appendconesseq (conetype[] ct, double[] conepar, int[] nummem, int j)
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
Task.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
ct
(conetype
[]
) – Specifies the type of the cone. (input)conepar
(double
[]
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(int
[]
) – Numbers of member variables in the cones. (input)j
(int
) – Index of the first variable in the first cone to be appended. (input)
- Groups
- Task.appendcons¶
public synchronized void appendcons(int num)
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
num
(int
) – Number of constraints which should be appended. (input)- Groups
- Task.appenddjcs¶
public synchronized void appenddjcs(long num)
Appends a number of empty disjunctive constraints to the task.
- Parameters
num
(long
) – Number of empty disjunctive constraints which should be appended. (input)- Groups
- Task.appenddualexpconedomain¶
public synchronized void appenddualexpconedomain(long[] domidx)
public synchronized long appenddualexpconedomain()
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
domidx
(long
by reference) – Index of the domain. (output)- Return
(
long
) – Index of the domain.- Groups
- Task.appenddualgeomeanconedomain¶
public synchronized void appenddualgeomeanconedomain (long n, long[] domidx)
public synchronized long appenddualgeomeanconedomain(long n)
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
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appenddualpowerconedomain¶
public synchronized void appenddualpowerconedomain (long n, double[] alpha, long[] domidx)
public synchronized long appenddualpowerconedomain (long n, double[] alpha)
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
n
(long
) – Dimension of the domain. (input)alpha
(double
[]
) – The sequence proportional to exponents. Must be positive. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendprimalexpconedomain¶
public synchronized void appendprimalexpconedomain(long[] domidx)
public synchronized long appendprimalexpconedomain()
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
domidx
(long
by reference) – Index of the domain. (output)- Return
(
long
) – Index of the domain.- Groups
- Task.appendprimalgeomeanconedomain¶
public synchronized void appendprimalgeomeanconedomain (long n, long[] domidx)
public synchronized long appendprimalgeomeanconedomain(long n)
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
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendprimalpowerconedomain¶
public synchronized void appendprimalpowerconedomain (long n, double[] alpha, long[] domidx)
public synchronized long appendprimalpowerconedomain (long n, double[] alpha)
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
n
(long
) – Dimension of the domain. (input)alpha
(double
[]
) – The sequence proportional to exponents. Must be positive. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendquadraticconedomain¶
public synchronized void appendquadraticconedomain (long n, long[] domidx)
public synchronized long appendquadraticconedomain(long n)
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
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendrdomain¶
public synchronized void appendrdomain (long n, long[] domidx)
public synchronized long appendrdomain(long n)
Appends the \(n\)-dimensional real space \(\{ x \in \real^n \}\) to the list of domains.
- Parameters
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendrminusdomain¶
public synchronized void appendrminusdomain (long n, long[] domidx)
public synchronized long appendrminusdomain(long n)
Appends the \(n\)-dimensional negative orthant \(\{ x \in \real^n: \, x \leq 0 \}\) to the list of domains.
- Parameters
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendrplusdomain¶
public synchronized void appendrplusdomain (long n, long[] domidx)
public synchronized long appendrplusdomain(long n)
Appends the \(n\)-dimensional positive orthant \(\{ x \in \real^n: \, x \geq 0 \}\) to the list of domains.
- Parameters
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendrquadraticconedomain¶
public synchronized void appendrquadraticconedomain (long n, long[] domidx)
public synchronized long appendrquadraticconedomain(long n)
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
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendrzerodomain¶
public synchronized void appendrzerodomain (long n, long[] domidx)
public synchronized long appendrzerodomain(long n)
Appends the zero in \(n\)-dimensional real space \(\{ x \in \real^n: \, x = 0 \}\) to the list of domains.
- Parameters
n
(long
) – Dimmension of the domain. (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendsparsesymmat¶
public synchronized void appendsparsesymmat (int dim, int[] subi, int[] subj, double[] valij, long[] idx)
public synchronized long appendsparsesymmat (int dim, int[] subi, int[] subj, double[] valij)
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
dim
(int
) – Dimension of the symmetric matrix that is appended. (input)subi
(int
[]
) – Row subscript in the triplets. (input)subj
(int
[]
) – Column subscripts in the triplets. (input)valij
(double
[]
) – Values of each triplet. (input)idx
(long
by reference) – Unique index assigned to the inputted matrix that can be used for later reference. (output)
- Return
(
long
) – Unique index assigned to the inputted matrix that can be used for later reference.- Groups
- Task.appendsparsesymmatlist¶
public synchronized void appendsparsesymmatlist (int[] dims, long[] nz, int[] subi, int[] subj, double[] valij, long[] idx)
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
dims
(int
[]
) – Dimensions of the symmetric matrixes. (input)nz
(long
[]
) – Number of nonzeros for each matrix. (input)subi
(int
[]
) – Row subscript in the triplets. (input)subj
(int
[]
) – Column subscripts in the triplets. (input)valij
(double
[]
) – Values of each triplet. (input)idx
(long
[]
) – Unique index assigned to the inputted matrix that can be used for later reference. (output)
- Groups
- Task.appendsvecpsdconedomain¶
public synchronized void appendsvecpsdconedomain (long n, long[] domidx)
public synchronized long appendsvecpsdconedomain(long n)
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
n
(long
) – Dimension of the domain, must be of the form \(d(d+1)/2\). (input)domidx
(long
by reference) – Index of the domain. (output)
- Return
(
long
) – Index of the domain.- Groups
- Task.appendvars¶
public synchronized void appendvars(int num)
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
num
(int
) – Number of variables which should be appended. (input)- Groups
- Task.asyncgetresult¶
public synchronized void asyncgetresult (String address, String accesstoken, String token, boolean[] respavailable, rescode[] resp, rescode[] trm)
public synchronized boolean asyncgetresult (String address, String accesstoken, String token, rescode[] resp, rescode[] trm)
Request a solution from a remote job identified by the argument
token
. For other arguments seeTask.asyncoptimize
. If the solution is available it will be retrieved and loaded into the local task.- Parameters
address
(String
) – Address of the OptServer. (input)accesstoken
(String
) – Access token. (input)token
(String
) – The task token. (input)respavailable
(boolean
by reference) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored. (output)resp
(mosek.rescode
by reference) – Is the response code from the remote solver. (output)trm
(mosek.rescode
by reference) – Is eitherrescode.ok
or a termination response code. (output)
- Return
(
boolean
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.- Groups
- Task.asyncoptimize¶
public synchronized String asyncoptimize (String address, String accesstoken)
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
sparam.remote_tls_cert
orsparam.remote_tls_cert_path
.The function returns a token which should be used in future calls to identify the task.
- Parameters
address
(String
) – Address of the OptServer. (input)accesstoken
(String
) – Access token. (input)
- Return
(
String
) – Returns the task token.- Groups
- Task.asyncpoll¶
public synchronized void asyncpoll (String address, String accesstoken, String token, boolean[] respavailable, rescode[] resp, rescode[] trm)
public synchronized boolean asyncpoll (String address, String accesstoken, String token, rescode[] resp, rescode[] trm)
Requests information about the status of the remote job identified by the argument
token
. For other arguments seeTask.asyncoptimize
.- Parameters
address
(String
) – Address of the OptServer. (input)accesstoken
(String
) – Access token. (input)token
(String
) – The task token. (input)respavailable
(boolean
by reference) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored. (output)resp
(mosek.rescode
by reference) – Is the response code from the remote solver. (output)trm
(mosek.rescode
by reference) – Is eitherrescode.ok
or a termination response code. (output)
- Return
(
boolean
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.- Groups
- Task.asyncstop¶
public synchronized void asyncstop (String address, String accesstoken, String token)
Request that the remote job identified by
token
is terminated. For other arguments seeTask.asyncoptimize
.- Parameters
address
(String
) – Address of the OptServer. (input)accesstoken
(String
) – Access token. (input)token
(String
) – The task token. (input)
- Groups
- Task.basiscond¶
public synchronized void basiscond (double[] nrmbasis, double[] nrminvbasis)
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
nrmbasis
(double
by reference) – An estimate for the 1-norm of the basis. (output)nrminvbasis
(double
by reference) – An estimate for the 1-norm of the inverse of the basis. (output)
- Groups
- Task.checkmem¶
public synchronized void checkmem (String file, int line)
Checks the memory allocated by the task.
- Parameters
file
(String
) – File from which the function is called. (input)line
(int
) – Line in the file from which the function is called. (input)
- Groups
- Task.chgconbound¶
public synchronized void chgconbound (int i, int lower, int finite, double value)
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
i
(int
) – Index of the constraint for which the bounds should be changed. (input)lower
(int
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(int
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(double
) – New value for the bound. (input)
- Groups
Problem data - bounds, Problem data - constraints, Problem data - linear part
- Task.chgvarbound¶
public synchronized void chgvarbound (int j, int lower, int finite, double value)
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
j
(int
) – Index of the variable for which the bounds should be changed. (input)lower
(int
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(int
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(double
) – New value for the bound. (input)
- Groups
Problem data - bounds, Problem data - variables, Problem data - linear part
- Task.commitchanges¶
public synchronized void commitchanges()
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.
- Task.deletesolution¶
public synchronized void deletesolution(soltype whichsol)
Undefine a solution and free the memory it uses.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)- Groups
- Task.dispose¶
void dispose()
Free the underlying native allocation.
- Task.dualsensitivity¶
public synchronized void dualsensitivity (int[] subj, double[] leftpricej, double[] rightpricej, double[] leftrangej, double[] rightrangej)
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
iparam.sensitivity_type
.For an example, please see Section Example: Sensitivity Analysis.
- Parameters
subj
(int
[]
) – Indexes of objective coefficients to analyze. (input)leftpricej
(double
[]
) – \(\mathtt{leftpricej}[j]\) is the left shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)rightpricej
(double
[]
) – \(\mathtt{rightpricej}[j]\) is the right shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)leftrangej
(double
[]
) – \(\mathtt{leftrangej}[j]\) is the left range \(\beta_1\) for the coefficient with index \(\mathtt{subj[j]}\). (output)rightrangej
(double
[]
) – \(\mathtt{rightrangej}[j]\) is the right range \(\beta_2\) for the coefficient with index \(\mathtt{subj[j]}\). (output)
- Groups
- Task.emptyafebarfrow¶
public synchronized void emptyafebarfrow(long afeidx)
Clears a row in \(\barF\) i.e. sets \(\barF_{\mathrm{afeidx},*} = 0\).
- Parameters
afeidx
(long
) – Row index of \(\barF\). (input)- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.emptyafebarfrowlist¶
public synchronized void emptyafebarfrowlist(long[] afeidxlist)
Clears a number of rows in \(\barF\) i.e. sets \(\barF_{i,*} = 0\) for all indices \(i\) in
afeidxlist
.- Parameters
afeidxlist
(long
[]
) – Indices of rows in \(\barF\) to clear. (input)- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.emptyafefcol¶
public synchronized void emptyafefcol(int varidx)
Clears one column in the affine constraint matrix \(F\), that is sets \(F_{*,\mathrm{varidx}}=0\).
- Parameters
varidx
(int
) – Index of a variable (column in \(F\)). (input)- Groups
- Task.emptyafefcollist¶
public synchronized void emptyafefcollist(int[] varidx)
Clears a number of columns in \(F\) i.e. sets \(F_{*,j} = 0\) for all indices \(j\) in
varidx
.- Parameters
varidx
(int
[]
) – Indices of variables (columns) in \(F\) to clear. (input)- Groups
- Task.emptyafefrow¶
public synchronized void emptyafefrow(long afeidx)
Clears one row in the affine constraint matrix \(F\), that is sets \(F_{\mathrm{afeidx},*}=0\).
- Parameters
afeidx
(long
) – Index of a row in \(F\). (input)- Groups
- Task.emptyafefrowlist¶
public synchronized void emptyafefrowlist(long[] afeidx)
Clears a number of rows in \(F\) i.e. sets \(F_{i,*} = 0\) for all indices \(i\) in
afeidx
.- Parameters
afeidx
(long
[]
) – Indices of rows in \(F\) to clear. (input)- Groups
- Task.evaluateacc¶
public synchronized void evaluateacc (soltype whichsol, long accidx, double[] activity)
Evaluates the activity of an affine conic constraint.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)accidx
(long
) – The index of the affine conic constraint. (input)activity
(double
[]
) – The activity of the affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Groups
- Task.evaluateaccs¶
public synchronized void evaluateaccs (soltype whichsol, double[] activity)
Evaluates the activities of all affine conic constraints.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)activity
(double
[]
) – The activity of affine conic constraints. The array should have length equal to the sum of dimensions of all affine conic constraints. (output)
- Groups
- Task.generateaccnames¶
public synchronized void generateaccnames (long[] sub, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Internal.
- Parameters
sub
(long
[]
) – Indexes of the affine conic constraints. (input)fmt
(String
) – The variable name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
- Task.generatebarvarnames¶
public synchronized void generatebarvarnames (int[] subj, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Generates systematic names for variables.
- Parameters
subj
(int
[]
) – Indexes of the variables. (input)fmt
(String
) – The variable name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
- Task.generateconenames Deprecated¶
public synchronized void generateconenames (int[] subk, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Internal, deprecated.
- Parameters
subk
(int
[]
) – Indexes of the cone. (input)fmt
(String
) – The cone name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
- Task.generateconnames¶
public synchronized void generateconnames (int[] subi, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Generates systematic names for constraints.
- Parameters
subi
(int
[]
) – Indexes of the constraints. (input)fmt
(String
) – The constraint name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
Names, Problem data - constraints, Problem data - linear part
- Task.generatedjcnames¶
public synchronized void generatedjcnames (long[] sub, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Internal.
- Parameters
sub
(long
[]
) – Indexes of the disjunctive constraints. (input)fmt
(String
) – The variable name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
- Task.generatevarnames¶
public synchronized void generatevarnames (int[] subj, String fmt, int[] dims, long[] sp, int[] namedaxisidxs, String[] names)
Generates systematic names for variables.
- Parameters
subj
(int
[]
) – Indexes of the variables. (input)fmt
(String
) – The variable name formatting string. (input)dims
(int
[]
) – Dimensions in the shape. (input)sp
(long
[]
) – Items that should be named. (input)namedaxisidxs
(int
[]
) – List if named index axes (input)
- Groups
- Task.getaccafeidxlist¶
public synchronized void getaccafeidxlist (long accidx, long[] afeidxlist)
Obtains the list of affine expressions appearing in the affine conic constraint.
- Parameters
accidx
(long
) – Index of the affine conic constraint. (input)afeidxlist
(long
[]
) – List of indexes of affine expressions appearing in the constraint. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccb¶
public synchronized void getaccb (long accidx, double[] b)
Obtains the additional constant term vector appearing in the affine conic constraint.
- Parameters
accidx
(long
) – Index of the affine conic constraint. (input)b
(double
[]
) – The vector b appearing in the constraint. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccbarfblocktriplet¶
public synchronized void getaccbarfblocktriplet (long[] numtrip, long[] acc_afe, int[] bar_var, int[] blk_row, int[] blk_col, double[] blk_val)
public synchronized long getaccbarfblocktriplet (long[] acc_afe, int[] bar_var, int[] blk_row, int[] blk_col, double[] blk_val)
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
numtrip
(long
by reference) – Number of elements in the block triplet form. (output)acc_afe
(long
[]
) – Index of the AFE within the concatenated list of AFEs in ACCs. (output)bar_var
(int
[]
) – Symmetric matrix variable index. (output)blk_row
(int
[]
) – Block row index. (output)blk_col
(int
[]
) – Block column index. (output)blk_val
(double
[]
) – The numerical value associated with each block triplet. (output)
- Return
(
long
) – Number of elements in the block triplet form.- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.getaccbarfnumblocktriplets¶
public synchronized void getaccbarfnumblocktriplets(long[] numtrip)
public synchronized long getaccbarfnumblocktriplets()
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\), as used within the ACCs.
- Parameters
numtrip
(long
by reference) – An upper bound on the number of elements in the block triplet form of \(\barF.\), as used within the ACCs. (output)- Return
(
long
) – 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
- Task.getaccdomain¶
public synchronized void getaccdomain (long accidx, long[] domidx)
public synchronized long getaccdomain(long accidx)
Obtains the domain appearing in the affine conic constraint.
- Parameters
accidx
(long
) – The index of the affine conic constraint. (input)domidx
(long
by reference) – The index of domain in the affine conic constraint. (output)
- Return
(
long
) – The index of domain in the affine conic constraint.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccdoty¶
public synchronized void getaccdoty (soltype whichsol, long accidx, double[] doty)
public synchronized double[] getaccdoty (soltype whichsol, long accidx)
Obtains the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters
whichsol
(soltype
) – Selects a solution. (input)accidx
(long
) – The index of the affine conic constraint. (input)doty
(double
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Return
(
double
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint.- Groups
- Task.getaccdotys¶
public synchronized void getaccdotys (soltype whichsol, double[] doty)
Obtains the \(\dot{y}\) vector for a solution (the dual values of all affine conic constraint).
- Parameters
whichsol
(soltype
) – Selects a solution. (input)doty
(double
[]
) – The dual values of affine conic constraints. The array should have length equal to the sum of dimensions of all affine conic constraints. (output)
- Groups
- Task.getaccfnumnz¶
public synchronized void getaccfnumnz(long[] accfnnz)
public synchronized long getaccfnumnz()
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
accfnnz
(long
by reference) – Number of non-zeros in \(F\) implied by ACCs. (output)- Return
(
long
) – Number of non-zeros in \(F\) implied by ACCs.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccftrip¶
public synchronized void getaccftrip (long[] frow, int[] fcol, double[] fval)
Obtains the \(F\) (that would be implied by the ordering of the AFEs within the ACCs) in triplet format.
- Parameters
frow
(long
[]
) – Row indices of nonzeros in the implied F matrix. (output)fcol
(int
[]
) – Column indices of nonzeros in the implied F matrix. (output)fval
(double
[]
) – Values of nonzero entries in the implied F matrix. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccgvector¶
public synchronized void getaccgvector(double[] g)
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
g
(double
[]
) – The \(g\) used within the ACCs as a dense vector. The length is sum of the dimensions of the ACCs. (output)- Groups
Inspecting the task, Problem data - affine conic constraints
- Task.getaccn¶
public synchronized void getaccn (long accidx, long[] n)
public synchronized long getaccn(long accidx)
Obtains the dimension of the affine conic constraint.
- Parameters
accidx
(long
) – The index of the affine conic constraint. (input)n
(long
by reference) – The dimension of the affine conic constraint (equal to the dimension of its domain). (output)
- Return
(
long
) – The dimension of the affine conic constraint (equal to the dimension of its domain).- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccname¶
public synchronized String getaccname(long accidx)
Obtains the name of an affine conic constraint.
- Parameters
accidx
(long
) – Index of an affine conic constraint. (input)- Return
(
String
) – Returns the required name.- Groups
Names, Problem data - affine conic constraints, Inspecting the task
- Task.getaccnamelen¶
public synchronized void getaccnamelen (long accidx, int[] len)
public synchronized int getaccnamelen(long accidx)
Obtains the length of the name of an affine conic constraint.
- Parameters
accidx
(long
) – Index of an affine conic constraint. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
Names, Problem data - affine conic constraints, Inspecting the task
- Task.getaccntot¶
public synchronized void getaccntot(long[] n)
public synchronized long getaccntot()
Obtains the total dimension of all affine conic constraints (the sum of all their dimensions).
- Parameters
n
(long
by reference) – The total dimension of all affine conic constraints. (output)- Return
(
long
) – The total dimension of all affine conic constraints.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getaccs¶
public synchronized void getaccs (long[] domidxlist, long[] afeidxlist, double[] b)
Obtains full data of all affine conic constraints. The output array
domainidxlist
must have at least length determined byTask.getnumacc
. The output arraysafeidxlist
andb
must have at least length determined byTask.getaccntot
.- Parameters
domidxlist
(long
[]
) – The list of domains appearing in all affine conic constraints. (output)afeidxlist
(long
[]
) – The concatenation of index lists of affine expressions appearing in all affine conic constraints. (output)b
(double
[]
) – The concatenation of vectors b appearing in all affine conic constraints. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getacol¶
public synchronized void getacol (int j, int[] nzj, int[] subj, double[] valj)
Obtains one column of \(A\) in a sparse format.
- Parameters
j
(int
) – Index of the column. (input)nzj
(int
by reference) – Number of non-zeros in the column obtained. (output)subj
(int
[]
) – Row indices of the non-zeros in the column obtained. (output)valj
(double
[]
) – Numerical values in the column obtained. (output)
- Groups
- Task.getacolnumnz¶
public synchronized void getacolnumnz (int i, int[] nzj)
public synchronized int getacolnumnz(int i)
Obtains the number of non-zero elements in one column of \(A\).
- Parameters
i
(int
) – Index of the column. (input)nzj
(int
by reference) – Number of non-zeros in the \(j\)-th column of \(A\). (output)
- Return
(
int
) – Number of non-zeros in the \(j\)-th column of \(A\).- Groups
- Task.getacolslice¶
public synchronized void getacolslice (int first, int last, long[] ptrb, long[] ptre, int[] sub, double[] val)
Obtains a sequence of columns from \(A\) in sparse format.
- Parameters
first
(int
) – Index of the first column in the sequence. (input)last
(int
) – Index of the last column in the sequence plus one. (input)ptrb
(long
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th column obtained. (output)ptre
(long
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th column obtained. (output)sub
(int
[]
) – Contains the row subscripts. (output)val
(double
[]
) – Contains the coefficient values. (output)
- Groups
- Task.getacolslicenumnz¶
public synchronized void getacolslicenumnz (int first, int last, long[] numnz)
public synchronized long getacolslicenumnz (int first, int last)
Obtains the number of non-zeros in a slice of columns of \(A\).
- Parameters
first
(int
) – Index of the first column in the sequence. (input)last
(int
) – Index of the last column plus one in the sequence. (input)numnz
(long
by reference) – Number of non-zeros in the slice. (output)
- Return
(
long
) – Number of non-zeros in the slice.- Groups
- Task.getacolslicetrip¶
public synchronized void getacolslicetrip (int first, int last, int[] subi, int[] subj, double[] val)
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
first
(int
) – Index of the first column in the sequence. (input)last
(int
) – Index of the last column in the sequence plus one. (input)subi
(int
[]
) – Constraint subscripts. (output)subj
(int
[]
) – Column subscripts. (output)val
(double
[]
) – Values. (output)
- Groups
- Task.getafebarfblocktriplet¶
public synchronized void getafebarfblocktriplet (long[] numtrip, long[] afeidx, int[] barvaridx, int[] subk, int[] subl, double[] valkl)
public synchronized long getafebarfblocktriplet (long[] afeidx, int[] barvaridx, int[] subk, int[] subl, double[] valkl)
Obtains \(\barF\) in block triplet form.
- Parameters
numtrip
(long
by reference) – Number of elements in the block triplet form. (output)afeidx
(long
[]
) – Constraint index. (output)barvaridx
(int
[]
) – Symmetric matrix variable index. (output)subk
(int
[]
) – Block row index. (output)subl
(int
[]
) – Block column index. (output)valkl
(double
[]
) – The numerical value associated with each block triplet. (output)
- Return
(
long
) – Number of elements in the block triplet form.- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.getafebarfnumblocktriplets¶
public synchronized void getafebarfnumblocktriplets(long[] numtrip)
public synchronized long getafebarfnumblocktriplets()
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\).
- Parameters
numtrip
(long
by reference) – An upper bound on the number of elements in the block triplet form of \(\barF.\) (output)- Return
(
long
) – An upper bound on the number of elements in the block triplet form of \(\barF.\)- Groups
- Task.getafebarfnumrowentries¶
public synchronized void getafebarfnumrowentries (long afeidx, int[] numentr)
public synchronized int getafebarfnumrowentries(long afeidx)
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
afeidx
(long
) – Row index of \(\barF\). (input)numentr
(int
by reference) – Number of nonzero entries in a row of \(\barF\). (output)
- Return
(
int
) – Number of nonzero entries in a row of \(\barF\).- Groups
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- Task.getafebarfrow¶
public synchronized void getafebarfrow (long afeidx, int[] barvaridx, long[] ptrterm, long[] numterm, long[] termidx, double[] termweight)
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
Task.getafebarfrowinfo
.- Parameters
afeidx
(long
) – Row index of \(\barF\). (input)barvaridx
(int
[]
) – Semidefinite variable indices of nonzero entries in the row of \(\barF\). (output)ptrterm
(long
[]
) – Pointers to the start of each entry’s description. (output)numterm
(long
[]
) – Number of terms in the weighted sum representation of each entry. (output)termidx
(long
[]
) – Indices of semidefinite matrices from the matrix store \(E\). (output)termweight
(double
[]
) – Weights appearing in the weighted sum representations of all entries. (output)
- Groups
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- Task.getafebarfrowinfo¶
public synchronized void getafebarfrowinfo (long afeidx, int[] numentr, long[] numterm)
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
Task.getafebarfrow
.- Parameters
afeidx
(long
) – Row index of \(\barF\). (input)numentr
(int
by reference) – Number of nonzero entries in a row of \(\barF\). (output)numterm
(long
by reference) – Number of terms in the weighted sums representation of the row of \(\barF\). (output)
- Groups
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- Task.getafefnumnz¶
public synchronized void getafefnumnz(long[] numnz)
public synchronized long getafefnumnz()
Obtains the total number of nonzeros in \(F\).
- Parameters
numnz
(long
by reference) – Number of non-zeros in \(F\). (output)- Return
(
long
) – Number of non-zeros in \(F\).- Groups
- Task.getafefrow¶
public synchronized void getafefrow (long afeidx, int[] numnz, int[] varidx, double[] val)
Obtains one row of \(F\) in sparse format.
- Parameters
afeidx
(long
) – Index of a row in \(F\). (input)numnz
(int
by reference) – Number of non-zeros in the row obtained. (output)varidx
(int
[]
) – Column indices of the non-zeros in the row obtained. (output)val
(double
[]
) – Values of the non-zeros in the row obtained. (output)
- Groups
- Task.getafefrownumnz¶
public synchronized void getafefrownumnz (long afeidx, int[] numnz)
public synchronized int getafefrownumnz(long afeidx)
Obtains the number of nonzeros in one row of \(F\).
- Parameters
afeidx
(long
) – Index of a row in \(F\). (input)numnz
(int
by reference) – Number of non-zeros in rowafeidx
of \(F\). (output)
- Return
(
int
) – Number of non-zeros in rowafeidx
of \(F\).- Groups
- Task.getafeftrip¶
public synchronized void getafeftrip (long[] afeidx, int[] varidx, double[] val)
Obtains the \(F\) in triplet format.
- Parameters
afeidx
(long
[]
) – Row indices of nonzeros. (output)varidx
(int
[]
) – Column indices of nonzeros. (output)val
(double
[]
) – Values of nonzero entries. (output)
- Groups
- Task.getafeg¶
public synchronized void getafeg (long afeidx, double[] g)
public synchronized double getafeg(long afeidx)
Obtains a single coefficient in \(g\).
- Parameters
afeidx
(long
) – Index of an element in \(g\). (input)g
(double
by reference) – The value of \(g_{\mathrm{afeidx}}\). (output)
- Return
(
double
) – The value of \(g_{\mathrm{afeidx}}\).- Groups
- Task.getafegslice¶
public synchronized void getafegslice (long first, long last, double[] g)
Obtains a sequence of elements from the vector \(g\) of constant terms in the affine expressions list.
- Parameters
first
(long
) – First index in the sequence. (input)last
(long
) – Last index plus 1 in the sequence. (input)g
(double
[]
) – The slice \(g\) as a dense vector. The length islast-first
. (output)
- Groups
- Task.getaij¶
public synchronized void getaij (int i, int j, double[] aij)
public synchronized double getaij (int i, int j)
Obtains a single coefficient in \(A\).
- Parameters
i
(int
) – Row index of the coefficient to be returned. (input)j
(int
) – Column index of the coefficient to be returned. (input)aij
(double
by reference) – The required coefficient \(a_{i,j}\). (output)
- Return
(
double
) – The required coefficient \(a_{i,j}\).- Groups
- Task.getapiecenumnz¶
public synchronized void getapiecenumnz (int firsti, int lasti, int firstj, int lastj, int[] numnz)
public synchronized int getapiecenumnz (int firsti, int lasti, int firstj, int lastj)
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
Task.getarownumnz
orTask.getacolnumnz
.- Parameters
firsti
(int
) – Index of the first row in the rectangular piece. (input)lasti
(int
) – Index of the last row plus one in the rectangular piece. (input)firstj
(int
) – Index of the first column in the rectangular piece. (input)lastj
(int
) – Index of the last column plus one in the rectangular piece. (input)numnz
(int
by reference) – Number of non-zero \(A\) elements in the rectangular piece. (output)
- Return
(
int
) – Number of non-zero \(A\) elements in the rectangular piece.- Groups
- Task.getarow¶
public synchronized void getarow (int i, int[] nzi, int[] subi, double[] vali)
Obtains one row of \(A\) in a sparse format.
- Parameters
i
(int
) – Index of the row. (input)nzi
(int
by reference) – Number of non-zeros in the row obtained. (output)subi
(int
[]
) – Column indices of the non-zeros in the row obtained. (output)vali
(double
[]
) – Numerical values of the row obtained. (output)
- Groups
- Task.getarownumnz¶
public synchronized void getarownumnz (int i, int[] nzi)
public synchronized int getarownumnz(int i)
Obtains the number of non-zero elements in one row of \(A\).
- Parameters
i
(int
) – Index of the row. (input)nzi
(int
by reference) – Number of non-zeros in the \(i\)-th row of \(A\). (output)
- Return
(
int
) – Number of non-zeros in the \(i\)-th row of \(A\).- Groups
- Task.getarowslice¶
public synchronized void getarowslice (int first, int last, long[] ptrb, long[] ptre, int[] sub, double[] val)
Obtains a sequence of rows from \(A\) in sparse format.
- Parameters
first
(int
) – Index of the first row in the sequence. (input)last
(int
) – Index of the last row in the sequence plus one. (input)ptrb
(long
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th row obtained. (output)ptre
(long
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th row obtained. (output)sub
(int
[]
) – Contains the column subscripts. (output)val
(double
[]
) – Contains the coefficient values. (output)
- Groups
- Task.getarowslicenumnz¶
public synchronized void getarowslicenumnz (int first, int last, long[] numnz)
public synchronized long getarowslicenumnz (int first, int last)
Obtains the number of non-zeros in a slice of rows of \(A\).
- Parameters
first
(int
) – Index of the first row in the sequence. (input)last
(int
) – Index of the last row plus one in the sequence. (input)numnz
(long
by reference) – Number of non-zeros in the slice. (output)
- Return
(
long
) – Number of non-zeros in the slice.- Groups
- Task.getarowslicetrip¶
public synchronized void getarowslicetrip (int first, int last, int[] subi, int[] subj, double[] val)
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
first
(int
) – Index of the first row in the sequence. (input)last
(int
) – Index of the last row in the sequence plus one. (input)subi
(int
[]
) – Constraint subscripts. (output)subj
(int
[]
) – Column subscripts. (output)val
(double
[]
) – Values. (output)
- Groups
- Task.getatrip¶
public synchronized void getatrip (int[] subi, int[] subj, double[] val)
Obtains \(A\) in sparse triplet format. The triplets corresponding to nonzero entries are stored in the arrays
subi
,subj
andval
.- Parameters
subi
(int
[]
) – Constraint subscripts. (output)subj
(int
[]
) – Column subscripts. (output)val
(double
[]
) – Values. (output)
- Groups
- Task.getatruncatetol¶
public synchronized void getatruncatetol(double[] tolzero)
Obtains the tolerance value set with
Task.putatruncatetol
.- Parameters
tolzero
(double
[]
) – All elements \(|a_{i,j}|\) less than this tolerance is truncated to zero. (output)- Groups
- Task.getbarablocktriplet¶
public synchronized void getbarablocktriplet (long[] num, int[] subi, int[] subj, int[] subk, int[] subl, double[] valijkl)
public synchronized long getbarablocktriplet (int[] subi, int[] subj, int[] subk, int[] subl, double[] valijkl)
Obtains \(\barA\) in block triplet form.
- Parameters
num
(long
by reference) – Number of elements in the block triplet form. (output)subi
(int
[]
) – Constraint index. (output)subj
(int
[]
) – Symmetric matrix variable index. (output)subk
(int
[]
) – Block row index. (output)subl
(int
[]
) – Block column index. (output)valijkl
(double
[]
) – The numerical value associated with each block triplet. (output)
- Return
(
long
) – Number of elements in the block triplet form.- Groups
- Task.getbaraidx¶
public synchronized void getbaraidx (long idx, int[] i, int[] j, long[] num, long[] sub, double[] weights)
public synchronized long getbaraidx (long idx, int[] i, int[] j, long[] sub, double[] weights)
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
idx
(long
) – Position of the element in the vectorized form. (input)i
(int
by reference) – Row index of the element at positionidx
. (output)j
(int
by reference) – Column index of the element at positionidx
. (output)num
(long
by reference) – Number of terms in weighted sum that forms the element. (output)sub
(long
[]
) – A list indexes of the elements from symmetric matrix storage that appear in the weighted sum. (output)weights
(double
[]
) – The weights associated with each term in the weighted sum. (output)
- Return
(
long
) – Number of terms in weighted sum that forms the element.- Groups
- Task.getbaraidxij¶
public synchronized void getbaraidxij (long idx, int[] i, int[] j)
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
idx
(long
) – Position of the element in the vectorized form. (input)i
(int
by reference) – Row index of the element at positionidx
. (output)j
(int
by reference) – Column index of the element at positionidx
. (output)
- Groups
- Task.getbaraidxinfo¶
public synchronized void getbaraidxinfo (long idx, long[] num)
public synchronized long getbaraidxinfo(long idx)
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
Task.appendsparsesymmat
for details about the weighted sum.- Parameters
idx
(long
) – The internal position of the element for which information should be obtained. (input)num
(long
by reference) – Number of terms in the weighted sum that form the specified element in \(\barA\). (output)
- Return
(
long
) – Number of terms in the weighted sum that form the specified element in \(\barA\).- Groups
- Task.getbarasparsity¶
public synchronized void getbarasparsity (long[] numnz, long[] idxij)
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
Task.getbaraidxinfo
andTask.getbaraidx
.- Parameters
numnz
(long
by reference) – Number of nonzero elements in \(\barA\). (output)idxij
(long
[]
) – Position of each nonzero element in the vectorized form of \(\barA\). (output)
- Groups
- Task.getbarcblocktriplet¶
public synchronized void getbarcblocktriplet (long[] num, int[] subj, int[] subk, int[] subl, double[] valjkl)
public synchronized long getbarcblocktriplet (int[] subj, int[] subk, int[] subl, double[] valjkl)
Obtains \(\barC\) in block triplet form.
- Parameters
num
(long
by reference) – Number of elements in the block triplet form. (output)subj
(int
[]
) – Symmetric matrix variable index. (output)subk
(int
[]
) – Block row index. (output)subl
(int
[]
) – Block column index. (output)valjkl
(double
[]
) – The numerical value associated with each block triplet. (output)
- Return
(
long
) – Number of elements in the block triplet form.- Groups
- Task.getbarcidx¶
public synchronized void getbarcidx (long idx, int[] j, long[] num, long[] sub, double[] weights)
Obtains information about an element in \(\barC\).
- Parameters
idx
(long
) – Index of the element for which information should be obtained. (input)j
(int
by reference) – Row index in \(\barC\). (output)num
(long
by reference) – Number of terms in the weighted sum. (output)sub
(long
[]
) – Elements appearing the weighted sum. (output)weights
(double
[]
) – Weights of terms in the weighted sum. (output)
- Groups
- Task.getbarcidxinfo¶
public synchronized void getbarcidxinfo (long idx, long[] num)
public synchronized long getbarcidxinfo(long idx)
Obtains the number of terms in the weighted sum that forms a particular element in \(\barC\).
- Parameters
idx
(long
) – Index of the element for which information should be obtained. The value is an index of a symmetric sparse variable. (input)num
(long
by reference) – Number of terms that appear in the weighted sum that forms the requested element. (output)
- Return
(
long
) – Number of terms that appear in the weighted sum that forms the requested element.- Groups
- Task.getbarcidxj¶
public synchronized void getbarcidxj (long idx, int[] j)
Obtains the row index of an element in \(\barC\).
- Parameters
idx
(long
) – Index of the element for which information should be obtained. (input)j
(int
by reference) – Row index in \(\barC\). (output)
- Groups
- Task.getbarcsparsity¶
public synchronized void getbarcsparsity (long[] numnz, long[] idxj)
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 usingTask.getbarcidxinfo
andTask.getbarcidx
.- Parameters
numnz
(long
by reference) – Number of nonzero elements in \(\barC\). (output)idxj
(long
[]
) – Internal positions of the nonzeros elements in \(\barC\). (output)
- Groups
- Task.getbarsj¶
public synchronized void getbarsj (soltype whichsol, int j, double[] barsj)
public synchronized double[] getbarsj (soltype whichsol, int j)
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
whichsol
(soltype
) – Selects a solution. (input)j
(int
) – Index of the semidefinite variable. (input)barsj
(double
[]
) – Value of \(\barS_j\). (output)
- Return
(
double
[]
) – Value of \(\barS_j\).- Groups
- Task.getbarsslice¶
public synchronized void getbarsslice (soltype whichsol, int first, int last, long slicesize, double[] barsslice)
public synchronized double[] getbarsslice (soltype whichsol, int first, int last, long slicesize)
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
Task.getbarsj
.- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – Index of the first semidefinite variable in the slice. (input)last
(int
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(long
) – Denotes the length of the arraybarsslice
. (input)barsslice
(double
[]
) – Dual solution values of symmetric matrix variables in the slice, stored sequentially. (output)
- Return
(
double
[]
) – Dual solution values of symmetric matrix variables in the slice, stored sequentially.- Groups
- Task.getbarvarname¶
public synchronized String getbarvarname(int i)
Obtains the name of a semidefinite variable.
- Parameters
i
(int
) – Index of the variable. (input)- Return
(
String
) – The requested name is copied to this buffer.- Groups
- Task.getbarvarnameindex¶
public synchronized void getbarvarnameindex (String somename, int[] asgn, int[] index)
public synchronized int getbarvarnameindex (String somename, int[] asgn)
Obtains the index of semidefinite variable from its name.
- Parameters
somename
(String
) – The name of the variable. (input)asgn
(int
by reference) – Non-zero if the namesomename
is assigned to some semidefinite variable. (output)index
(int
by reference) – The index of a semidefinite variable with the namesomename
(if one exists). (output)
- Return
(
int
) – The index of a semidefinite variable with the namesomename
(if one exists).- Groups
- Task.getbarvarnamelen¶
public synchronized void getbarvarnamelen (int i, int[] len)
public synchronized int getbarvarnamelen(int i)
Obtains the length of the name of a semidefinite variable.
- Parameters
i
(int
) – Index of the variable. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
- Task.getbarxj¶
public synchronized void getbarxj (soltype whichsol, int j, double[] barxj)
public synchronized double[] getbarxj (soltype whichsol, int j)
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
whichsol
(soltype
) – Selects a solution. (input)j
(int
) – Index of the semidefinite variable. (input)barxj
(double
[]
) – Value of \(\barX_j\). (output)
- Return
(
double
[]
) – Value of \(\barX_j\).- Groups
- Task.getbarxslice¶
public synchronized void getbarxslice (soltype whichsol, int first, int last, long slicesize, double[] barxslice)
public synchronized double[] getbarxslice (soltype whichsol, int first, int last, long slicesize)
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
Task.getbarxj
.- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – Index of the first semidefinite variable in the slice. (input)last
(int
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(long
) – Denotes the length of the arraybarxslice
. (input)barxslice
(double
[]
) – Solution values of symmetric matrix variables in the slice, stored sequentially. (output)
- Return
(
double
[]
) – Solution values of symmetric matrix variables in the slice, stored sequentially.- Groups
- Task.getc¶
public synchronized void getc(double[] c)
Obtains all objective coefficients \(c\).
- Parameters
c
(double
[]
) – Linear terms of the objective as a dense vector. The length is the number of variables. (output)- Groups
Problem data - linear part, Inspecting the task, Problem data - variables
- Task.getcfix¶
public synchronized void getcfix(double[] cfix)
public synchronized double getcfix()
Obtains the fixed term in the objective.
- Parameters
cfix
(double
by reference) – Fixed term in the objective. (output)- Return
(
double
) – Fixed term in the objective.- Groups
- Task.getcj¶
public synchronized void getcj (int j, double[] cj)
Obtains one coefficient of \(c\).
- Parameters
j
(int
) – Index of the variable for which the \(c\) coefficient should be obtained. (input)cj
(double
by reference) – The value of \(c_j\). (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - variables
- Task.getclist¶
public synchronized void getclist (int[] subj, double[] c)
Obtains a sequence of elements in \(c\).
- Parameters
subj
(int
[]
) – A list of variable indexes. (input)c
(double
[]
) – Linear terms of the requested list of the objective as a dense vector. (output)
- Groups
- Task.getconbound¶
public synchronized void getconbound (int i, boundkey[] bk, double[] bl, double[] bu)
Obtains bound information for one constraint.
- Parameters
i
(int
) – Index of the constraint for which the bound information should be obtained. (input)bk
(mosek.boundkey
by reference) – Bound keys. (output)bl
(double
by reference) – Values for lower bounds. (output)bu
(double
by reference) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- Task.getconboundslice¶
public synchronized void getconboundslice (int first, int last, boundkey[] bk, double[] bl, double[] bu)
Obtains bounds information for a slice of the constraints.
- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bk
(boundkey
[]
) – Bound keys. (output)bl
(double
[]
) – Values for lower bounds. (output)bu
(double
[]
) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- Task.getcone Deprecated¶
public synchronized void getcone (int k, conetype[] ct, double[] conepar, int[] nummem, int[] submem)
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
k
(int
) – Index of the cone. (input)ct
(mosek.conetype
by reference) – Specifies the type of the cone. (output)conepar
(double
by reference) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (output)nummem
(int
by reference) – Number of member variables in the cone. (output)submem
(int
[]
) – Variable subscripts of the members in the cone. (output)
- Groups
- Task.getconeinfo Deprecated¶
public synchronized void getconeinfo (int k, conetype[] ct, double[] conepar, int[] nummem)
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
k
(int
) – Index of the cone. (input)ct
(mosek.conetype
by reference) – Specifies the type of the cone. (output)conepar
(double
by reference) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (output)nummem
(int
by reference) – Number of member variables in the cone. (output)
- Groups
- Task.getconename Deprecated¶
public synchronized String getconename(int i)
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
i
(int
) – Index of the cone. (input)- Return
(
String
) – The required name.- Groups
Names, Problem data - cones (deprecated), Inspecting the task
- Task.getconenameindex Deprecated¶
public synchronized void getconenameindex (String somename, int[] asgn, int[] index)
public synchronized int getconenameindex (String somename, int[] asgn)
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
somename
(String
) – The name which should be checked. (input)asgn
(int
by reference) – Is non-zero if the namesomename
is assigned to some cone. (output)index
(int
by reference) – If the namesomename
is assigned to some cone, thenindex
is the index of the cone. (output)
- Return
(
int
) – If the namesomename
is assigned to some cone, thenindex
is the index of the cone.- Groups
Names, Problem data - cones (deprecated), Inspecting the task
- Task.getconenamelen Deprecated¶
public synchronized void getconenamelen (int i, int[] len)
public synchronized int getconenamelen(int i)
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
i
(int
) – Index of the cone. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
Names, Problem data - cones (deprecated), Inspecting the task
- Task.getconname¶
public synchronized String getconname(int i)
Obtains the name of a constraint.
- Parameters
i
(int
) – Index of the constraint. (input)- Return
(
String
) – The required name.- Groups
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.getconnameindex¶
public synchronized void getconnameindex (String somename, int[] asgn, int[] index)
public synchronized int getconnameindex (String somename, int[] asgn)
Checks whether the name
somename
has been assigned to any constraint. If so, the index of the constraint is reported.- Parameters
somename
(String
) – The name which should be checked. (input)asgn
(int
by reference) – Is non-zero if the namesomename
is assigned to some constraint. (output)index
(int
by reference) – If the namesomename
is assigned to a constraint, thenindex
is the index of the constraint. (output)
- Return
(
int
) – 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
- Task.getconnamelen¶
public synchronized void getconnamelen (int i, int[] len)
public synchronized int getconnamelen(int i)
Obtains the length of the name of a constraint.
- Parameters
i
(int
) – Index of the constraint. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.getcslice¶
public synchronized void getcslice (int first, int last, double[] c)
Obtains a sequence of elements in \(c\).
- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)c
(double
[]
) – Linear terms of the requested slice of the objective as a dense vector. The length islast-first
. (output)
- Groups
- Task.getdimbarvarj¶
public synchronized void getdimbarvarj (int j, int[] dimbarvarj)
public synchronized int getdimbarvarj(int j)
Obtains the dimension of a symmetric matrix variable.
- Parameters
j
(int
) – Index of the semidefinite variable whose dimension is requested. (input)dimbarvarj
(int
by reference) – The dimension of the \(j\)-th semidefinite variable. (output)
- Return
(
int
) – The dimension of the \(j\)-th semidefinite variable.- Groups
- Task.getdjcafeidxlist¶
public synchronized void getdjcafeidxlist (long djcidx, long[] afeidxlist)
Obtains the list of affine expression indexes in a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (output)
- Groups
- Task.getdjcb¶
public synchronized void getdjcb (long djcidx, double[] b)
Obtains the optional constant term vector of a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)b
(double
[]
) – The vector b. (output)
- Groups
- Task.getdjcdomainidxlist¶
public synchronized void getdjcdomainidxlist (long djcidx, long[] domidxlist)
Obtains the list of domain indexes in a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)domidxlist
(long
[]
) – List of term sizes. (output)
- Groups
- Task.getdjcname¶
public synchronized String getdjcname(long djcidx)
Obtains the name of a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of a disjunctive constraint. (input)- Return
(
String
) – Returns the required name.- Groups
Names, Problem data - disjunctive constraints, Inspecting the task
- Task.getdjcnamelen¶
public synchronized void getdjcnamelen (long djcidx, int[] len)
public synchronized int getdjcnamelen(long djcidx)
Obtains the length of the name of a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of a disjunctive constraint. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
Names, Problem data - disjunctive constraints, Inspecting the task
- Task.getdjcnumafe¶
public synchronized void getdjcnumafe (long djcidx, long[] numafe)
public synchronized long getdjcnumafe(long djcidx)
Obtains the number of affine expressions in the disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)numafe
(long
by reference) – Number of affine expressions in the disjunctive constraint. (output)
- Return
(
long
) – Number of affine expressions in the disjunctive constraint.- Groups
- Task.getdjcnumafetot¶
public synchronized void getdjcnumafetot(long[] numafetot)
public synchronized long getdjcnumafetot()
Obtains the total number of affine expressions in all disjunctive constraints.
- Parameters
numafetot
(long
by reference) – Number of affine expressions in all disjunctive constraints. (output)- Return
(
long
) – Number of affine expressions in all disjunctive constraints.- Groups
- Task.getdjcnumdomain¶
public synchronized void getdjcnumdomain (long djcidx, long[] numdomain)
public synchronized long getdjcnumdomain(long djcidx)
Obtains the number of domains in the disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)numdomain
(long
by reference) – Number of domains in the disjunctive constraint. (output)
- Return
(
long
) – Number of domains in the disjunctive constraint.- Groups
- Task.getdjcnumdomaintot¶
public synchronized void getdjcnumdomaintot(long[] numdomaintot)
public synchronized long getdjcnumdomaintot()
Obtains the total number of domains in all disjunctive constraints.
- Parameters
numdomaintot
(long
by reference) – Number of domains in all disjunctive constraints. (output)- Return
(
long
) – Number of domains in all disjunctive constraints.- Groups
- Task.getdjcnumterm¶
public synchronized void getdjcnumterm (long djcidx, long[] numterm)
public synchronized long getdjcnumterm(long djcidx)
Obtains the number terms in the disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)numterm
(long
by reference) – Number of terms in the disjunctive constraint. (output)
- Return
(
long
) – Number of terms in the disjunctive constraint.- Groups
- Task.getdjcnumtermtot¶
public synchronized void getdjcnumtermtot(long[] numtermtot)
public synchronized long getdjcnumtermtot()
Obtains the total number of terms in all disjunctive constraints.
- Parameters
numtermtot
(long
by reference) – Total number of terms in all disjunctive constraints. (output)- Return
(
long
) – Total number of terms in all disjunctive constraints.- Groups
- Task.getdjcs¶
public synchronized void getdjcs (long[] domidxlist, long[] afeidxlist, double[] b, long[] termsizelist, long[] numterms)
Obtains full data of all disjunctive constraints. The output arrays must have minimal lengths determined by the following methods:
domainidxlist
byTask.getdjcnumdomaintot
,afeidxlist
andb
byTask.getdjcnumafetot
,termsizelist
byTask.getdjcnumtermtot
andnumterms
byTask.getnumdomain
.- Parameters
domidxlist
(long
[]
) – The concatenation of index lists of domains appearing in all disjunctive constraints. (output)afeidxlist
(long
[]
) – The concatenation of index lists of affine expressions appearing in all disjunctive constraints. (output)b
(double
[]
) – The concatenation of vectors b appearing in all disjunctive constraints. (output)termsizelist
(long
[]
) – The concatenation of lists of term sizes appearing in all disjunctive constraints. (output)numterms
(long
[]
) – The number of terms in each of the disjunctive constraints. (output)
- Groups
- Task.getdjctermsizelist¶
public synchronized void getdjctermsizelist (long djcidx, long[] termsizelist)
Obtains the list of term sizes in a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)termsizelist
(long
[]
) – List of term sizes. (output)
- Groups
- Task.getdomainn¶
public synchronized void getdomainn (long domidx, long[] n)
public synchronized long getdomainn(long domidx)
Obtains the dimension of the domain.
- Parameters
domidx
(long
) – Index of the domain. (input)n
(long
by reference) – Dimension of the domain. (output)
- Return
(
long
) – Dimension of the domain.- Groups
- Task.getdomainname¶
public synchronized String getdomainname(long domidx)
Obtains the name of a domain.
- Parameters
domidx
(long
) – Index of a domain. (input)- Return
(
String
) – Returns the required name.- Groups
- Task.getdomainnamelen¶
public synchronized void getdomainnamelen (long domidx, int[] len)
public synchronized int getdomainnamelen(long domidx)
Obtains the length of the name of a domain.
- Parameters
domidx
(long
) – Index of a domain. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
- Task.getdomaintype¶
public synchronized void getdomaintype (long domidx, domaintype[] domtype)
public synchronized domaintype getdomaintype(long domidx)
Returns the type of the domain.
- Parameters
domidx
(long
) – Index of the domain. (input)domtype
(mosek.domaintype
by reference) – The type of the domain. (output)domtype
(mosek.domaintype
) – The type of the domain. (output)
- Return
(
mosek.domaintype
) – The type of the domain.- Groups
- Task.getdouinf¶
public synchronized void getdouinf (dinfitem whichdinf, double[] dvalue)
public synchronized double getdouinf(dinfitem whichdinf)
Obtains a double information item from the task information database.
- Parameters
whichdinf
(dinfitem
) – Specifies a double information item. (input)dvalue
(double
by reference) – The value of the required double information item. (output)
- Return
(
double
) – The value of the required double information item.- Groups
- Task.getdouparam¶
public synchronized void getdouparam (dparam param, double[] parvalue)
public synchronized double getdouparam(dparam param)
Obtains the value of a double parameter.
- Parameters
param
(dparam
) – Which parameter. (input)parvalue
(double
by reference) – Parameter value. (output)
- Return
(
double
) – Parameter value.- Groups
- Task.getdualobj¶
public synchronized void getdualobj (soltype whichsol, double[] dualobj)
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
whichsol
(soltype
) – Selects a solution. (input)dualobj
(double
by reference) – Objective value corresponding to the dual solution. (output)
- Groups
- Task.getdualsolutionnorms¶
public synchronized void getdualsolutionnorms (soltype whichsol, double[] nrmy, double[] nrmslc, double[] nrmsuc, double[] nrmslx, double[] nrmsux, double[] nrmsnx, double[] nrmbars)
Compute norms of the dual solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)nrmy
(double
by reference) – The norm of the \(y\) vector. (output)nrmslc
(double
by reference) – The norm of the \(s_l^c\) vector. (output)nrmsuc
(double
by reference) – The norm of the \(s_u^c\) vector. (output)nrmslx
(double
by reference) – The norm of the \(s_l^x\) vector. (output)nrmsux
(double
by reference) – The norm of the \(s_u^x\) vector. (output)nrmsnx
(double
by reference) – The norm of the \(s_n^x\) vector. (output)nrmbars
(double
by reference) – The norm of the \(\barS\) vector. (output)
- Groups
- Task.getdviolacc¶
public synchronized void getdviolacc (soltype whichsol, long[] accidxlist, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)accidxlist
(long
[]
) – An array of indexes of conic constraints. (input)viol
(double
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
. (output)
- Groups
- Task.getdviolbarvar¶
public synchronized void getdviolbarvar (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of \(\barX\) variables. (input)viol
(double
[]
) –viol[k]
is the violation of the solution for the constraint \(\barS_{\mathtt{sub}[k]} \in \PSD\). (output)
- Groups
- Task.getdviolcon¶
public synchronized void getdviolcon (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of constraints. (input)viol
(double
[]
) –viol[k]
is the violation of dual solution associated with the constraintsub[k]
. (output)
- Groups
- Task.getdviolcones Deprecated¶
public synchronized void getdviolcones (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of conic constraints. (input)viol
(double
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
. (output)
- Groups
- Task.getdviolvar¶
public synchronized void getdviolvar (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of \(x\) variables. (input)viol
(double
[]
) –viol[k]
is the violation of dual solution associated with the variablesub[k]
. (output)
- Groups
- Task.getinfeasiblesubproblem¶
public synchronized void getinfeasiblesubproblem (soltype whichsol, Task[] inftask)
public synchronized mosek.Task getinfeasiblesubproblem(soltype whichsol)
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
whichsol
(soltype
) – Which solution to use when determining the infeasible subproblem. (input)inftask
(Task
by reference) – A new task containing the infeasible subproblem. (output)
- Return
(
Task
) – A new task containing the infeasible subproblem.- Groups
- Task.getinfindex¶
public synchronized void getinfindex (inftype inftype, String infname, int[] infindex)
Obtains the index of a named information item.
- Parameters
inftype
(inftype
) – Type of the information item. (input)infname
(String
) – Name of the information item. (input)infindex
(int
by reference) – The item index. (output)
- Groups
- Task.getinfmax¶
public synchronized void getinfmax (inftype inftype, int[] infmax)
Obtains the maximum index of an information item of a given type
inftype
plus 1.- Parameters
inftype
(inftype
) – Type of the information item. (input)infmax
(int
[]
) – The maximum index (plus 1) requested. (output)
- Groups
- Task.getinfname¶
public synchronized void getinfname (inftype inftype, int whichinf, StringBuffer infname)
Obtains the name of an information item.
- Parameters
inftype
(inftype
) – Type of the information item. (input)whichinf
(int
) – An information item. (input)infname
(StringBuffer
) – Name of the information item. (output)
- Groups
- Task.getintinf¶
public synchronized void getintinf (iinfitem whichiinf, int[] ivalue)
public synchronized int getintinf(iinfitem whichiinf)
Obtains an integer information item from the task information database.
- Parameters
whichiinf
(iinfitem
) – Specifies an integer information item. (input)ivalue
(int
by reference) – The value of the required integer information item. (output)
- Return
(
int
) – The value of the required integer information item.- Groups
- Task.getintparam¶
public synchronized void getintparam (iparam param, int[] parvalue)
public synchronized int getintparam(iparam param)
Obtains the value of an integer parameter.
- Parameters
param
(iparam
) – Which parameter. (input)parvalue
(int
by reference) – Parameter value. (output)
- Return
(
int
) – Parameter value.- Groups
- Task.getlenbarvarj¶
public synchronized void getlenbarvarj (int j, long[] lenbarvarj)
public synchronized long getlenbarvarj(int j)
Obtains the length of the \(j\)-th semidefinite variable i.e. the number of elements in the lower triangular part.
- Parameters
j
(int
) – Index of the semidefinite variable whose length if requested. (input)lenbarvarj
(long
by reference) – Number of scalar elements in the lower triangular part of the semidefinite variable. (output)
- Return
(
long
) – Number of scalar elements in the lower triangular part of the semidefinite variable.- Groups
- Task.getlintinf¶
public synchronized void getlintinf (liinfitem whichliinf, long[] ivalue)
public synchronized long getlintinf(liinfitem whichliinf)
Obtains a long integer information item from the task information database.
- Parameters
whichliinf
(liinfitem
) – Specifies a long information item. (input)ivalue
(long
by reference) – The value of the required long integer information item. (output)
- Return
(
long
) – The value of the required long integer information item.- Groups
- Task.getmaxnumanz¶
public synchronized void getmaxnumanz(long[] maxnumanz)
public synchronized long getmaxnumanz()
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
maxnumanz
(long
by reference) – Number of preallocated non-zero linear matrix elements. (output)- Return
(
long
) – Number of preallocated non-zero linear matrix elements.- Groups
- Task.getmaxnumbarvar¶
public synchronized void getmaxnumbarvar(int[] maxnumbarvar)
public synchronized int getmaxnumbarvar()
Obtains maximum number of symmetric matrix variables for which space is currently preallocated.
- Parameters
maxnumbarvar
(int
by reference) – Maximum number of symmetric matrix variables for which space is currently preallocated. (output)- Return
(
int
) – Maximum number of symmetric matrix variables for which space is currently preallocated.- Groups
- Task.getmaxnumcon¶
public synchronized void getmaxnumcon(int[] maxnumcon)
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
maxnumcon
(int
by reference) – Number of preallocated constraints in the optimization task. (output)- Groups
Inspecting the task, Problem data - linear part, Problem data - constraints
- Task.getmaxnumcone Deprecated¶
public synchronized void getmaxnumcone(int[] maxnumcone)
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
maxnumcone
(int
by reference) – Number of preallocated conic constraints in the optimization task. (output)- Groups
- Task.getmaxnumqnz¶
public synchronized void getmaxnumqnz(long[] maxnumqnz)
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
maxnumqnz
(long
by reference) – Number of non-zero elements preallocated in quadratic coefficient matrices. (output)- Groups
- Task.getmaxnumvar¶
public synchronized void getmaxnumvar(int[] maxnumvar)
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
maxnumvar
(int
by reference) – Number of preallocated variables in the optimization task. (output)- Groups
Inspecting the task, Problem data - linear part, Problem data - variables
- Task.getmemusage¶
public synchronized void getmemusage (long[] meminuse, long[] maxmemuse)
Obtains information about the amount of memory used by a task.
- Parameters
meminuse
(long
by reference) – Amount of memory currently used by thetask
. (output)maxmemuse
(long
by reference) – Maximum amount of memory used by thetask
until now. (output)
- Groups
- Task.getnumacc¶
public synchronized void getnumacc(long[] num)
public synchronized long getnumacc()
Obtains the number of affine conic constraints.
- Parameters
num
(long
by reference) – The number of affine conic constraints. (output)- Return
(
long
) – The number of affine conic constraints.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.getnumafe¶
public synchronized void getnumafe(long[] numafe)
public synchronized long getnumafe()
Obtains the number of affine expressions.
- Parameters
numafe
(long
by reference) – Number of affine expressions. (output)- Return
(
long
) – Number of affine expressions.- Groups
- Task.getnumanz¶
public synchronized void getnumanz(int[] numanz)
public synchronized int getnumanz()
Obtains the number of non-zeros in \(A\).
- Parameters
numanz
(int
by reference) – Number of non-zero elements in the linear constraint matrix. (output)- Return
(
int
) – Number of non-zero elements in the linear constraint matrix.- Groups
- Task.getnumanz64¶
public synchronized void getnumanz64(long[] numanz)
public synchronized long getnumanz64()
Obtains the number of non-zeros in \(A\).
- Parameters
numanz
(long
by reference) – Number of non-zero elements in the linear constraint matrix. (output)- Return
(
long
) – Number of non-zero elements in the linear constraint matrix.- Groups
- Task.getnumbarablocktriplets¶
public synchronized void getnumbarablocktriplets(long[] num)
public synchronized long getnumbarablocktriplets()
Obtains an upper bound on the number of elements in the block triplet form of \(\barA\).
- Parameters
num
(long
by reference) – An upper bound on the number of elements in the block triplet form of \(\barA.\) (output)- Return
(
long
) – An upper bound on the number of elements in the block triplet form of \(\barA.\)- Groups
- Task.getnumbaranz¶
public synchronized void getnumbaranz(long[] nz)
public synchronized long getnumbaranz()
Get the number of nonzero elements in \(\barA\).
- Parameters
nz
(long
by reference) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero. (output)- Return
(
long
) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero.- Groups
- Task.getnumbarcblocktriplets¶
public synchronized void getnumbarcblocktriplets(long[] num)
public synchronized long getnumbarcblocktriplets()
Obtains an upper bound on the number of elements in the block triplet form of \(\barC\).
- Parameters
num
(long
by reference) – An upper bound on the number of elements in the block triplet form of \(\barC.\) (output)- Return
(
long
) – An upper bound on the number of elements in the block triplet form of \(\barC.\)- Groups
- Task.getnumbarcnz¶
public synchronized void getnumbarcnz(long[] nz)
public synchronized long getnumbarcnz()
Obtains the number of nonzero elements in \(\barC\).
- Parameters
nz
(long
by reference) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero. (output)- Return
(
long
) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero.- Groups
- Task.getnumbarvar¶
public synchronized void getnumbarvar(int[] numbarvar)
public synchronized int getnumbarvar()
Obtains the number of semidefinite variables.
- Parameters
numbarvar
(int
by reference) – Number of semidefinite variables in the problem. (output)- Return
(
int
) – Number of semidefinite variables in the problem.- Groups
- Task.getnumcon¶
public synchronized void getnumcon(int[] numcon)
public synchronized int getnumcon()
Obtains the number of constraints.
- Parameters
numcon
(int
by reference) – Number of constraints. (output)- Return
(
int
) – Number of constraints.- Groups
Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.getnumcone Deprecated¶
public synchronized void getnumcone(int[] numcone)
public synchronized int getnumcone()
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
numcone
(int
by reference) – Number of conic constraints. (output)- Return
(
int
) – Number of conic constraints.- Groups
- Task.getnumconemem Deprecated¶
public synchronized void getnumconemem (int k, int[] nummem)
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
k
(int
) – Index of the cone. (input)nummem
(int
by reference) – Number of member variables in the cone. (output)
- Groups
- Task.getnumdjc¶
public synchronized void getnumdjc(long[] num)
public synchronized long getnumdjc()
Obtains the number of disjunctive constraints.
- Parameters
num
(long
by reference) – The number of disjunctive constraints. (output)- Return
(
long
) – The number of disjunctive constraints.- Groups
- Task.getnumdomain¶
public synchronized void getnumdomain(long[] numdomain)
public synchronized long getnumdomain()
Obtain the number of domains defined.
- Parameters
numdomain
(long
by reference) – Number of domains in the task. (output)- Return
(
long
) – Number of domains in the task.- Groups
- Task.getnumintvar¶
public synchronized void getnumintvar(int[] numintvar)
public synchronized int getnumintvar()
Obtains the number of integer-constrained variables.
- Parameters
numintvar
(int
by reference) – Number of integer variables. (output)- Return
(
int
) – Number of integer variables.- Groups
- Task.getnumparam¶
public synchronized void getnumparam (parametertype partype, int[] numparam)
Obtains the number of parameters of a given type.
- Parameters
partype
(parametertype
) – Parameter type. (input)numparam
(int
by reference) – The number of parameters of typepartype
. (output)
- Groups
- Task.getnumqconknz¶
public synchronized void getnumqconknz (int k, long[] numqcnz)
public synchronized long getnumqconknz(int k)
Obtains the number of non-zero quadratic terms in a constraint.
- Parameters
k
(int
) – Index of the constraint for which the number quadratic terms should be obtained. (input)numqcnz
(long
by reference) – Number of quadratic terms. (output)
- Return
(
long
) – Number of quadratic terms.- Groups
Inspecting the task, Problem data - constraints, Problem data - quadratic part
- Task.getnumqobjnz¶
public synchronized void getnumqobjnz(long[] numqonz)
public synchronized long getnumqobjnz()
Obtains the number of non-zero quadratic terms in the objective.
- Parameters
numqonz
(long
by reference) – Number of non-zero elements in the quadratic objective terms. (output)- Return
(
long
) – Number of non-zero elements in the quadratic objective terms.- Groups
- Task.getnumsymmat¶
public synchronized void getnumsymmat(long[] num)
Obtains the number of symmetric matrices stored in the vector \(E\).
- Parameters
num
(long
by reference) – The number of symmetric sparse matrices. (output)- Groups
- Task.getnumvar¶
public synchronized void getnumvar(int[] numvar)
public synchronized int getnumvar()
Obtains the number of variables.
- Parameters
numvar
(int
by reference) – Number of variables. (output)- Return
(
int
) – Number of variables.- Groups
- Task.getobjname¶
public synchronized String getobjname()
Obtains the name assigned to the objective function.
- Return
(
String
) – Assigned the objective name.- Groups
- Task.getobjnamelen¶
public synchronized void getobjnamelen(int[] len)
public synchronized int getobjnamelen()
Obtains the length of the name assigned to the objective function.
- Parameters
len
(int
by reference) – Assigned the length of the objective name. (output)- Return
(
int
) – Assigned the length of the objective name.- Groups
- Task.getobjsense¶
public synchronized void getobjsense(objsense[] sense)
public synchronized objsense getobjsense()
Gets the objective sense of the task.
- Parameters
sense
(mosek.objsense
by reference) – The returned objective sense. (output)sense
(mosek.objsense
) – The returned objective sense. (output)
- Return
(
mosek.objsense
) – The returned objective sense.- Groups
- Task.getparammax¶
public synchronized void getparammax (parametertype partype, int[] parammax)
Obtains the maximum index of a parameter of type
partype
plus 1.- Parameters
partype
(parametertype
) – Parameter type. (input)parammax
(int
by reference) – The maximum index (plus 1) of the given parameter type. (output)
- Groups
- Task.getparamname¶
public synchronized void getparamname (parametertype partype, int param, StringBuffer parname)
Obtains the name for a parameter
param
of typepartype
.- Parameters
partype
(parametertype
) – Parameter type. (input)param
(int
) – Which parameter. (input)parname
(StringBuffer
) – Parameter name. (output)
- Groups
- Task.getpowerdomainalpha¶
public synchronized void getpowerdomainalpha (long domidx, double[] alpha)
Obtains the exponent vector \(\alpha\) of a primal or dual power cone domain.
- Parameters
domidx
(long
) – Index of the domain. (input)alpha
(double
[]
) – The vector \(\alpha\). (output)
- Groups
- Task.getpowerdomaininfo¶
public synchronized void getpowerdomaininfo (long domidx, long[] n, long[] nleft)
Obtains structural information about a primal or dual power cone domain.
- Parameters
domidx
(long
) – Index of the domain. (input)n
(long
by reference) – Dimension of the domain. (output)nleft
(long
by reference) – Number of variables on the left hand side. (output)
- Groups
- Task.getprimalobj¶
public synchronized void getprimalobj (soltype whichsol, double[] primalobj)
public synchronized double getprimalobj(soltype whichsol)
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
whichsol
(soltype
) – Selects a solution. (input)primalobj
(double
by reference) – Objective value corresponding to the primal solution. (output)
- Return
(
double
) – Objective value corresponding to the primal solution.- Groups
- Task.getprimalsolutionnorms¶
public synchronized void getprimalsolutionnorms (soltype whichsol, double[] nrmxc, double[] nrmxx, double[] nrmbarx)
Compute norms of the primal solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)nrmxc
(double
by reference) – The norm of the \(x^c\) vector. (output)nrmxx
(double
by reference) – The norm of the \(x\) vector. (output)nrmbarx
(double
by reference) – The norm of the \(\barX\) vector. (output)
- Groups
- Task.getprobtype¶
public synchronized void getprobtype(problemtype[] probtype)
public synchronized problemtype getprobtype()
Obtains the problem type.
- Parameters
probtype
(mosek.problemtype
by reference) – The problem type. (output)probtype
(mosek.problemtype
) – The problem type. (output)
- Return
(
mosek.problemtype
) – The problem type.- Groups
- Task.getprosta¶
public synchronized void getprosta (soltype whichsol, prosta[] problemsta)
public synchronized prosta getprosta(soltype whichsol)
Obtains the problem status.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)problemsta
(mosek.prosta
by reference) – Problem status. (output)problemsta
(mosek.prosta
) – Problem status. (output)
- Return
(
mosek.prosta
) – Problem status.- Groups
- Task.getpviolacc¶
public synchronized void getpviolacc (soltype whichsol, long[] accidxlist, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)accidxlist
(long
[]
) – An array of indexes of conic constraints. (input)viol
(double
[]
) –viol[k]
is the violation of the solution associated with the affine conic constraint numberaccidxlist[k]
. (output)
- Groups
- Task.getpviolbarvar¶
public synchronized void getpviolbarvar (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of \(\barX\) variables. (input)viol
(double
[]
) –viol[k]
is how much the solution violates the constraint \(\barX_{\mathtt{sub}[k]} \in \PSD\). (output)
- Groups
- Task.getpviolcon¶
public synchronized void getpviolcon (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of constraints. (input)viol
(double
[]
) –viol[k]
is the violation associated with the solution for the constraintsub[k]
. (output)
- Groups
- Task.getpviolcones Deprecated¶
public synchronized void getpviolcones (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of conic constraints. (input)viol
(double
[]
) –viol[k]
is the violation of the solution associated with the conic constraint numbersub[k]
. (output)
- Groups
- Task.getpvioldjc¶
public synchronized void getpvioldjc (soltype whichsol, long[] djcidxlist, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)djcidxlist
(long
[]
) – An array of indexes of disjunctive constraints. (input)viol
(double
[]
) –viol[k]
is the violation of the solution associated with the disjunctive constraint numberdjcidxlist[k]
. (output)
- Groups
- Task.getpviolvar¶
public synchronized void getpviolvar (soltype whichsol, int[] sub, double[] viol)
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
whichsol
(soltype
) – Selects a solution. (input)sub
(int
[]
) – An array of indexes of \(x\) variables. (input)viol
(double
[]
) –viol[k]
is the violation associated with the solution for the variable \(x_\mathtt{sub[k]}\). (output)
- Groups
- Task.getqconk¶
public synchronized void getqconk (int k, long[] numqcnz, int[] qcsubi, int[] qcsubj, double[] qcval)
public synchronized long getqconk (int k, int[] qcsubi, int[] qcsubj, double[] qcval)
Obtains all the quadratic terms in a constraint. The quadratic terms are stored sequentially in
qcsubi
,qcsubj
, andqcval
.- Parameters
k
(int
) – Which constraint. (input)numqcnz
(long
by reference) – Number of quadratic terms. (output)qcsubi
(int
[]
) – Row subscripts for quadratic constraint matrix. (output)qcsubj
(int
[]
) – Column subscripts for quadratic constraint matrix. (output)qcval
(double
[]
) – Quadratic constraint coefficient values. (output)
- Return
(
long
) – Number of quadratic terms.- Groups
Inspecting the task, Problem data - quadratic part, Problem data - constraints
- Task.getqobj¶
public synchronized void getqobj (long[] numqonz, int[] qosubi, int[] qosubj, double[] qoval)
Obtains the quadratic terms in the objective. The required quadratic terms are stored sequentially in
qosubi
,qosubj
, andqoval
.- Parameters
numqonz
(long
by reference) – Number of non-zero elements in the quadratic objective terms. (output)qosubi
(int
[]
) – Row subscripts for quadratic objective coefficients. (output)qosubj
(int
[]
) – Column subscripts for quadratic objective coefficients. (output)qoval
(double
[]
) – Quadratic objective coefficient values. (output)
- Groups
- Task.getqobjij¶
public synchronized void getqobjij (int i, int j, double[] qoij)
Obtains one coefficient \(q_{ij}^o\) in the quadratic term of the objective.
- Parameters
i
(int
) – Row index of the coefficient. (input)j
(int
) – Column index of coefficient. (input)qoij
(double
by reference) – The required coefficient. (output)
- Groups
- Task.getreducedcosts¶
public synchronized void getreducedcosts (soltype whichsol, int first, int last, double[] redcosts)
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
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – The index of the first variable in the sequence. (input)last
(int
) – The index of the last variable in the sequence plus 1. (input)redcosts
(double
[]
) – The reduced costs for the required slice of variables. (output)
- Groups
- Task.getskc¶
public synchronized void getskc (soltype whichsol, stakey[] skc)
public synchronized mosek.stakey[] getskc(soltype whichsol)
Obtains the status keys for the constraints.
- Parameters
- Return
(
stakey
[]
) – Status keys for the constraints.- Groups
- Task.getskcslice¶
public synchronized void getskcslice (soltype whichsol, int first, int last, stakey[] skc)
public synchronized mosek.stakey[] getskcslice (soltype whichsol, int first, int last)
Obtains the status keys for a slice of the constraints.
- Parameters
- Return
(
stakey
[]
) – Status keys for the constraints.- Groups
- Task.getskn¶
public synchronized void getskn (soltype whichsol, stakey[] skn)
public synchronized mosek.stakey[] getskn(soltype whichsol)
Obtains the status keys for the conic constraints.
- Parameters
- Return
(
stakey
[]
) – Status keys for the conic constraints.- Groups
- Task.getskx¶
public synchronized void getskx (soltype whichsol, stakey[] skx)
public synchronized mosek.stakey[] getskx(soltype whichsol)
Obtains the status keys for the scalar variables.
- Parameters
- Return
(
stakey
[]
) – Status keys for the variables.- Groups
- Task.getskxslice¶
public synchronized void getskxslice (soltype whichsol, int first, int last, stakey[] skx)
public synchronized mosek.stakey[] getskxslice (soltype whichsol, int first, int last)
Obtains the status keys for a slice of the scalar variables.
- Parameters
- Return
(
stakey
[]
) – Status keys for the variables.- Groups
- Task.getslc¶
public synchronized void getslc (soltype whichsol, double[] slc)
public synchronized double[] getslc(soltype whichsol)
Obtains the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)
- Return
(
double
[]
) – Dual variables corresponding to the lower bounds on the constraints.- Groups
- Task.getslcslice¶
public synchronized void getslcslice (soltype whichsol, int first, int last, double[] slc)
public synchronized double[] getslcslice (soltype whichsol, int first, int last)
Obtains a slice of the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)
- Return
(
double
[]
) – Dual variables corresponding to the lower bounds on the constraints.- Groups
- Task.getslx¶
public synchronized void getslx (soltype whichsol, double[] slx)
public synchronized double[] getslx(soltype whichsol)
Obtains the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the lower bounds on the variables.- Groups
- Task.getslxslice¶
public synchronized void getslxslice (soltype whichsol, int first, int last, double[] slx)
public synchronized double[] getslxslice (soltype whichsol, int first, int last)
Obtains a slice of the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the lower bounds on the variables.- Groups
- Task.getsnx¶
public synchronized void getsnx (soltype whichsol, double[] snx)
public synchronized double[] getsnx(soltype whichsol)
Obtains the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the conic constraints on the variables.- Groups
- Task.getsnxslice¶
public synchronized void getsnxslice (soltype whichsol, int first, int last, double[] snx)
public synchronized double[] getsnxslice (soltype whichsol, int first, int last)
Obtains a slice of the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the conic constraints on the variables.- Groups
- Task.getsolsta¶
public synchronized void getsolsta (soltype whichsol, solsta[] solutionsta)
public synchronized solsta getsolsta(soltype whichsol)
Obtains the solution status.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)solutionsta
(mosek.solsta
by reference) – Solution status. (output)solutionsta
(mosek.solsta
) – Solution status. (output)
- Return
(
mosek.solsta
) – Solution status.- Groups
- Task.getsolution¶
public synchronized void getsolution (soltype whichsol, prosta[] problemsta, solsta[] solutionsta, stakey[] skc, stakey[] skx, stakey[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx)
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:solsta.optimal
: An optimal solution satisfying the optimality criteria for continuous problems is returned.solsta.integer_optimal
: An optimal solution satisfying the optimality criteria for integer problems is returned.solsta.prim_feas
: A solution satisfying the feasibility criteria.solsta.prim_infeas_cer
: A primal certificate of infeasibility is returned.solsta.dual_infeas_cer
: A dual certificate of infeasibility is returned.
In order to retrieve the primal and dual values of semidefinite variables see
Task.getbarxj
andTask.getbarsj
.- Parameters
whichsol
(soltype
) – Selects a solution. (input)problemsta
(mosek.prosta
by reference) – Problem status. (output)solutionsta
(mosek.solsta
by reference) – Solution status. (output)skc
(stakey
[]
) – Status keys for the constraints. (output)skx
(stakey
[]
) – Status keys for the variables. (output)skn
(stakey
[]
) – Status keys for the conic constraints. (output)xc
(double
[]
) – Primal constraint solution. (output)xx
(double
[]
) – Primal variable solution. (output)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (output)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Groups
- Task.getsolutioninfo¶
public synchronized void getsolutioninfo (soltype whichsol, double[] pobj, double[] pviolcon, double[] pviolvar, double[] pviolbarvar, double[] pviolcone, double[] pviolitg, double[] dobj, double[] dviolcon, double[] dviolvar, double[] dviolbarvar, double[] dviolcone)
Obtains information about a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)pobj
(double
by reference) – The primal objective value as computed byTask.getprimalobj
. (output)pviolcon
(double
by reference) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed byTask.getpviolcon
. (output)pviolvar
(double
by reference) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed byTask.getpviolvar
. (output)pviolbarvar
(double
by reference) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed byTask.getpviolbarvar
. (output)pviolcone
(double
by reference) – Maximal primal violation of solution for the conic constraints where the violations are computed byTask.getpviolcones
. (output)pviolitg
(double
by reference) – 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. (output)dobj
(double
by reference) – Dual objective value as computed byTask.getdualobj
. (output)dviolcon
(double
by reference) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed byTask.getdviolcon
. (output)dviolvar
(double
by reference) – Maximal violation of the dual solution associated with the \(x\) variable as computed byTask.getdviolvar
. (output)dviolbarvar
(double
by reference) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed byTask.getdviolbarvar
. (output)dviolcone
(double
by reference) – Maximal violation of the dual solution associated with the dual conic constraints as computed byTask.getdviolcones
. (output)
- Groups
- Task.getsolutioninfonew¶
public synchronized void getsolutioninfonew (soltype whichsol, double[] pobj, double[] pviolcon, double[] pviolvar, double[] pviolbarvar, double[] pviolcone, double[] pviolacc, double[] pvioldjc, double[] pviolitg, double[] dobj, double[] dviolcon, double[] dviolvar, double[] dviolbarvar, double[] dviolcone, double[] dviolacc)
Obtains information about a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)pobj
(double
by reference) – The primal objective value as computed byTask.getprimalobj
. (output)pviolcon
(double
by reference) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed byTask.getpviolcon
. (output)pviolvar
(double
by reference) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed byTask.getpviolvar
. (output)pviolbarvar
(double
by reference) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed byTask.getpviolbarvar
. (output)pviolcone
(double
by reference) – Maximal primal violation of solution for the conic constraints where the violations are computed byTask.getpviolcones
. (output)pviolacc
(double
by reference) – Maximal primal violation of solution for the affine conic constraints where the violations are computed byTask.getpviolacc
. (output)pvioldjc
(double
by reference) – Maximal primal violation of solution for the disjunctive constraints where the violations are computed byTask.getpvioldjc
. (output)pviolitg
(double
by reference) – 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. (output)dobj
(double
by reference) – Dual objective value as computed byTask.getdualobj
. (output)dviolcon
(double
by reference) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed byTask.getdviolcon
. (output)dviolvar
(double
by reference) – Maximal violation of the dual solution associated with the \(x\) variable as computed byTask.getdviolvar
. (output)dviolbarvar
(double
by reference) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed byTask.getdviolbarvar
. (output)dviolcone
(double
by reference) – Maximal violation of the dual solution associated with the dual conic constraints as computed byTask.getdviolcones
. (output)dviolacc
(double
by reference) – Maximal violation of the dual solution associated with the affine conic constraints as computed byTask.getdviolacc
. (output)
- Groups
- Task.getsolutionnew¶
public synchronized void getsolutionnew (soltype whichsol, prosta[] problemsta, solsta[] solutionsta, stakey[] skc, stakey[] skx, stakey[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx, double[] doty)
Obtains the complete solution. See
Task.getsolution
for further information.In order to retrieve the primal and dual values of semidefinite variables see
Task.getbarxj
andTask.getbarsj
.- Parameters
whichsol
(soltype
) – Selects a solution. (input)problemsta
(mosek.prosta
by reference) – Problem status. (output)solutionsta
(mosek.solsta
by reference) – Solution status. (output)skc
(stakey
[]
) – Status keys for the constraints. (output)skx
(stakey
[]
) – Status keys for the variables. (output)skn
(stakey
[]
) – Status keys for the conic constraints. (output)xc
(double
[]
) – Primal constraint solution. (output)xx
(double
[]
) – Primal variable solution. (output)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (output)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)doty
(double
[]
) – Dual variables corresponding to affine conic constraints. (output)
- Groups
- Task.getsolutionslice¶
public synchronized void getsolutionslice (soltype whichsol, solitem solitem, int first, int last, double[] values)
Obtains a slice of one item from the solution. The format of the solution is exactly as in
Task.getsolution
. The parametersolitem
determines which of the solution vectors should be returned.- Parameters
whichsol
(soltype
) – Selects a solution. (input)solitem
(solitem
) – Which part of the solution is required. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)values
(double
[]
) – The values in the required sequence are stored sequentially invalues
. (output)
- Groups
- Task.getsparsesymmat¶
public synchronized void getsparsesymmat (long idx, int[] subi, int[] subj, double[] valij)
Get a single symmetric matrix from the matrix store.
- Parameters
idx
(long
) – Index of the matrix to retrieve. (input)subi
(int
[]
) – Row subscripts of the matrix non-zero elements. (output)subj
(int
[]
) – Column subscripts of the matrix non-zero elements. (output)valij
(double
[]
) – Coefficients of the matrix non-zero elements. (output)
- Groups
- Task.getstrparam¶
public synchronized String getstrparam (sparam param, int[] len)
Obtains the value of a string parameter.
- Parameters
param
(sparam
) – Which parameter. (input)len
(int
by reference) – The length of the parameter value. (output)
- Return
(
String
) – Parameter value.- Groups
- Task.getstrparamlen¶
public synchronized void getstrparamlen (sparam param, int[] len)
public synchronized int getstrparamlen(sparam param)
Obtains the length of a string parameter.
- Parameters
param
(sparam
) – Which parameter. (input)len
(int
by reference) – The length of the parameter value. (output)
- Return
(
int
) – The length of the parameter value.- Groups
- Task.getsuc¶
public synchronized void getsuc (soltype whichsol, double[] suc)
public synchronized double[] getsuc(soltype whichsol)
Obtains the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)
- Return
(
double
[]
) – Dual variables corresponding to the upper bounds on the constraints.- Groups
- Task.getsucslice¶
public synchronized void getsucslice (soltype whichsol, int first, int last, double[] suc)
public synchronized double[] getsucslice (soltype whichsol, int first, int last)
Obtains a slice of the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)
- Return
(
double
[]
) – Dual variables corresponding to the upper bounds on the constraints.- Groups
- Task.getsux¶
public synchronized void getsux (soltype whichsol, double[] sux)
public synchronized double[] getsux(soltype whichsol)
Obtains the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the upper bounds on the variables.- Groups
- Task.getsuxslice¶
public synchronized void getsuxslice (soltype whichsol, int first, int last, double[] sux)
public synchronized double[] getsuxslice (soltype whichsol, int first, int last)
Obtains a slice of the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)
- Return
(
double
[]
) – Dual variables corresponding to the upper bounds on the variables.- Groups
- Task.getsymmatinfo¶
public synchronized void getsymmatinfo (long idx, int[] dim, long[] nz, symmattype[] mattype)
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
idx
(long
) – Index of the matrix for which information is requested. (input)dim
(int
by reference) – Returns the dimension of the requested matrix. (output)nz
(long
by reference) – Returns the number of non-zeros in the requested matrix. (output)mattype
(mosek.symmattype
by reference) – Returns the type of the requested matrix. (output)
- Groups
- Task.gettaskname¶
public synchronized String gettaskname()
Obtains the name assigned to the task.
- Return
(
String
) – Returns the task name.- Groups
- Task.gettasknamelen¶
public synchronized void gettasknamelen(int[] len)
public synchronized int gettasknamelen()
Obtains the length the task name.
- Parameters
len
(int
by reference) – Returns the length of the task name. (output)- Return
(
int
) – Returns the length of the task name.- Groups
- Task.getvarbound¶
public synchronized void getvarbound (int i, boundkey[] bk, double[] bl, double[] bu)
Obtains bound information for one variable.
- Parameters
i
(int
) – Index of the variable for which the bound information should be obtained. (input)bk
(mosek.boundkey
by reference) – Bound keys. (output)bl
(double
by reference) – Values for lower bounds. (output)bu
(double
by reference) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- Task.getvarboundslice¶
public synchronized void getvarboundslice (int first, int last, boundkey[] bk, double[] bl, double[] bu)
Obtains bounds information for a slice of the variables.
- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bk
(boundkey
[]
) – Bound keys. (output)bl
(double
[]
) – Values for lower bounds. (output)bu
(double
[]
) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- Task.getvarname¶
public synchronized String getvarname(int j)
Obtains the name of a variable.
- Parameters
j
(int
) – Index of a variable. (input)- Return
(
String
) – Returns the required name.- Groups
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- Task.getvarnameindex¶
public synchronized void getvarnameindex (String somename, int[] asgn, int[] index)
public synchronized int getvarnameindex (String somename, int[] asgn)
Checks whether the name
somename
has been assigned to any variable. If so, the index of the variable is reported.- Parameters
somename
(String
) – The name which should be checked. (input)asgn
(int
by reference) – Is non-zero if the namesomename
is assigned to a variable. (output)index
(int
by reference) – If the namesomename
is assigned to a variable, thenindex
is the index of the variable. (output)
- Return
(
int
) – 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
- Task.getvarnamelen¶
public synchronized void getvarnamelen (int i, int[] len)
public synchronized int getvarnamelen(int i)
Obtains the length of the name of a variable.
- Parameters
i
(int
) – Index of a variable. (input)len
(int
by reference) – Returns the length of the indicated name. (output)
- Return
(
int
) – Returns the length of the indicated name.- Groups
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- Task.getvartype¶
public synchronized void getvartype (int j, variabletype[] vartype)
public synchronized variabletype getvartype(int j)
Gets the variable type of one variable.
- Parameters
j
(int
) – Index of the variable. (input)vartype
(mosek.variabletype
by reference) – Variable type of the \(j\)-th variable. (output)vartype
(mosek.variabletype
) – Variable type of the \(j\)-th variable. (output)
- Return
(
mosek.variabletype
) – Variable type of the \(j\)-th variable.- Groups
- Task.getvartypelist¶
public synchronized void getvartypelist (int[] subj, variabletype[] vartype)
Obtains the variable type of one or more variables. Upon return
vartype[k]
is the variable type of variablesubj[k]
.- Parameters
subj
(int
[]
) – A list of variable indexes. (input)vartype
(variabletype
[]
) – The variables types corresponding to the variables specified bysubj
. (output)
- Groups
- Task.getxc¶
public synchronized void getxc (soltype whichsol, double[] xc)
public synchronized double[] getxc(soltype whichsol)
Obtains the \(x^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)xc
(double
[]
) – Primal constraint solution. (output)
- Return
(
double
[]
) – Primal constraint solution.- Groups
- Task.getxcslice¶
public synchronized void getxcslice (soltype whichsol, int first, int last, double[] xc)
public synchronized double[] getxcslice (soltype whichsol, int first, int last)
Obtains a slice of the \(x^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)xc
(double
[]
) – Primal constraint solution. (output)
- Return
(
double
[]
) – Primal constraint solution.- Groups
- Task.getxx¶
public synchronized void getxx (soltype whichsol, double[] xx)
public synchronized double[] getxx(soltype whichsol)
Obtains the \(x^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)xx
(double
[]
) – Primal variable solution. (output)
- Return
(
double
[]
) – Primal variable solution.- Groups
- Task.getxxslice¶
public synchronized void getxxslice (soltype whichsol, int first, int last, double[] xx)
public synchronized double[] getxxslice (soltype whichsol, int first, int last)
Obtains a slice of the \(x^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)xx
(double
[]
) – Primal variable solution. (output)
- Return
(
double
[]
) – Primal variable solution.- Groups
- Task.gety¶
public synchronized void gety (soltype whichsol, double[] y)
public synchronized double[] gety(soltype whichsol)
Obtains the \(y\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (output)
- Return
(
double
[]
) – Vector of dual variables corresponding to the constraints.- Groups
- Task.getyslice¶
public synchronized void getyslice (soltype whichsol, int first, int last, double[] y)
public synchronized double[] getyslice (soltype whichsol, int first, int last)
Obtains a slice of the \(y\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (output)
- Return
(
double
[]
) – Vector of dual variables corresponding to the constraints.- Groups
- Task.infeasibilityreport¶
public synchronized void infeasibilityreport (streamtype whichstream, soltype whichsol)
Prints the infeasibility report to an output stream.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)whichsol
(soltype
) – Selects a solution. (input)
- Groups
- Task.initbasissolve¶
public synchronized void initbasissolve(int[] basis)
Prepare a task for use with the
Task.solvewithbasis
function.This function should be called
immediately before the first call to
Task.solvewithbasis
, andimmediately before any subsequent call to
Task.solvewithbasis
if the task has been modified.
If the basis is singular i.e. not invertible, then the error
rescode.err_basis_singular
is reported.- Parameters
basis
(int
[]
) – 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\). (output)- Groups
- Task.inputdata¶
public synchronized void inputdata (int maxnumcon, int maxnumvar, double[] c, double cfix, int[] aptrb, int[] aptre, int[] asub, double[] aval, boundkey[] bkc, double[] blc, double[] buc, boundkey[] bkx, double[] blx, double[] bux)
public synchronized void inputdata (int maxnumcon, int maxnumvar, double[] c, double cfix, long[] aptrb, long[] aptre, int[] asub, double[] aval, boundkey[] bkc, double[] blc, double[] buc, boundkey[] bkx, double[] blx, double[] bux)
Input the linear part of an optimization task in one function call.
- Parameters
maxnumcon
(int
) – Number of preallocated constraints in the optimization task. (input)maxnumvar
(int
) – Number of preallocated variables in the optimization task. (input)c
(double
[]
) – Linear terms of the objective as a dense vector. The length is the number of variables. (input)cfix
(double
) – Fixed term in the objective. (input)aptrb
(int
[]
) – Row or column start pointers. (input)aptrb
(long
[]
) – Row or column start pointers. (input)aptre
(int
[]
) – Row or column end pointers. (input)aptre
(long
[]
) – Row or column end pointers. (input)asub
(int
[]
) – Coefficient subscripts. (input)aval
(double
[]
) – Coefficient values. (input)bkc
(boundkey
[]
) – Bound keys for the constraints. (input)blc
(double
[]
) – Lower bounds for the constraints. (input)buc
(double
[]
) – Upper bounds for the constraints. (input)bkx
(boundkey
[]
) – Bound keys for the variables. (input)blx
(double
[]
) – Lower bounds for the variables. (input)bux
(double
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - bounds, Problem data - constraints
- Task.isdouparname¶
public synchronized void isdouparname (String parname, dparam[] param)
Checks whether
parname
is a valid double parameter name.- Parameters
parname
(String
) – Parameter name. (input)param
(mosek.dparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.isintparname¶
public synchronized void isintparname (String parname, iparam[] param)
Checks whether
parname
is a valid integer parameter name.- Parameters
parname
(String
) – Parameter name. (input)param
(mosek.iparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.isstrparname¶
public synchronized void isstrparname (String parname, sparam[] param)
Checks whether
parname
is a valid string parameter name.- Parameters
parname
(String
) – Parameter name. (input)param
(mosek.sparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.linkfiletostream¶
public synchronized void linkfiletostream (streamtype whichstream, String filename, int append)
Directs all output from a task stream
whichstream
to a filefilename
.- Parameters
whichstream
(streamtype
) – Index of the stream. (input)filename
(String
) – A valid file name. (input)append
(int
) – If this argument is 0 the output file will be overwritten, otherwise it will be appended to. (input)
- Groups
- Task.onesolutionsummary¶
public synchronized void onesolutionsummary (streamtype whichstream, soltype whichsol)
Prints a short summary of a specified solution.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)whichsol
(soltype
) – Selects a solution. (input)
- Groups
- Task.optimize¶
public synchronized void optimize(rescode[] trmcode)
public synchronized rescode optimize()
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
iparam.optimizer
.- Parameters
trmcode
(mosek.rescode
by reference) – Is eitherrescode.ok
or a termination response code. (output)trmcode
(mosek.rescode
) – Is eitherrescode.ok
or a termination response code. (output)
- Return
(
mosek.rescode
) – Is eitherrescode.ok
or a termination response code.- Groups
- Task.optimizermt¶
public synchronized void optimizermt (String address, String accesstoken, rescode[] trmcode)
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
sparam.remote_tls_cert
orsparam.remote_tls_cert_path
.- Parameters
address
(String
) – Address of the OptServer. (input)accesstoken
(String
) – Access token. (input)trmcode
(mosek.rescode
by reference) – Is eitherrescode.ok
or a termination response code. (output)
- Groups
- Task.optimizersummary¶
public synchronized void optimizersummary(streamtype whichstream)
Prints a short summary with optimizer statistics from last optimization.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)- Groups
- Task.primalrepair¶
public synchronized void primalrepair (double[] wlc, double[] wuc, double[] wlx, double[] wux)
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
iparam.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
wlc
(double
[]
) – \((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 isnull
, then all the weights are assumed to be \(1\). (input)wuc
(double
[]
) – \((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 isnull
, then all the weights are assumed to be \(1\). (input)wlx
(double
[]
) – \((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 isnull
, then all the weights are assumed to be \(1\). (input)wux
(double
[]
) – \((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 isnull
, then all the weights are assumed to be \(1\). (input)
- Groups
- Task.primalsensitivity¶
public synchronized void primalsensitivity (int[] subi, mark[] marki, int[] subj, mark[] markj, double[] leftpricei, double[] rightpricei, double[] leftrangei, double[] rightrangei, double[] leftpricej, double[] rightpricej, double[] leftrangej, double[] rightrangej)
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
iparam.sensitivity_type
.- Parameters
subi
(int
[]
) – 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]
=mark.up
the upper bound of constraintsubi[i]
is analyzed, and ifmarki[i]
=mark.lo
the lower bound is analyzed. Ifsubi[i]
is an equality constraint, eithermark.lo
ormark.up
can be used to select the constraint for sensitivity analysis. (input)subj
(int
[]
) – 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]
=mark.up
the upper bound of variablesubj[j]
is analyzed, and ifmarkj[j]
=mark.lo
the lower bound is analyzed. Ifsubj[j]
is a fixed variable, eithermark.lo
ormark.up
can be used to select the bound for sensitivity analysis. (input)leftpricei
(double
[]
) –leftpricei[i]
is the left shadow price for the boundmarki[i]
of constraintsubi[i]
. (output)rightpricei
(double
[]
) –rightpricei[i]
is the right shadow price for the boundmarki[i]
of constraintsubi[i]
. (output)leftrangei
(double
[]
) –leftrangei[i]
is the left range \(\beta_1\) for the boundmarki[i]
of constraintsubi[i]
. (output)rightrangei
(double
[]
) –rightrangei[i]
is the right range \(\beta_2\) for the boundmarki[i]
of constraintsubi[i]
. (output)leftpricej
(double
[]
) –leftpricej[j]
is the left shadow price for the boundmarkj[j]
of variablesubj[j]
. (output)rightpricej
(double
[]
) –rightpricej[j]
is the right shadow price for the boundmarkj[j]
of variablesubj[j]
. (output)leftrangej
(double
[]
) –leftrangej[j]
is the left range \(\beta_1\) for the boundmarkj[j]
of variablesubj[j]
. (output)rightrangej
(double
[]
) –rightrangej[j]
is the right range \(\beta_2\) for the boundmarkj[j]
of variablesubj[j]
. (output)
- Groups
- Task.putacc¶
public synchronized void putacc (long accidx, long domidx, long[] afeidxlist, double[] b)
Puts an affine conic constraint. This method overwrites an existing affine conic constraint number
accidx
with new data specified in the same format as inTask.appendacc
.- Parameters
accidx
(long
) – Affine conic constraint index. (input)domidx
(long
) – Domain index. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.putaccb¶
public synchronized void putaccb (long accidx, double[] b)
Updates an existing affine conic constraint number
accidx
by putting a new vector \(b\).- Parameters
accidx
(long
) – Affine conic constraint index. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.putaccbj¶
public synchronized void putaccbj (long accidx, long j, double bj)
Sets one value \(b[j]\) in the \(b\) vector for the affine conic constraint number
accidx
.- Parameters
accidx
(long
) – Affine conic constraint index. (input)j
(long
) – The index of an element in b to change. (input)bj
(double
) – The new value of \(b[j]\). (input)
- Groups
- Task.putaccdoty¶
public synchronized void putaccdoty (soltype whichsol, long accidx, double[] doty)
Puts the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters
whichsol
(soltype
) – Selects a solution. (input)accidx
(long
) – The index of the affine conic constraint. (input)doty
(double
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Groups
- Task.putacclist¶
public synchronized void putacclist (long[] accidxs, long[] domidxs, long[] afeidxlist, double[] b)
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 inTask.appendacc
(see alsoTask.appendaccs
).- Parameters
accidxs
(long
[]
) – Affine conic constraint indices. (input)domidxs
(long
[]
) – Domain indices. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)
- Groups
- Task.putaccname¶
public synchronized void putaccname (long accidx, String name)
Sets the name of an affine conic constraint.
- Parameters
accidx
(long
) – Index of the affine conic constraint. (input)name
(String
) – The name of the affine conic constraint. (input)
- Groups
- Task.putacol¶
public synchronized void putacol (int j, int[] subj, double[] valj)
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
j
(int
) – Index of a column in \(A\). (input)subj
(int
[]
) – Row indexes of non-zero values in column \(j\) of \(A\). (input)valj
(double
[]
) – New non-zero values of column \(j\) in \(A\). (input)
- Groups
- Task.putacollist¶
public synchronized void putacollist (int[] sub, int[] ptrb, int[] ptre, int[] asub, double[] aval)
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
sub
(int
[]
) – Indexes of columns that should be replaced, no duplicates. (input)ptrb
(int
[]
) – Array of pointers to the first element in each column. (input)ptre
(int
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(int
[]
) – Row indexes of new elements. (input)aval
(double
[]
) – Coefficient values. (input)
- Groups
- Task.putacolslice¶
public synchronized void putacolslice (int first, int last, int[] ptrb, int[] ptre, int[] asub, double[] aval)
public synchronized void putacolslice (int first, int last, long[] ptrb, long[] ptre, int[] asub, double[] aval)
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
first
(int
) – First column in the slice. (input)last
(int
) – Last column plus one in the slice. (input)ptrb
(int
[]
) – Array of pointers to the first element in each column. (input)ptrb
(long
[]
) – Array of pointers to the first element in each column. (input)ptre
(int
[]
) – Array of pointers to the last element plus one in each column. (input)ptre
(long
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(int
[]
) – Row indexes of new elements. (input)aval
(double
[]
) – Coefficient values. (input)
- Groups
- Task.putafebarfblocktriplet¶
public synchronized void putafebarfblocktriplet (long[] afeidx, int[] barvaridx, int[] subk, int[] subl, double[] valkl)
Inputs the \(\barF\) matrix data in block triplet form.
- Parameters
afeidx
(long
[]
) – Constraint index. (input)barvaridx
(int
[]
) – Symmetric matrix variable index. (input)subk
(int
[]
) – Block row index. (input)subl
(int
[]
) – Block column index. (input)valkl
(double
[]
) – The numerical value associated with each block triplet. (input)
- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.putafebarfentry¶
public synchronized void putafebarfentry (long afeidx, int barvaridx, long[] termidx, double[] termweight)
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
Task.appendsparsesymmat
.- Parameters
afeidx
(long
) – Row index of \(\barF\). (input)barvaridx
(int
) – Semidefinite variable index. (input)termidx
(long
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for the \(\barF\) entry being specified. (input)termweight
(double
[]
) –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
- Task.putafebarfentrylist¶
public synchronized void putafebarfentrylist (long[] afeidx, int[] barvaridx, long[] numterm, long[] ptrterm, long[] termidx, double[] termweight)
This function sets a list of entries in \(\barF\). Each entry should be described as in
Task.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
. SeeTask.putafebarfentry
for details.- Parameters
afeidx
(long
[]
) – Row indexes of \(\barF\). (input)barvaridx
(int
[]
) – Semidefinite variable indexes. (input)numterm
(long
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(long
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(long
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) being specified. (input)termweight
(double
[]
) – Concatenated lists of weights appearing in the weighted sums forming the \(\barF\) elements being specified. (input)
- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.putafebarfrow¶
public synchronized void putafebarfrow (long afeidx, int[] barvaridx, long[] numterm, long[] ptrterm, long[] termidx, double[] termweight)
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
Task.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
. SeeTask.putafebarfentry
for details.- Parameters
afeidx
(long
) – Row index of \(\barF\). (input)barvaridx
(int
[]
) – Semidefinite variable indexes. (input)numterm
(long
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(long
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(long
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) entries in the row. (input)termweight
(double
[]
) – 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
- Task.putafefcol¶
public synchronized void putafefcol (int varidx, long[] afeidx, double[] val)
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
varidx
(int
) – Index of a column in \(F\). (input)afeidx
(long
[]
) – Row indexes of non-zero values in the column of \(F\). (input)val
(double
[]
) – New non-zero values in the column of \(F\). (input)
- Groups
- Task.putafefentry¶
public synchronized void putafefentry (long afeidx, int varidx, double value)
Replaces one entry in the affine expression store \(F\), that is it sets:
\[F_{\mathrm{afeidx}, \mathrm{varidx}} = \mathrm{value}.\]- Parameters
afeidx
(long
) – Row index in \(F\). (input)varidx
(int
) – Column index in \(F\). (input)value
(double
) – Value of \(F_{\mathrm{afeidx},\mathrm{varidx}}\). (input)
- Groups
- Task.putafefentrylist¶
public synchronized void putafefentrylist (long[] afeidx, int[] varidx, double[] val)
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
afeidx
(long
[]
) – Row indices in \(F\). (input)varidx
(int
[]
) – Column indices in \(F\). (input)val
(double
[]
) – Values of the entries in \(F\). (input)
- Groups
- Task.putafefrow¶
public synchronized void putafefrow (long afeidx, int[] varidx, double[] val)
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
afeidx
(long
) – Index of a row in \(F\). (input)varidx
(int
[]
) – Column indexes of non-zero values in the row of \(F\). (input)val
(double
[]
) – New non-zero values in the row of \(F\). (input)
- Groups
- Task.putafefrowlist¶
public synchronized void putafefrowlist (long[] afeidx, int[] numnzrow, long[] ptrrow, int[] varidx, double[] val)
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
Task.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
afeidx
(long
[]
) – Indices of rows in \(F\). (input)numnzrow
(int
[]
) – Number of non-zeros in each of the modified rows of \(F\). (input)ptrrow
(long
[]
) – Pointer to the first nonzero in each row of \(F\). (input)varidx
(int
[]
) – Column indexes of non-zero values. (input)val
(double
[]
) – New non-zero values in the rows of \(F\). (input)
- Groups
- Task.putafeg¶
public synchronized void putafeg (long afeidx, double g)
Change one element of the vector \(g\) in affine expressions i.e.
\[g_{\mathtt{afeidx}} = \mathtt{gi}.\]- Parameters
afeidx
(long
) – Index of an entry in \(g\). (input)g
(double
) – New value for \(g_{\mathrm{afeidx}}\). (input)
- Groups
- Task.putafeglist¶
public synchronized void putafeglist (long[] afeidx, double[] g)
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
afeidx
(long
[]
) – Indices of entries in \(g\). (input)g
(double
[]
) – New values for \(g\). (input)
- Groups
- Task.putafegslice¶
public synchronized void putafegslice (long first, long last, double[] slice)
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
first
(long
) – First index in the sequence. (input)last
(long
) – Last index plus 1 in the sequence. (input)slice
(double
[]
) – The slice of \(g\) as a dense vector. The length islast-first
. (input)
- Groups
- Task.putaij¶
public synchronized void putaij (int i, int j, double aij)
Changes a coefficient in the linear coefficient matrix \(A\) using the method
\[a_{i,j} = \mathtt{aij}.\]- Parameters
i
(int
) – Constraint (row) index. (input)j
(int
) – Variable (column) index. (input)aij
(double
) – New coefficient for \(a_{i,j}\). (input)
- Groups
- Task.putaijlist¶
public synchronized void putaijlist (int[] subi, int[] subj, double[] valij)
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
subi
(int
[]
) – Constraint (row) indices. (input)subj
(int
[]
) – Variable (column) indices. (input)valij
(double
[]
) – New coefficient values for \(a_{i,j}\). (input)
- Groups
- Task.putarow¶
public synchronized void putarow (int i, int[] subi, double[] vali)
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
i
(int
) – Index of a row in \(A\). (input)subi
(int
[]
) – Column indexes of non-zero values in row \(i\) of \(A\). (input)vali
(double
[]
) – New non-zero values of row \(i\) in \(A\). (input)
- Groups
- Task.putarowlist¶
public synchronized void putarowlist (int[] sub, int[] ptrb, int[] ptre, int[] asub, double[] aval)
public synchronized void putarowlist (int[] sub, long[] ptrb, long[] ptre, int[] asub, double[] aval)
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
sub
(int
[]
) – Indexes of rows that should be replaced, no duplicates. (input)ptrb
(int
[]
) – Array of pointers to the first element in each row. (input)ptrb
(long
[]
) – Array of pointers to the first element in each row. (input)ptre
(int
[]
) – Array of pointers to the last element plus one in each row. (input)ptre
(long
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(int
[]
) – Column indexes of new elements. (input)aval
(double
[]
) – Coefficient values. (input)
- Groups
- Task.putarowslice¶
public synchronized void putarowslice (int first, int last, int[] ptrb, int[] ptre, int[] asub, double[] aval)
public synchronized void putarowslice (int first, int last, long[] ptrb, long[] ptre, int[] asub, double[] aval)
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
first
(int
) – First row in the slice. (input)last
(int
) – Last row plus one in the slice. (input)ptrb
(int
[]
) – Array of pointers to the first element in each row. (input)ptrb
(long
[]
) – Array of pointers to the first element in each row. (input)ptre
(int
[]
) – Array of pointers to the last element plus one in each row. (input)ptre
(long
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(int
[]
) – Column indexes of new elements. (input)aval
(double
[]
) – Coefficient values. (input)
- Groups
- Task.putatruncatetol¶
public synchronized void putatruncatetol(double tolzero)
Truncates (sets to zero) all elements in \(A\) that satisfy
\[|a_{i,j}| \leq \mathtt{tolzero}.\]- Parameters
tolzero
(double
) – Truncation tolerance. (input)- Groups
- Task.putbarablocktriplet¶
public synchronized void putbarablocktriplet (int[] subi, int[] subj, int[] subk, int[] subl, double[] valijkl)
Inputs the \(\barA\) matrix in block triplet form.
- Parameters
subi
(int
[]
) – Constraint index. (input)subj
(int
[]
) – Symmetric matrix variable index. (input)subk
(int
[]
) – Block row index. (input)subl
(int
[]
) – Block column index. (input)valijkl
(double
[]
) – The numerical value associated with each block triplet. (input)
- Groups
- Task.putbaraij¶
public synchronized void putbaraij (int i, int j, long[] sub, double[] weights)
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
Task.appendsparsesymmat
.- Parameters
i
(int
) – Row index of \(\barA\). (input)j
(int
) – Column index of \(\barA\). (input)sub
(long
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(double
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
- Groups
- Task.putbaraijlist¶
public synchronized void putbaraijlist (int[] subi, int[] subj, long[] alphaptrb, long[] alphaptre, long[] matidx, double[] weights)
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
Task.appendsparsesymmat
.- Parameters
subi
(int
[]
) – Row index of \(\barA\). (input)subj
(int
[]
) – Column index of \(\barA\). (input)alphaptrb
(long
[]
) – Start entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)alphaptre
(long
[]
) – End entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)matidx
(long
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(double
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
- Groups
- Task.putbararowlist¶
public synchronized void putbararowlist (int[] subi, long[] ptrb, long[] ptre, int[] subj, long[] nummat, long[] matidx, double[] weights)
This function replaces a list of rows in the \(\barA\) matrix.
- Parameters
subi
(int
[]
) – Row indexes of \(\barA\). (input)ptrb
(long
[]
) – Start of rows in \(\barA\). (input)ptre
(long
[]
) – End of rows in \(\barA\). (input)subj
(int
[]
) – Column index of \(\barA\). (input)nummat
(long
[]
) – Number of entries in weighted sum of matrixes. (input)matidx
(long
[]
) – Matrix indexes for weighted sum of matrixes. (input)weights
(double
[]
) – Weights for weighted sum of matrixes. (input)
- Groups
- Task.putbarcblocktriplet¶
public synchronized void putbarcblocktriplet (int[] subj, int[] subk, int[] subl, double[] valjkl)
Inputs the \(\barC\) matrix in block triplet form.
- Parameters
subj
(int
[]
) – Symmetric matrix variable index. (input)subk
(int
[]
) – Block row index. (input)subl
(int
[]
) – Block column index. (input)valjkl
(double
[]
) – The numerical value associated with each block triplet. (input)
- Groups
- Task.putbarcj¶
public synchronized void putbarcj (int j, long[] sub, double[] weights)
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
Task.appendsparsesymmat
.- Parameters
j
(int
) – Index of the element in \(\barC\) that should be changed. (input)sub
(long
[]
) – Indices in \(E\) of matrices appearing in the weighted sum for \(\barC_j\) (input)weights
(double
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barC_j\). (input)
- Groups
- Task.putbarsj¶
public synchronized void putbarsj (soltype whichsol, int j, double[] barsj)
Sets the dual solution for a semidefinite variable.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)j
(int
) – Index of the semidefinite variable. (input)barsj
(double
[]
) – Value of \(\barS_j\). Format as inTask.getbarsj
. (input)
- Groups
- Task.putbarvarname¶
public synchronized void putbarvarname (int j, String name)
Sets the name of a semidefinite variable.
- Parameters
j
(int
) – Index of the variable. (input)name
(String
) – The variable name. (input)
- Groups
- Task.putbarxj¶
public synchronized void putbarxj (soltype whichsol, int j, double[] barxj)
Sets the primal solution for a semidefinite variable.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)j
(int
) – Index of the semidefinite variable. (input)barxj
(double
[]
) – Value of \(\barX_j\). Format as inTask.getbarxj
. (input)
- Groups
- Task.putcfix¶
public synchronized void putcfix(double cfix)
Replaces the fixed term in the objective by a new one.
- Parameters
cfix
(double
) – Fixed term in the objective. (input)- Groups
- Task.putcj¶
public synchronized void putcj (int j, double cj)
Modifies one coefficient in the linear objective vector \(c\), i.e.
\[c_{\mathtt{j}} = \mathtt{cj}.\]If the absolute value exceeds
dparam.data_tol_c_huge
an error is generated. If the absolute value exceedsdparam.data_tol_cj_large
, a warning is generated, but the coefficient is inputted as specified.- Parameters
j
(int
) – Index of the variable for which \(c\) should be changed. (input)cj
(double
) – New value of \(c_j\). (input)
- Groups
- Task.putclist¶
public synchronized void putclist (int[] subj, double[] val)
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 inTask.putcj
.- Parameters
subj
(int
[]
) – Indices of variables for which the coefficient in \(c\) should be changed. (input)val
(double
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - objective
- Task.putconbound¶
public synchronized void putconbound (int i, boundkey bkc, double blc, double buc)
Changes the bounds for one constraint.
If the bound value specified is numerically larger than
dparam.data_tol_bound_inf
it is considered infinite and the bound key is changed accordingly. If a bound value is numerically larger thandparam.data_tol_bound_wrn
, a warning will be displayed, but the bound is inputted as specified.- Parameters
i
(int
) – Index of the constraint. (input)bkc
(boundkey
) – New bound key. (input)blc
(double
) – New lower bound. (input)buc
(double
) – New upper bound. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.putconboundlist¶
public synchronized void putconboundlist (int[] sub, boundkey[] bkc, double[] blc, double[] buc)
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
Task.putconbound
.- Parameters
sub
(int
[]
) – List of constraint indexes. (input)bkc
(boundkey
[]
) – Bound keys for the constraints. (input)blc
(double
[]
) – Lower bounds for the constraints. (input)buc
(double
[]
) – Upper bounds for the constraints. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.putconboundlistconst¶
public synchronized void putconboundlistconst (int[] sub, boundkey bkc, double blc, double buc)
Changes the bounds for one or more constraints. Data checks are performed as in
Task.putconbound
.- Parameters
sub
(int
[]
) – List of constraint indexes. (input)bkc
(boundkey
) – New bound key for all constraints in the list. (input)blc
(double
) – New lower bound for all constraints in the list. (input)buc
(double
) – New upper bound for all constraints in the list. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.putconboundslice¶
public synchronized void putconboundslice (int first, int last, boundkey[] bkc, double[] blc, double[] buc)
Changes the bounds for a slice of the constraints. Data checks are performed as in
Task.putconbound
.- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bkc
(boundkey
[]
) – Bound keys for the constraints. (input)blc
(double
[]
) – Lower bounds for the constraints. (input)buc
(double
[]
) – Upper bounds for the constraints. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.putconboundsliceconst¶
public synchronized void putconboundsliceconst (int first, int last, boundkey bkc, double blc, double buc)
Changes the bounds for a slice of the constraints. Data checks are performed as in
Task.putconbound
.- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bkc
(boundkey
) – New bound key for all constraints in the slice. (input)blc
(double
) – New lower bound for all constraints in the slice. (input)buc
(double
) – New upper bound for all constraints in the slice. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.putcone Deprecated¶
public synchronized void putcone (int k, conetype ct, double conepar, int[] submem)
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
k
(int
) – Index of the cone. (input)ct
(conetype
) – Specifies the type of the cone. (input)conepar
(double
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(int
[]
) – Variable subscripts of the members in the cone. (input)
- Groups
- Task.putconename Deprecated¶
public synchronized void putconename (int j, String name)
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
j
(int
) – Index of the cone. (input)name
(String
) – The name of the cone. (input)
- Groups
- Task.putconname¶
public synchronized void putconname (int i, String name)
Sets the name of a constraint.
- Parameters
i
(int
) – Index of the constraint. (input)name
(String
) – The name of the constraint. (input)
- Groups
Names, Problem data - constraints, Problem data - linear part
- Task.putconsolutioni¶
public synchronized void putconsolutioni (int i, soltype whichsol, stakey sk, double x, double sl, double su)
Sets the primal and dual solution information for a single constraint.
- Parameters
i
(int
) – Index of the constraint. (input)whichsol
(soltype
) – Selects a solution. (input)sk
(stakey
) – Status key of the constraint. (input)x
(double
) – Primal solution value of the constraint. (input)sl
(double
) – Solution value of the dual variable associated with the lower bound. (input)su
(double
) – Solution value of the dual variable associated with the upper bound. (input)
- Groups
- Task.putcslice¶
public synchronized void putcslice (int first, int last, double[] slice)
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
Task.putcj
.- Parameters
first
(int
) – First element in the slice of \(c\). (input)last
(int
) – Last element plus 1 of the slice in \(c\) to be changed. (input)slice
(double
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups
- Task.putdjc¶
public synchronized void putdjc (long djcidx, long[] domidxlist, long[] afeidxlist, double[] b, long[] termsizelist)
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
djcidx
(long
) – Index of the disjunctive constraint. (input)domidxlist
(long
[]
) – List of domain indexes. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. (input)termsizelist
(long
[]
) – List of term sizes. (input)
- Groups
- Task.putdjcname¶
public synchronized void putdjcname (long djcidx, String name)
Sets the name of a disjunctive constraint.
- Parameters
djcidx
(long
) – Index of the disjunctive constraint. (input)name
(String
) – The name of the disjunctive constraint. (input)
- Groups
- Task.putdjcslice¶
public synchronized void putdjcslice (long idxfirst, long idxlast, long[] domidxlist, long[] afeidxlist, double[] b, long[] termsizelist, long[] termsindjc)
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
Task.putdjc
.- Parameters
idxfirst
(long
) – Index of the first disjunctive constraint in the slice. (input)idxlast
(long
) – Index of the last disjunctive constraint in the slice plus 1. (input)domidxlist
(long
[]
) – List of domain indexes. (input)afeidxlist
(long
[]
) – List of affine expression indexes. (input)b
(double
[]
) – The vector of constant terms modifying affine expressions. Optional, can benull
if not required. (input)termsizelist
(long
[]
) – List of term sizes. (input)termsindjc
(long
[]
) – Number of terms in each of the disjunctive constraints in the slice. (input)
- Groups
- Task.putdomainname¶
public synchronized void putdomainname (long domidx, String name)
Sets the name of a domain.
- Parameters
domidx
(long
) – Index of the domain. (input)name
(String
) – The name of the domain. (input)
- Groups
- Task.putdouparam¶
public synchronized void putdouparam (dparam param, double parvalue)
Sets the value of a double parameter.
- Parameters
param
(dparam
) – Which parameter. (input)parvalue
(double
) – Parameter value. (input)
- Groups
- Task.putintparam¶
public synchronized void putintparam (iparam param, int parvalue)
Sets the value of an integer parameter.
Please notice that some parameters take values that are defined in Enum classes. This function accepts only integer values, so to use e.g. the value
onoffkey.on
, is necessary to use the member.value
. For example:task.putintparam(mosek.iparam.opf_write_problem, mosek.onoffkey.on.value)
- Parameters
param
(iparam
) – Which parameter. (input)parvalue
(int
) – Parameter value. (input)
- Groups
- Task.putmaxnumacc¶
public synchronized void putmaxnumacc(long maxnumacc)
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
maxnumacc
(long
) – Number of preallocated affine conic constraints. (input)- Groups
Environment and task management, Problem data - affine conic constraints
- Task.putmaxnumafe¶
public synchronized void putmaxnumafe(long maxnumafe)
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
maxnumafe
(long
) – Number of preallocated affine expressions. (input)- Groups
Environment and task management, Problem data - affine expressions
- Task.putmaxnumanz¶
public synchronized void putmaxnumanz(long maxnumanz)
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
maxnumanz
(long
) – Number of preallocated non-zeros in \(A\). (input)- Groups
- Task.putmaxnumbarvar¶
public synchronized void putmaxnumbarvar(int maxnumbarvar)
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
maxnumbarvar
(int
) – Number of preallocated symmetric matrix variables. (input)- Groups
Environment and task management, Problem data - semidefinite
- Task.putmaxnumcon¶
public synchronized void putmaxnumcon(int maxnumcon)
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
maxnumcon
(int
) – Number of preallocated constraints in the optimization task. (input)- Groups
- Task.putmaxnumcone Deprecated¶
public synchronized void putmaxnumcone(int maxnumcone)
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
maxnumcone
(int
) – Number of preallocated conic constraints in the optimization task. (input)- Groups
Environment and task management, Problem data - cones (deprecated)
- Task.putmaxnumdjc¶
public synchronized void putmaxnumdjc(long maxnumdjc)
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
maxnumdjc
(long
) – Number of preallocated disjunctive constraints in the task. (input)- Groups
Environment and task management, Problem data - disjunctive constraints
- Task.putmaxnumdomain¶
public synchronized void putmaxnumdomain(long maxnumdomain)
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
maxnumdomain
(long
) – Number of preallocated domains. (input)- Groups
- Task.putmaxnumqnz¶
public synchronized void putmaxnumqnz(long maxnumqnz)
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
maxnumqnz
(long
) – Number of non-zero elements preallocated in quadratic coefficient matrices. (input)- Groups
Environment and task management, Problem data - quadratic part
- Task.putmaxnumvar¶
public synchronized void putmaxnumvar(int maxnumvar)
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
maxnumvar
(int
) – Number of preallocated variables in the optimization task. (input)- Groups
- Task.putnadouparam¶
public synchronized void putnadouparam (String paramname, double parvalue)
Sets the value of a named double parameter.
- Parameters
paramname
(String
) – Name of a parameter. (input)parvalue
(double
) – Parameter value. (input)
- Groups
- Task.putnaintparam¶
public synchronized void putnaintparam (String paramname, int parvalue)
Sets the value of a named integer parameter.
- Parameters
paramname
(String
) – Name of a parameter. (input)parvalue
(int
) – Parameter value. (input)
- Groups
- Task.putnastrparam¶
public synchronized void putnastrparam (String paramname, String parvalue)
Sets the value of a named string parameter.
- Parameters
paramname
(String
) – Name of a parameter. (input)parvalue
(String
) – Parameter value. (input)
- Groups
- Task.putobjname¶
public synchronized void putobjname(String objname)
Assigns a new name to the objective.
- Parameters
objname
(String
) – Name of the objective. (input)- Groups
- Task.putobjsense¶
public synchronized void putobjsense(objsense sense)
Sets the objective sense of the task.
- Parameters
sense
(objsense
) – The objective sense of the task. The valuesobjsense.maximize
andobjsense.minimize
mean that the problem is maximized or minimized respectively. (input)- Groups
- Task.putoptserverhost¶
public synchronized void putoptserverhost(String host)
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. Passingnull
or empty string deactivates this redirection.Has the same effect as setting the parameter
sparam.remote_optserver_host
.- Parameters
host
(String
) – A URL specifying the optimization server to be used. (input)- Groups
- Task.putparam¶
public synchronized void putparam (String parname, String parvalue)
Checks if
parname
is valid parameter name. If it is, the parameter is assigned the value specified byparvalue
.- Parameters
parname
(String
) – Parameter name. (input)parvalue
(String
) – Parameter value. (input)
- Groups
- Task.putqcon¶
public synchronized void putqcon (int[] qcsubk, int[] qcsubi, int[] qcsubj, double[] qcval)
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
Task.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
qcsubk
(int
[]
) – Constraint subscripts for quadratic coefficients. (input)qcsubi
(int
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(int
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(double
[]
) – Quadratic constraint coefficient values. (input)
- Groups
- Task.putqconk¶
public synchronized void putqconk (int k, int[] qcsubi, int[] qcsubj, double[] qcval)
Replaces all the quadratic entries in one constraint. This function performs the same operations as
Task.putqcon
but only with respect to constraint numberk
and it does not modify the other constraints. See the description ofTask.putqcon
for definitions and important remarks.- Parameters
k
(int
) – The constraint in which the new \(Q\) elements are inserted. (input)qcsubi
(int
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(int
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(double
[]
) – Quadratic constraint coefficient values. (input)
- Groups
- Task.putqobj¶
public synchronized void putqobj (int[] qosubi, int[] qosubj, double[] qoval)
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
Task.putqcon
for important remarks and example.- Parameters
qosubi
(int
[]
) – Row subscripts for quadratic objective coefficients. (input)qosubj
(int
[]
) – Column subscripts for quadratic objective coefficients. (input)qoval
(double
[]
) – Quadratic objective coefficient values. (input)
- Groups
- Task.putqobjij¶
public synchronized void putqobjij (int i, int j, double qoij)
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
Task.putqobj
instead whenever possible.- Parameters
i
(int
) – Row index for the coefficient to be replaced. (input)j
(int
) – Column index for the coefficient to be replaced. (input)qoij
(double
) – The new value for \(q_{ij}^o\). (input)
- Groups
- Task.putskc¶
public synchronized void putskc (soltype whichsol, stakey[] skc)
Sets the status keys for the constraints.
- Parameters
- Groups
- Task.putskcslice¶
public synchronized void putskcslice (soltype whichsol, int first, int last, stakey[] skc)
Sets the status keys for a slice of the constraints.
- Parameters
- Groups
- Task.putskx¶
public synchronized void putskx (soltype whichsol, stakey[] skx)
Sets the status keys for the scalar variables.
- Parameters
- Groups
- Task.putskxslice¶
public synchronized void putskxslice (soltype whichsol, int first, int last, stakey[] skx)
Sets the status keys for a slice of the variables.
- Parameters
- Groups
- Task.putslc¶
public synchronized void putslc (soltype whichsol, double[] slc)
Sets the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups
- Task.putslcslice¶
public synchronized void putslcslice (soltype whichsol, int first, int last, double[] slc)
Sets a slice of the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups
- Task.putslx¶
public synchronized void putslx (soltype whichsol, double[] slx)
Sets the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups
- Task.putslxslice¶
public synchronized void putslxslice (soltype whichsol, int first, int last, double[] slx)
Sets a slice of the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups
- Task.putsnx¶
public synchronized void putsnx (soltype whichsol, double[] sux)
Sets the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.putsnxslice¶
public synchronized void putsnxslice (soltype whichsol, int first, int last, double[] snx)
Sets a slice of the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups
- Task.putsolution¶
public synchronized void putsolution (soltype whichsol, stakey[] skc, stakey[] skx, stakey[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx)
Inserts a solution into the task.
- Parameters
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
(double
[]
) – Primal constraint solution. (input)xx
(double
[]
) – Primal variable solution. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups
- Task.putsolutionnew¶
public synchronized void putsolutionnew (soltype whichsol, stakey[] skc, stakey[] skx, stakey[] skn, double[] xc, double[] xx, double[] y, double[] slc, double[] suc, double[] slx, double[] sux, double[] snx, double[] doty)
Inserts a solution into the task.
- Parameters
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
(double
[]
) – Primal constraint solution. (input)xx
(double
[]
) – Primal variable solution. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(double
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(double
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(double
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)doty
(double
[]
) – Dual variables corresponding to affine conic constraints. (input)
- Groups
- Task.putsolutionyi¶
public synchronized void putsolutionyi (int i, soltype whichsol, double y)
Inputs the dual variable of a solution.
- Parameters
i
(int
) – Index of the dual variable. (input)whichsol
(soltype
) – Selects a solution. (input)y
(double
) – Solution value of the dual variable. (input)
- Groups
- Task.putstrparam¶
public synchronized void putstrparam (sparam param, String parvalue)
Sets the value of a string parameter.
- Parameters
param
(sparam
) – Which parameter. (input)parvalue
(String
) – Parameter value. (input)
- Groups
- Task.putsuc¶
public synchronized void putsuc (soltype whichsol, double[] suc)
Sets the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups
- Task.putsucslice¶
public synchronized void putsucslice (soltype whichsol, int first, int last, double[] suc)
Sets a slice of the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)suc
(double
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups
- Task.putsux¶
public synchronized void putsux (soltype whichsol, double[] sux)
Sets the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.putsuxslice¶
public synchronized void putsuxslice (soltype whichsol, int first, int last, double[] sux)
Sets a slice of the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)sux
(double
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.puttaskname¶
public synchronized void puttaskname(String taskname)
Assigns a new name to the task.
- Parameters
taskname
(String
) – Name assigned to the task. (input)- Groups
- Task.putvarbound¶
public synchronized void putvarbound (int j, boundkey bkx, double blx, double bux)
Changes the bounds for one variable.
If the bound value specified is numerically larger than
dparam.data_tol_bound_inf
it is considered infinite and the bound key is changed accordingly. If a bound value is numerically larger thandparam.data_tol_bound_wrn
, a warning will be displayed, but the bound is inputted as specified.- Parameters
j
(int
) – Index of the variable. (input)bkx
(boundkey
) – New bound key. (input)blx
(double
) – New lower bound. (input)bux
(double
) – New upper bound. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.putvarboundlist¶
public synchronized void putvarboundlist (int[] sub, boundkey[] bkx, double[] blx, double[] bux)
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
Task.putvarbound
.- Parameters
sub
(int
[]
) – List of variable indexes. (input)bkx
(boundkey
[]
) – Bound keys for the variables. (input)blx
(double
[]
) – Lower bounds for the variables. (input)bux
(double
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.putvarboundlistconst¶
public synchronized void putvarboundlistconst (int[] sub, boundkey bkx, double blx, double bux)
Changes the bounds for one or more variables. Data checks are performed as in
Task.putvarbound
.- Parameters
sub
(int
[]
) – List of variable indexes. (input)bkx
(boundkey
) – New bound key for all variables in the list. (input)blx
(double
) – New lower bound for all variables in the list. (input)bux
(double
) – New upper bound for all variables in the list. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.putvarboundslice¶
public synchronized void putvarboundslice (int first, int last, boundkey[] bkx, double[] blx, double[] bux)
Changes the bounds for a slice of the variables. Data checks are performed as in
Task.putvarbound
.- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bkx
(boundkey
[]
) – Bound keys for the variables. (input)blx
(double
[]
) – Lower bounds for the variables. (input)bux
(double
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.putvarboundsliceconst¶
public synchronized void putvarboundsliceconst (int first, int last, boundkey bkx, double blx, double bux)
Changes the bounds for a slice of the variables. Data checks are performed as in
Task.putvarbound
.- Parameters
first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)bkx
(boundkey
) – New bound key for all variables in the slice. (input)blx
(double
) – New lower bound for all variables in the slice. (input)bux
(double
) – New upper bound for all variables in the slice. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.putvarname¶
public synchronized void putvarname (int j, String name)
Sets the name of a variable.
- Parameters
j
(int
) – Index of the variable. (input)name
(String
) – The variable name. (input)
- Groups
- Task.putvarsolutionj¶
public synchronized void putvarsolutionj (int j, soltype whichsol, stakey sk, double x, double sl, double su, double sn)
Sets the primal and dual solution information for a single variable.
- Parameters
j
(int
) – Index of the variable. (input)whichsol
(soltype
) – Selects a solution. (input)sk
(stakey
) – Status key of the variable. (input)x
(double
) – Primal solution value of the variable. (input)sl
(double
) – Solution value of the dual variable associated with the lower bound. (input)su
(double
) – Solution value of the dual variable associated with the upper bound. (input)sn
(double
) – Solution value of the dual variable associated with the conic constraint. (input)
- Groups
- Task.putvartype¶
public synchronized void putvartype (int j, variabletype vartype)
Sets the variable type of one variable.
- Parameters
j
(int
) – Index of the variable. (input)vartype
(variabletype
) – The new variable type. (input)
- Groups
- Task.putvartypelist¶
public synchronized void putvartypelist (int[] subj, variabletype[] vartype)
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
subj
(int
[]
) – 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
- Task.putxc¶
public synchronized void putxc (soltype whichsol, double[] xc)
Sets the \(x^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)xc
(double
[]
) – Primal constraint solution. (output)
- Groups
- Task.putxcslice¶
public synchronized void putxcslice (soltype whichsol, int first, int last, double[] xc)
Sets a slice of the \(x^c\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)xc
(double
[]
) – Primal constraint solution. (input)
- Groups
- Task.putxx¶
public synchronized void putxx (soltype whichsol, double[] xx)
Sets the \(x^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)xx
(double
[]
) – Primal variable solution. (input)
- Groups
- Task.putxxslice¶
public synchronized void putxxslice (soltype whichsol, int first, int last, double[] xx)
Sets a slice of the \(x^x\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)xx
(double
[]
) – Primal variable solution. (input)
- Groups
- Task.puty¶
public synchronized void puty (soltype whichsol, double[] y)
Sets the \(y\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups
- Task.putyslice¶
public synchronized void putyslice (soltype whichsol, int first, int last, double[] y)
Sets a slice of the \(y\) vector for a solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)first
(int
) – First index in the sequence. (input)last
(int
) – Last index plus 1 in the sequence. (input)y
(double
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups
- Task.readbsolution¶
public synchronized void readbsolution (String filename, compresstype compress)
Read a binary dump of the task solution.
- Parameters
filename
(String
) – A valid file name. (input)compress
(compresstype
) – Data compression type. (input)
- Groups
- Task.readdata¶
public synchronized void readdata(String filename)
Reads an optimization problem and associated data from a file.
- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.readdataformat¶
public synchronized void readdataformat (String filename, dataformat format, compresstype compress)
Reads an optimization problem and associated data from a file.
- Parameters
filename
(String
) – A valid file name. (input)format
(dataformat
) – File data format. (input)compress
(compresstype
) – File compression type. (input)
- Groups
- Task.readjsonsol¶
public synchronized void readjsonsol(String filename)
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
filename
(String
) – A valid file name. (input)- Groups
- Task.readjsonstring¶
public synchronized void readjsonstring(String data)
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
data
(String
) – Problem data in text format. (input)- Groups
- Task.readlpstring¶
public synchronized void readlpstring(String data)
Load task data from a string in LP format, replacing any data that already exists in the task object.
- Parameters
data
(String
) – Problem data in text format. (input)- Groups
- Task.readopfstring¶
public synchronized void readopfstring(String data)
Load task data from a string in OPF format, replacing any data that already exists in the task object.
- Parameters
data
(String
) – Problem data in text format. (input)- Groups
- Task.readparamfile¶
public synchronized void readparamfile(String filename)
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 bysparam.param_read_file_name
.- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.readptfstring¶
public synchronized void readptfstring(String data)
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
data
(String
) – Problem data in text format. (input)- Groups
- Task.readsolution¶
public synchronized void readsolution (soltype whichsol, String filename)
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 bysparam.bas_sol_file_name
,sparam.itr_sol_file_name
orsparam.int_sol_file_name
depending on which solution is chosen.- Parameters
whichsol
(soltype
) – Selects a solution. (input)filename
(String
) – A valid file name. (input)
- Groups
- Task.readsolutionfile¶
public synchronized void readsolutionfile(String filename)
Read solution file in format determined by the filename
- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.readsummary¶
public synchronized void readsummary(streamtype whichstream)
Prints a short summary of last file that was read.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)- Groups
- Task.readtask¶
public synchronized void readtask(String filename)
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
filename
(String
) – A valid file name. (input)- Groups
- Task.removebarvars¶
public synchronized void removebarvars(int[] subset)
The function removes a subset of the symmetric matrices from the optimization task. This implies that the remaining symmetric matrices are renumbered.
- Parameters
subset
(int
[]
) – Indexes of symmetric matrices which should be removed. (input)- Groups
- Task.removecones Deprecated¶
public synchronized void removecones(int[] subset)
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
subset
(int
[]
) – Indexes of cones which should be removed. (input)- Groups
- Task.removecons¶
public synchronized void removecons(int[] subset)
The function removes a subset of the constraints from the optimization task. This implies that the remaining constraints are renumbered.
- Parameters
subset
(int
[]
) – Indexes of constraints which should be removed. (input)- Groups
- Task.removevars¶
public synchronized void removevars(int[] subset)
The function removes a subset of the variables from the optimization task. This implies that the remaining variables are renumbered.
- Parameters
subset
(int
[]
) – Indexes of variables which should be removed. (input)- Groups
- Task.resizetask¶
public synchronized void resizetask (int maxnumcon, int maxnumvar, int maxnumcone, long maxnumanz, long maxnumqnz)
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
maxnumcon
(int
) – New maximum number of constraints. (input)maxnumvar
(int
) – New maximum number of variables. (input)maxnumcone
(int
) – New maximum number of cones. (input)maxnumanz
(long
) – New maximum number of non-zeros in \(A\). (input)maxnumqnz
(long
) – New maximum number of non-zeros in all \(Q\) matrices. (input)
- Groups
- Task.sensitivityreport¶
public synchronized void sensitivityreport(streamtype whichstream)
Reads a sensitivity format file from a location given by
sparam.sensitivity_file_name
and writes the result to the streamwhichstream
. Ifsparam.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
whichstream
(streamtype
) – Index of the stream. (input)- Groups
- Task.set_InfoCallback¶
void set_InfoCallback (mosek.DataCallback callback)
Receive callbacks with solver status and information during optimization.
For example:
task.set_InfoCallback( new mosek.InfoCallback() { int callback(mosek.callbackcode code, double[] dinf, int[]iinf, long[] liinf) { System.println("Callback "+code+", intpnt time : "+dinf[mosek.dinfitem.intpnt_time.getValue()]); return 0; } } );
- Parameters
callback
(DataCallback
) – The callback object. (input)
- Task.set_ItgSolutionCallback¶
void set_ItgSolutionCallback (mosek.ItgSolutionCallback callback)
Receive callbacks with solution updates from the mixed-integer optimizer.
For example:
task.set_ItgSolutionCallback( new mosek.ItgSolutionCallback() { void callback(double[] xx) { System.out.print("New integer solution: "); for (double v : xx) System.out.print("" + v + " "); System.out.println(""); } } );
- Parameters
callback
(ItgSolutionCallback
) – The callback object. (input)
- Task.set_Progress¶
void set_Progress (mosek.Progress callback)
Receive callbacks about current status of the solver during optimization.
For example:
task.set_Progress(new mosek.Progress() { int progress(mosek.callbackcode code) { System.println("Callback "+code); return 0; } });
- Parameters
callback
(Progress
) – The callback object. (input)
- Task.set_Stream¶
void set_Stream( mosek.streamtype whichstream, mosek.Stream callback)
Directs all output from a task stream to a callback object.
Can for example be called as:
task.set_Stream(mosek.streamtype.log, new Stream() { public void stream(String s) { System.out.print(s); } } );
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)callback
(Stream
) – The callback object. (input)
- Task.setdefaults¶
public synchronized void setdefaults()
Resets all the parameters to their default values.
- Groups
- Task.solutiondef¶
public synchronized void solutiondef (soltype whichsol, boolean[] isdef)
public synchronized boolean solutiondef(soltype whichsol)
Checks whether a solution is defined.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)isdef
(boolean
by reference) – Is non-zero if the requested solution is defined. (output)
- Return
(
boolean
) – Is non-zero if the requested solution is defined.- Groups
- Task.solutionsummary¶
public synchronized void solutionsummary(streamtype whichstream)
Prints a short summary of the current solutions.
- Parameters
whichstream
(streamtype
) – Index of the stream. (input)- Groups
- Task.solvewithbasis¶
public synchronized void solvewithbasis (boolean transp, int numnz, int[] sub, double[] val, int[] numnzout)
public synchronized int solvewithbasis (boolean transp, int numnz, int[] sub, double[] val)
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
Task.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
Task.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
transp
(boolean
) – If this argument is zero, then (15.3) is solved, if non-zero then (15.4) is solved. (input)numnz
(int
) – The number of non-zeros in \(b\). (input)sub
(int
[]
) – 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
(double
[]
) – 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)numnzout
(int
by reference) – The number of non-zeros in \(\barX\). (output)
- Return
(
int
) – The number of non-zeros in \(\barX\).- Groups
- Task.strtoconetype Deprecated¶
public synchronized void strtoconetype (String str, 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.
- Parameters
str
(String
) – String corresponding to the cone type codeconetype
. (input)conetype
(mosek.conetype
by reference) – The cone type corresponding to the stringstr
. (output)
- Groups
- Task.strtosk¶
public synchronized void strtosk (String str, stakey[] sk)
Obtains the status key corresponding to an abbreviation string.
- Parameters
str
(String
) – A status key abbreviation string. (input)sk
(mosek.stakey
by reference) – Status key corresponding to the string. (output)
- Groups
- Task.toconic Deprecated¶
public synchronized void toconic()
This function tries to reformulate a given Quadratically Constrained Quadratic Optimization problem (QCQO) as a Conic Quadratic Optimization problem (CQO). The first step of the reformulation is to convert the quadratic term of the objective function, if any, into a constraint. Then the following steps are repeated for each quadratic constraint:
a conic constraint is added along with a suitable number of auxiliary variables and constraints;
the original quadratic constraint is not removed, but all its coefficients are zeroed out.
Note that the reformulation preserves all the original variables.
The conversion is performed in-place, i.e. the task passed as argument is modified on exit. That also means that if the reformulation fails, i.e. the given QCQP is not representable as a CQO, then the task has an undefined state. In some cases, users may want to clone the task to ensure a clean copy is preserved.
- Task.unset_Progress¶
void unset_Progress ()
Deactivates all user callback functions.
- Task.updatesolutioninfo¶
public synchronized void updatesolutioninfo(soltype whichsol)
Update the information items related to the solution.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)- Groups
- Task.writebsolution¶
public synchronized void writebsolution (String filename, compresstype compress)
Write a binary dump of the task solution.
- Parameters
filename
(String
) – A valid file name. (input)compress
(compresstype
) – Data compression type. (input)
- Groups
- Task.writedata¶
public synchronized void writedata(String filename)
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
iparam.write_generic_names
parameter toonoffkey.on
.Data is written to the file
filename
if it is a nonempty string. Otherwise data is written to the file specified bysparam.data_file_name
.- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.writedatastream¶
void writedatastream(mosek.dataformat format, mosek.compresstype compress, OutputStream stream)
Writes problem data associated with the optimization task to a stream in one of the supported formats.
The stream should be an instance of
java.io.OutputStream
and it will be written to using the methodwrite(byte[])
. For example:task.writedatastream(mosek.dataformat.ptf, mosek.compresstype.none, System.out); task.writedatastream(mosek.dataformat.json_task, mosek.compresstype.none, new java.io.FileOutputStream("data.jtask"));
- Parameters
format
(mosek.dataformat
) – Data format. (input)compress
(mosek.compresstype
) – Selects compression type. (input)stream
(OutputStream
) – The output stream. (input)
- Task.writejsonsol¶
public synchronized void writejsonsol(String filename)
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
filename
(String
) – A valid file name. (input)- Groups
- Task.writeparamfile¶
public synchronized void writeparamfile(String filename)
Writes all the parameters to a parameter file.
- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.writesolution¶
public synchronized void writesolution (soltype whichsol, String filename)
Saves the current basic, interior-point, or integer solution to a file.
- Parameters
whichsol
(soltype
) – Selects a solution. (input)filename
(String
) – A valid file name. (input)
- Groups
- Task.writesolutionfile¶
public synchronized void writesolutionfile(String filename)
Write solution file in format determined by the filename
- Parameters
filename
(String
) – A valid file name. (input)- Groups
- Task.writetask¶
public synchronized void writetask(String filename)
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
filename
(String
) – A valid file name. (input)- Groups