15.4 Class Task¶
- mosek.Task¶
Represents an optimization task (
struct Task
) or a task with callbacks (struct TaskCB
).
- Task.Task¶
pub fn Task::new() -> Option<Task>
pub fn Task::from_env (env : Option<&Env>) -> Option<Task>
pub fn Task::with_capacity (env : Option<&Env>, numcon : i32, numvar : i32) -> Option<Task>
Constructor of a new optimization task.
- Parameters
env
(Env
) – Parent environment. (input)numcon
(i32
) – An optional hint about the maximal number of constraints in the task. (input)numvar
(i32
) – An optional hint about the maximal number of variables in the task. (input)
- Task.analyze_names¶
pub fn Task::analyze_names (&self, whichstream : i32, nametype : i32) -> Result<(),String>
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.analyze_problem¶
pub fn Task::analyze_problem (&self, whichstream : i32) -> Result<(),String>
The function analyzes the data of a task and writes out a report.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)- Groups
- Task.analyze_solution¶
pub fn Task::analyze_solution (&self, whichstream : i32, whichsol : i32) -> Result<(),String>
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.append_acc¶
pub fn Task::append_acc (&mut self, domidx : i64, afeidxlist : &[i64], b : &[f64]) -> Result<(),String>
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
(i64
) – Domain index. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.append_acc_seq¶
pub fn Task::append_acc_seq (&mut self, domidx : i64, afeidxfirst : i64, b : &[f64]) -> Result<(),String>
Appends an affine conic constraint to the task, as in
Task.append_acc
. 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
(i64
) – Domain index. (input)afeidxfirst
(i64
) – Index of the first affine expression. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.append_accs¶
pub fn Task::append_accs (&mut self, domidxs : &[i64], afeidxlist : &[i64], b : &[f64]) -> Result<(),String>
Appends
numaccs
affine conic constraint to the task. Each single affine conic constraint should be specified as inTask.append_acc
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
(i64
[]
) – Domain indices. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.append_accs_seq¶
pub fn Task::append_accs_seq (&mut self, domidxs : &[i64], numafeidx : i64, afeidxfirst : i64, b : &[f64]) -> Result<(),String>
Appends
numaccs
affine conic constraint to the task. It is the block variant ofTask.append_accs
, 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
(i64
[]
) – Domain indices. (input)numafeidx
(i64
) – Number of affine expressions in the affine expression list (must equal the sum of dimensions of the domains). (input)afeidxfirst
(i64
) – Index of the first affine expression. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.append_afes¶
pub fn Task::append_afes (&mut self, num : i64) -> Result<(),String>
Appends a number of empty affine expressions to the task.
- Parameters
num
(i64
) – Number of empty affine expressions which should be appended. (input)- Groups
- Task.append_barvars¶
pub fn Task::append_barvars (&mut self, dim : &[i32]) -> Result<(),String>
Appends positive semidefinite matrix variables of dimensions given by
dim
to the problem.- Parameters
dim
(i32
[]
) – Dimensions of symmetric matrix variables to be added. (input)- Groups
- Task.append_cone Deprecated¶
pub fn Task::append_cone (&mut self, ct : i32, conepar : f64, submem : &[i32]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(f64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(i32
[]
) – Variable subscripts of the members in the cone. (input)
- Groups
- Task.append_cone_seq Deprecated¶
pub fn Task::append_cone_seq (&mut self, ct : i32, conepar : f64, nummem : i32, j : i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Appends a new conic constraint to the problem, as in
Task.append_cone
. 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
(f64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(i32
) – Number of member variables in the cone. (input)j
(i32
) – Index of the first variable in the conic constraint. (input)
- Groups
- Task.append_cones_seq Deprecated¶
pub fn Task::append_cones_seq (&mut self, ct : &[i32], conepar : &[f64], nummem : &[i32], j : i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Appends a number of conic constraints to the problem, as in
Task.append_cone
. 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
(f64
[]
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)nummem
(i32
[]
) – Numbers of member variables in the cones. (input)j
(i32
) – Index of the first variable in the first cone to be appended. (input)
- Groups
- Task.append_cons¶
pub fn Task::append_cons (&mut self, num : i32) -> Result<(),String>
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
(i32
) – Number of constraints which should be appended. (input)- Groups
- Task.append_djcs¶
pub fn Task::append_djcs (&mut self, num : i64) -> Result<(),String>
Appends a number of empty disjunctive constraints to the task.
- Parameters
num
(i64
) – Number of empty disjunctive constraints which should be appended. (input)- Groups
- Task.append_dual_exp_cone_domain¶
pub fn Task::append_dual_exp_cone_domain(&mut self) -> Result<i64,String>
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.
- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_dual_geo_mean_cone_domain¶
pub fn Task::append_dual_geo_mean_cone_domain (&mut self, n : i64) -> Result<i64,String>
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
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_dual_power_cone_domain¶
pub fn Task::append_dual_power_cone_domain (&mut self, n : i64, alpha : &[f64]) -> Result<i64,String>
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
(i64
) – Dimension of the domain. (input)alpha
(f64
[]
) – The sequence proportional to exponents. Must be positive. (input)
- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_primal_exp_cone_domain¶
pub fn Task::append_primal_exp_cone_domain(&mut self) -> Result<i64,String>
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.
- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_primal_geo_mean_cone_domain¶
pub fn Task::append_primal_geo_mean_cone_domain (&mut self, n : i64) -> Result<i64,String>
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
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_primal_power_cone_domain¶
pub fn Task::append_primal_power_cone_domain (&mut self, n : i64, alpha : &[f64]) -> Result<i64,String>
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
(i64
) – Dimension of the domain. (input)alpha
(f64
[]
) – The sequence proportional to exponents. Must be positive. (input)
- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_quadratic_cone_domain¶
pub fn Task::append_quadratic_cone_domain (&mut self, n : i64) -> Result<i64,String>
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
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_r_domain¶
pub fn Task::append_r_domain (&mut self, n : i64) -> Result<i64,String>
Appends the \(n\)-dimensional real space \(\{ x \in \real^n \}\) to the list of domains.
- Parameters
n
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_r_quadratic_cone_domain¶
pub fn Task::append_r_quadratic_cone_domain (&mut self, n : i64) -> Result<i64,String>
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
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_rminus_domain¶
pub fn Task::append_rminus_domain (&mut self, n : i64) -> Result<i64,String>
Appends the \(n\)-dimensional negative orthant \(\{ x \in \real^n: \, x \leq 0 \}\) to the list of domains.
- Parameters
n
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_rplus_domain¶
pub fn Task::append_rplus_domain (&mut self, n : i64) -> Result<i64,String>
Appends the \(n\)-dimensional positive orthant \(\{ x \in \real^n: \, x \geq 0 \}\) to the list of domains.
- Parameters
n
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_rzero_domain¶
pub fn Task::append_rzero_domain (&mut self, n : i64) -> Result<i64,String>
Appends the zero in \(n\)-dimensional real space \(\{ x \in \real^n: \, x = 0 \}\) to the list of domains.
- Parameters
n
(i64
) – Dimmension of the domain. (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_sparse_sym_mat¶
pub fn Task::append_sparse_sym_mat (&mut self, dim : i32, subi : &[i32], subj : &[i32], valij : &[f64]) -> Result<i64,String>
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
(i32
) – Dimension of the symmetric matrix that is appended. (input)subi
(i32
[]
) – Row subscript in the triplets. (input)subj
(i32
[]
) – Column subscripts in the triplets. (input)valij
(f64
[]
) – Values of each triplet. (input)
- Return
idx
(i64
) – Unique index assigned to the inputted matrix that can be used for later reference.- Groups
- Task.append_sparse_sym_mat_list¶
pub fn Task::append_sparse_sym_mat_list (&mut self, dims : &[i32], nz : &[i64], subi : &[i32], subj : &[i32], valij : &[f64], idx : &mut[i64]) -> Result<(),String>
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
(i32
[]
) – Dimensions of the symmetric matrixes. (input)nz
(i64
[]
) – Number of nonzeros for each matrix. (input)subi
(i32
[]
) – Row subscript in the triplets. (input)subj
(i32
[]
) – Column subscripts in the triplets. (input)valij
(f64
[]
) – Values of each triplet. (input)idx
(i64
[]
) – Unique index assigned to the inputted matrix that can be used for later reference. (output)
- Groups
- Task.append_svec_psd_cone_domain¶
pub fn Task::append_svec_psd_cone_domain (&mut self, n : i64) -> Result<i64,String>
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
(i64
) – Dimension of the domain, must be of the form \(d(d+1)/2\). (input)- Return
domidx
(i64
) – Index of the domain.- Groups
- Task.append_vars¶
pub fn Task::append_vars (&mut self, num : i32) -> Result<(),String>
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
(i32
) – Number of variables which should be appended. (input)- Groups
- Task.async_get_result¶
pub fn Task::async_get_result (&mut self, address : &str, accesstoken : &str, token : &str, resp : & mut i32, trm : & mut i32) -> Result<bool,String>
Request a solution from a remote job identified by the argument
token
. For other arguments seeTask.async_optimize
. If the solution is available it will be retrieved and loaded into the local task.- Parameters
address
(&str
) – Address of the OptServer. (input)accesstoken
(&str
) – Access token. (input)token
(&str
) – The task token. (input)resp
(Rescode
by reference) – Is the response code from the remote solver. (output)trm
(Rescode
by reference) – Is eitherRescode::OK
or a termination response code. (output)
- Return
respavailable
(bool
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.- Groups
- Task.async_optimize¶
pub fn Task::async_optimize (&mut self, address : &str, accesstoken : &str) -> Result<String,String>
Offload the optimization task to an instance of OptServer specified by
addr
, which should be a valid URL, for examplehttp://server:port
orhttps://server:port
. The call will exit immediately.If the server requires authentication, the authentication token can be passed in the
accesstoken
argument.If the server requires encryption, the keys can be passed using one of the solver parameters
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
(&str
) – Address of the OptServer. (input)accesstoken
(&str
) – Access token. (input)
- Return
token
(String
) – Returns the task token.- Groups
- Task.async_poll¶
pub fn Task::async_poll (&mut self, address : &str, accesstoken : &str, token : &str, resp : & mut i32, trm : & mut i32) -> Result<bool,String>
Requests information about the status of the remote job identified by the argument
token
. For other arguments seeTask.async_optimize
.- Parameters
address
(&str
) – Address of the OptServer. (input)accesstoken
(&str
) – Access token. (input)token
(&str
) – The task token. (input)resp
(Rescode
by reference) – Is the response code from the remote solver. (output)trm
(Rescode
by reference) – Is eitherRescode::OK
or a termination response code. (output)
- Return
respavailable
(bool
) – Indicates if a remote response is available. If this is not true,resp
andtrm
should be ignored.- Groups
- Task.async_stop¶
pub fn Task::async_stop (&mut self, address : &str, accesstoken : &str, token : &str) -> Result<(),String>
Request that the remote job identified by
token
is terminated. For other arguments seeTask.async_optimize
.- Parameters
address
(&str
) – Address of the OptServer. (input)accesstoken
(&str
) – Access token. (input)token
(&str
) – The task token. (input)
- Groups
- Task.basis_cond¶
pub fn Task::basis_cond (&mut self, nrmbasis : &mut f64, nrminvbasis : &mut f64) -> Result<(),String>
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
(f64
by reference) – An estimate for the 1-norm of the basis. (output)nrminvbasis
(f64
by reference) – An estimate for the 1-norm of the inverse of the basis. (output)
- Groups
- Task.check_mem¶
pub fn Task::check_mem (&mut self, file : &str, line : i32) -> Result<(),String>
Checks the memory allocated by the task.
- Parameters
file
(&str
) – File from which the function is called. (input)line
(i32
) – Line in the file from which the function is called. (input)
- Groups
- Task.chg_con_bound¶
pub fn Task::chg_con_bound (&mut self, i : i32, lower : i32, finite : i32, value : f64) -> Result<(),String>
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
(i32
) – Index of the constraint for which the bounds should be changed. (input)lower
(i32
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(i32
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(f64
) – New value for the bound. (input)
- Groups
Problem data - bounds, Problem data - constraints, Problem data - linear part
- Task.chg_var_bound¶
pub fn Task::chg_var_bound (&mut self, j : i32, lower : i32, finite : i32, value : f64) -> Result<(),String>
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
(i32
) – Index of the variable for which the bounds should be changed. (input)lower
(i32
) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)finite
(i32
) – If non-zero, thenvalue
is assumed to be finite. (input)value
(f64
) – New value for the bound. (input)
- Groups
Problem data - bounds, Problem data - variables, Problem data - linear part
- Task.clear_callback¶
pub fn TaskCB::clear_callback (&mut self) -> Result<(),String>
Detaches the callback function.
- Task.clear_stream_callback¶
pub fn TaskCB::clear_stream_callback (&mut self, whichstream : i32) -> Result<(),String>
Detaches a stream callback function.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)
- Task.clone¶
pub fn Task::clone (&self) -> Option<Task>
Creates a clone of an existing task copying all problem data and parameter settings to a new task.
- Return
newtask
(Task
) – The cloned task.
- Task.commit_changes¶
pub fn Task::commit_changes(&mut self) -> Result<(),String>
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.delete_solution¶
pub fn Task::delete_solution (&mut self, whichsol : i32) -> Result<(),String>
Undefine a solution and free the memory it uses.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)- Groups
- Task.dual_sensitivity¶
pub fn Task::dual_sensitivity (&self, subj : &[i32], leftpricej : &mut[f64], rightpricej : &mut[f64], leftrangej : &mut[f64], rightrangej : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – Indexes of objective coefficients to analyze. (input)leftpricej
(f64
[]
) – \(\mathtt{leftpricej}[j]\) is the left shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)rightpricej
(f64
[]
) – \(\mathtt{rightpricej}[j]\) is the right shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)leftrangej
(f64
[]
) – \(\mathtt{leftrangej}[j]\) is the left range \(\beta_1\) for the coefficient with index \(\mathtt{subj[j]}\). (output)rightrangej
(f64
[]
) – \(\mathtt{rightrangej}[j]\) is the right range \(\beta_2\) for the coefficient with index \(\mathtt{subj[j]}\). (output)
- Groups
- Task.empty_afe_barf_row¶
pub fn Task::empty_afe_barf_row (&mut self, afeidx : i64) -> Result<(),String>
Clears a row in \(\barF\) i.e. sets \(\barF_{\mathrm{afeidx},*} = 0\).
- Parameters
afeidx
(i64
) – Row index of \(\barF\). (input)- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.empty_afe_barf_row_list¶
pub fn Task::empty_afe_barf_row_list (&mut self, afeidxlist : &[i64]) -> Result<(),String>
Clears a number of rows in \(\barF\) i.e. sets \(\barF_{i,*} = 0\) for all indices \(i\) in
afeidxlist
.- Parameters
afeidxlist
(i64
[]
) – Indices of rows in \(\barF\) to clear. (input)- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.empty_afe_f_col¶
pub fn Task::empty_afe_f_col (&mut self, varidx : i32) -> Result<(),String>
Clears one column in the affine constraint matrix \(F\), that is sets \(F_{*,\mathrm{varidx}}=0\).
- Parameters
varidx
(i32
) – Index of a variable (column in \(F\)). (input)- Groups
- Task.empty_afe_f_col_list¶
pub fn Task::empty_afe_f_col_list (&mut self, varidx : &[i32]) -> Result<(),String>
Clears a number of columns in \(F\) i.e. sets \(F_{*,j} = 0\) for all indices \(j\) in
varidx
.- Parameters
varidx
(i32
[]
) – Indices of variables (columns) in \(F\) to clear. (input)- Groups
- Task.empty_afe_f_row¶
pub fn Task::empty_afe_f_row (&mut self, afeidx : i64) -> Result<(),String>
Clears one row in the affine constraint matrix \(F\), that is sets \(F_{\mathrm{afeidx},*}=0\).
- Parameters
afeidx
(i64
) – Index of a row in \(F\). (input)- Groups
- Task.empty_afe_f_row_list¶
pub fn Task::empty_afe_f_row_list (&mut self, afeidx : &[i64]) -> Result<(),String>
Clears a number of rows in \(F\) i.e. sets \(F_{i,*} = 0\) for all indices \(i\) in
afeidx
.- Parameters
afeidx
(i64
[]
) – Indices of rows in \(F\) to clear. (input)- Groups
- Task.evaluate_acc¶
pub fn Task::evaluate_acc (&self, whichsol : i32, accidx : i64, activity : &mut[f64]) -> Result<(),String>
Evaluates the activity of an affine conic constraint.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)accidx
(i64
) – The index of the affine conic constraint. (input)activity
(f64
[]
) – The activity of the affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Groups
- Task.evaluate_accs¶
pub fn Task::evaluate_accs (&self, whichsol : i32, activity : &mut[f64]) -> Result<(),String>
Evaluates the activities of all affine conic constraints.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)activity
(f64
[]
) – 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.generate_acc_names¶
pub fn Task::generate_acc_names (&mut self, sub : &[i64], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Internal.
- Parameters
sub
(i64
[]
) – Indexes of the affine conic constraints. (input)fmt
(&str
) – The variable name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
- Task.generate_barvar_names¶
pub fn Task::generate_barvar_names (&mut self, subj : &[i32], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Generates systematic names for variables.
- Parameters
subj
(i32
[]
) – Indexes of the variables. (input)fmt
(&str
) – The variable name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
- Task.generate_con_names¶
pub fn Task::generate_con_names (&mut self, subi : &[i32], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Generates systematic names for constraints.
- Parameters
subi
(i32
[]
) – Indexes of the constraints. (input)fmt
(&str
) – The constraint name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
Names, Problem data - constraints, Problem data - linear part
- Task.generate_cone_names Deprecated¶
pub fn Task::generate_cone_names (&mut self, subk : &[i32], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Internal, deprecated.
- Parameters
subk
(i32
[]
) – Indexes of the cone. (input)fmt
(&str
) – The cone name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
- Task.generate_djc_names¶
pub fn Task::generate_djc_names (&mut self, sub : &[i64], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Internal.
- Parameters
sub
(i64
[]
) – Indexes of the disjunctive constraints. (input)fmt
(&str
) – The variable name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
- Task.generate_var_names¶
pub fn Task::generate_var_names (&mut self, subj : &[i32], fmt : &str, dims : &[i32], sp : &[i64], namedaxisidxs : &[i32], names : &[String]) -> Result<(),String>
Generates systematic names for variables.
- Parameters
subj
(i32
[]
) – Indexes of the variables. (input)fmt
(&str
) – The variable name formatting string. (input)dims
(i32
[]
) – Dimensions in the shape. (input)sp
(i64
[]
) – Items that should be named. (input)namedaxisidxs
(i32
[]
) – List if named index axes (input)names
(String
[]
) – All axis names. (input)
- Groups
- Task.get_a_col¶
pub fn Task::get_a_col (&self, j : i32, nzj : &mut i32, subj : &mut[i32], valj : &mut[f64]) -> Result<(),String>
Obtains one column of \(A\) in a sparse format.
- Parameters
j
(i32
) – Index of the column. (input)nzj
(i32
by reference) – Number of non-zeros in the column obtained. (output)subj
(i32
[]
) – Row indices of the non-zeros in the column obtained. (output)valj
(f64
[]
) – Numerical values in the column obtained. (output)
- Groups
- Task.get_a_col_num_nz¶
pub fn Task::get_a_col_num_nz (&self, i : i32) -> Result<i32,String>
Obtains the number of non-zero elements in one column of \(A\).
- Parameters
i
(i32
) – Index of the column. (input)- Return
nzj
(i32
) – Number of non-zeros in the \(j\)-th column of \(A\).- Groups
- Task.get_a_col_slice¶
pub fn Task::get_a_col_slice (&self, first : i32, last : i32, ptrb : &mut[i64], ptre : &mut[i64], sub : &mut[i32], val : &mut[f64]) -> Result<(),String>
Obtains a sequence of columns from \(A\) in sparse format.
- Parameters
first
(i32
) – Index of the first column in the sequence. (input)last
(i32
) – Index of the last column in the sequence plus one. (input)ptrb
(i64
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th column obtained. (output)ptre
(i64
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th column obtained. (output)sub
(i32
[]
) – Contains the row subscripts. (output)val
(f64
[]
) – Contains the coefficient values. (output)
- Groups
- Task.get_a_col_slice_num_nz¶
pub fn Task::get_a_col_slice_num_nz (&self, first : i32, last : i32) -> Result<i64,String>
Obtains the number of non-zeros in a slice of columns of \(A\).
- Parameters
first
(i32
) – Index of the first column in the sequence. (input)last
(i32
) – Index of the last column plus one in the sequence. (input)
- Return
numnz
(i64
) – Number of non-zeros in the slice.- Groups
- Task.get_a_col_slice_trip¶
pub fn Task::get_a_col_slice_trip (&self, first : i32, last : i32, subi : &mut[i32], subj : &mut[i32], val : &mut[f64]) -> Result<(),String>
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
(i32
) – Index of the first column in the sequence. (input)last
(i32
) – Index of the last column in the sequence plus one. (input)subi
(i32
[]
) – Constraint subscripts. (output)subj
(i32
[]
) – Column subscripts. (output)val
(f64
[]
) – Values. (output)
- Groups
- Task.get_a_piece_num_nz¶
pub fn Task::get_a_piece_num_nz (&self, firsti : i32, lasti : i32, firstj : i32, lastj : i32) -> Result<i32,String>
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.get_a_row_num_nz
orTask.get_a_col_num_nz
.- Parameters
firsti
(i32
) – Index of the first row in the rectangular piece. (input)lasti
(i32
) – Index of the last row plus one in the rectangular piece. (input)firstj
(i32
) – Index of the first column in the rectangular piece. (input)lastj
(i32
) – Index of the last column plus one in the rectangular piece. (input)
- Return
numnz
(i32
) – Number of non-zero \(A\) elements in the rectangular piece.- Groups
- Task.get_a_row¶
pub fn Task::get_a_row (&self, i : i32, nzi : &mut i32, subi : &mut[i32], vali : &mut[f64]) -> Result<(),String>
Obtains one row of \(A\) in a sparse format.
- Parameters
i
(i32
) – Index of the row. (input)nzi
(i32
by reference) – Number of non-zeros in the row obtained. (output)subi
(i32
[]
) – Column indices of the non-zeros in the row obtained. (output)vali
(f64
[]
) – Numerical values of the row obtained. (output)
- Groups
- Task.get_a_row_num_nz¶
pub fn Task::get_a_row_num_nz (&self, i : i32) -> Result<i32,String>
Obtains the number of non-zero elements in one row of \(A\).
- Parameters
i
(i32
) – Index of the row. (input)- Return
nzi
(i32
) – Number of non-zeros in the \(i\)-th row of \(A\).- Groups
- Task.get_a_row_slice¶
pub fn Task::get_a_row_slice (&self, first : i32, last : i32, ptrb : &mut[i64], ptre : &mut[i64], sub : &mut[i32], val : &mut[f64]) -> Result<(),String>
Obtains a sequence of rows from \(A\) in sparse format.
- Parameters
first
(i32
) – Index of the first row in the sequence. (input)last
(i32
) – Index of the last row in the sequence plus one. (input)ptrb
(i64
[]
) –ptrb[t]
is an index pointing to the first element in the \(t\)-th row obtained. (output)ptre
(i64
[]
) –ptre[t]
is an index pointing to the last element plus one in the \(t\)-th row obtained. (output)sub
(i32
[]
) – Contains the column subscripts. (output)val
(f64
[]
) – Contains the coefficient values. (output)
- Groups
- Task.get_a_row_slice_num_nz¶
pub fn Task::get_a_row_slice_num_nz (&self, first : i32, last : i32) -> Result<i64,String>
Obtains the number of non-zeros in a slice of rows of \(A\).
- Parameters
first
(i32
) – Index of the first row in the sequence. (input)last
(i32
) – Index of the last row plus one in the sequence. (input)
- Return
numnz
(i64
) – Number of non-zeros in the slice.- Groups
- Task.get_a_row_slice_trip¶
pub fn Task::get_a_row_slice_trip (&self, first : i32, last : i32, subi : &mut[i32], subj : &mut[i32], val : &mut[f64]) -> Result<(),String>
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
(i32
) – Index of the first row in the sequence. (input)last
(i32
) – Index of the last row in the sequence plus one. (input)subi
(i32
[]
) – Constraint subscripts. (output)subj
(i32
[]
) – Column subscripts. (output)val
(f64
[]
) – Values. (output)
- Groups
- Task.get_a_trip¶
pub fn Task::get_a_trip (&self, subi : &mut[i32], subj : &mut[i32], val : &mut[f64]) -> Result<(),String>
Obtains \(A\) in sparse triplet format. The triplets corresponding to nonzero entries are stored in the arrays
subi
,subj
andval
.- Parameters
subi
(i32
[]
) – Constraint subscripts. (output)subj
(i32
[]
) – Column subscripts. (output)val
(f64
[]
) – Values. (output)
- Groups
- Task.get_a_truncate_tol¶
pub fn Task::get_a_truncate_tol (&self, tolzero : &mut[f64]) -> Result<(),String>
Obtains the tolerance value set with
Task.put_a_truncate_tol
.- Parameters
tolzero
(f64
[]
) – All elements \(|a_{i,j}|\) less than this tolerance is truncated to zero. (output)- Groups
- Task.get_acc_afe_idx_list¶
pub fn Task::get_acc_afe_idx_list (&self, accidx : i64, afeidxlist : &mut[i64]) -> Result<(),String>
Obtains the list of affine expressions appearing in the affine conic constraint.
- Parameters
accidx
(i64
) – Index of the affine conic constraint. (input)afeidxlist
(i64
[]
) – List of indexes of affine expressions appearing in the constraint. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_b¶
pub fn Task::get_acc_b (&self, accidx : i64, b : &mut[f64]) -> Result<(),String>
Obtains the additional constant term vector appearing in the affine conic constraint.
- Parameters
accidx
(i64
) – Index of the affine conic constraint. (input)b
(f64
[]
) – The vector b appearing in the constraint. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_barf_block_triplet¶
pub fn Task::get_acc_barf_block_triplet (&self, acc_afe : &mut[i64], bar_var : &mut[i32], blk_row : &mut[i32], blk_col : &mut[i32], blk_val : &mut[f64]) -> Result<i64,String>
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
acc_afe
(i64
[]
) – Index of the AFE within the concatenated list of AFEs in ACCs. (output)bar_var
(i32
[]
) – Symmetric matrix variable index. (output)blk_row
(i32
[]
) – Block row index. (output)blk_col
(i32
[]
) – Block column index. (output)blk_val
(f64
[]
) – The numerical value associated with each block triplet. (output)
- Return
numtrip
(i64
) – Number of elements in the block triplet form.- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.get_acc_barf_num_block_triplets¶
pub fn Task::get_acc_barf_num_block_triplets(&self) -> Result<i64,String>
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\), as used within the ACCs.
- Return
numtrip
(i64
) – 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.get_acc_domain¶
pub fn Task::get_acc_domain (&mut self, accidx : i64) -> Result<i64,String>
Obtains the domain appearing in the affine conic constraint.
- Parameters
accidx
(i64
) – The index of the affine conic constraint. (input)- Return
domidx
(i64
) – The index of domain in the affine conic constraint.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_dot_y¶
pub fn Task::get_acc_dot_y (&self, whichsol : i32, accidx : i64, doty : &mut[f64]) -> Result<(),String>
Obtains the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)accidx
(i64
) – The index of the affine conic constraint. (input)doty
(f64
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Groups
- Task.get_acc_dot_y_s¶
pub fn Task::get_acc_dot_y_s (&self, whichsol : i32, doty : &mut[f64]) -> Result<(),String>
Obtains the \(\dot{y}\) vector for a solution (the dual values of all affine conic constraint).
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)doty
(f64
[]
) – 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.get_acc_f_numnz¶
pub fn Task::get_acc_f_numnz(&mut self) -> Result<i64,String>
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.
- Return
accfnnz
(i64
) – Number of non-zeros in \(F\) implied by ACCs.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_f_trip¶
pub fn Task::get_acc_f_trip (&mut self, frow : &mut[i64], fcol : &mut[i32], fval : &mut[f64]) -> Result<(),String>
Obtains the \(F\) (that would be implied by the ordering of the AFEs within the ACCs) in triplet format.
- Parameters
frow
(i64
[]
) – Row indices of nonzeros in the implied F matrix. (output)fcol
(i32
[]
) – Column indices of nonzeros in the implied F matrix. (output)fval
(f64
[]
) – Values of nonzero entries in the implied F matrix. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_g_vector¶
pub fn Task::get_acc_g_vector (&self, g : &mut[f64]) -> Result<(),String>
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
(f64
[]
) – 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.get_acc_n¶
pub fn Task::get_acc_n (&mut self, accidx : i64) -> Result<i64,String>
Obtains the dimension of the affine conic constraint.
- Parameters
accidx
(i64
) – The index of the affine conic constraint. (input)- Return
n
(i64
) – The dimension of the affine conic constraint (equal to the dimension of its domain).- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_n_tot¶
pub fn Task::get_acc_n_tot(&mut self) -> Result<i64,String>
Obtains the total dimension of all affine conic constraints (the sum of all their dimensions).
- Return
n
(i64
) – The total dimension of all affine conic constraints.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_name¶
pub fn Task::get_acc_name (&self, accidx : i64) -> Result<String,String>
Obtains the name of an affine conic constraint.
- Parameters
accidx
(i64
) – Index of an affine conic constraint. (input)- Return
name
(String
) – Returns the required name.- Groups
Names, Problem data - affine conic constraints, Inspecting the task
- Task.get_acc_name_len¶
pub fn Task::get_acc_name_len (&self, accidx : i64) -> Result<i32,String>
Obtains the length of the name of an affine conic constraint.
- Parameters
accidx
(i64
) – Index of an affine conic constraint. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
Names, Problem data - affine conic constraints, Inspecting the task
- Task.get_accs¶
pub fn Task::get_accs (&self, domidxlist : &mut[i64], afeidxlist : &mut[i64], b : &mut[f64]) -> Result<(),String>
Obtains full data of all affine conic constraints. The output array
domainidxlist
must have at least length determined byTask.get_num_acc
. The output arraysafeidxlist
andb
must have at least length determined byTask.get_acc_n_tot
.- Parameters
domidxlist
(i64
[]
) – The list of domains appearing in all affine conic constraints. (output)afeidxlist
(i64
[]
) – The concatenation of index lists of affine expressions appearing in all affine conic constraints. (output)b
(f64
[]
) – The concatenation of vectors b appearing in all affine conic constraints. (output)
- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_afe_barf_block_triplet¶
pub fn Task::get_afe_barf_block_triplet (&self, afeidx : &mut[i64], barvaridx : &mut[i32], subk : &mut[i32], subl : &mut[i32], valkl : &mut[f64]) -> Result<i64,String>
Obtains \(\barF\) in block triplet form.
- Parameters
afeidx
(i64
[]
) – Constraint index. (output)barvaridx
(i32
[]
) – Symmetric matrix variable index. (output)subk
(i32
[]
) – Block row index. (output)subl
(i32
[]
) – Block column index. (output)valkl
(f64
[]
) – The numerical value associated with each block triplet. (output)
- Return
numtrip
(i64
) – Number of elements in the block triplet form.- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.get_afe_barf_num_block_triplets¶
pub fn Task::get_afe_barf_num_block_triplets(&self) -> Result<i64,String>
Obtains an upper bound on the number of elements in the block triplet form of \(\barF\).
- Return
numtrip
(i64
) – An upper bound on the number of elements in the block triplet form of \(\barF.\)- Groups
- Task.get_afe_barf_num_row_entries¶
pub fn Task::get_afe_barf_num_row_entries (&mut self, afeidx : i64) -> Result<i32,String>
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
(i64
) – Row index of \(\barF\). (input)- Return
numentr
(i32
) – Number of nonzero entries in a row of \(\barF\).- Groups
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- Task.get_afe_barf_row¶
pub fn Task::get_afe_barf_row (&mut self, afeidx : i64, barvaridx : &mut[i32], ptrterm : &mut[i64], numterm : &mut[i64], termidx : &mut[i64], termweight : &mut[f64]) -> Result<(),String>
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.get_afe_barf_row_info
.- Parameters
afeidx
(i64
) – Row index of \(\barF\). (input)barvaridx
(i32
[]
) – Semidefinite variable indices of nonzero entries in the row of \(\barF\). (output)ptrterm
(i64
[]
) – Pointers to the start of each entry’s description. (output)numterm
(i64
[]
) – Number of terms in the weighted sum representation of each entry. (output)termidx
(i64
[]
) – Indices of semidefinite matrices from the matrix store \(E\). (output)termweight
(f64
[]
) – Weights appearing in the weighted sum representations of all entries. (output)
- Groups
Problem data - affine expressions, Problem data - semidefinite, Inspecting the task
- Task.get_afe_barf_row_info¶
pub fn Task::get_afe_barf_row_info (&mut self, afeidx : i64, numentr : &mut i32, numterm : &mut i64) -> Result<(),String>
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.get_afe_barf_row
.- Parameters
afeidx
(i64
) – Row index of \(\barF\). (input)numentr
(i32
by reference) – Number of nonzero entries in a row of \(\barF\). (output)numterm
(i64
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.get_afe_f_num_nz¶
pub fn Task::get_afe_f_num_nz(&mut self) -> Result<i64,String>
Obtains the total number of nonzeros in \(F\).
- Return
numnz
(i64
) – Number of non-zeros in \(F\).- Groups
- Task.get_afe_f_row¶
pub fn Task::get_afe_f_row (&mut self, afeidx : i64, numnz : &mut i32, varidx : &mut[i32], val : &mut[f64]) -> Result<(),String>
Obtains one row of \(F\) in sparse format.
- Parameters
afeidx
(i64
) – Index of a row in \(F\). (input)numnz
(i32
by reference) – Number of non-zeros in the row obtained. (output)varidx
(i32
[]
) – Column indices of the non-zeros in the row obtained. (output)val
(f64
[]
) – Values of the non-zeros in the row obtained. (output)
- Groups
- Task.get_afe_f_row_num_nz¶
pub fn Task::get_afe_f_row_num_nz (&mut self, afeidx : i64) -> Result<i32,String>
Obtains the number of nonzeros in one row of \(F\).
- Parameters
afeidx
(i64
) – Index of a row in \(F\). (input)- Return
numnz
(i32
) – Number of non-zeros in rowafeidx
of \(F\).- Groups
- Task.get_afe_f_trip¶
pub fn Task::get_afe_f_trip (&mut self, afeidx : &mut[i64], varidx : &mut[i32], val : &mut[f64]) -> Result<(),String>
Obtains the \(F\) in triplet format.
- Parameters
afeidx
(i64
[]
) – Row indices of nonzeros. (output)varidx
(i32
[]
) – Column indices of nonzeros. (output)val
(f64
[]
) – Values of nonzero entries. (output)
- Groups
- Task.get_afe_g¶
pub fn Task::get_afe_g (&mut self, afeidx : i64) -> Result<f64,String>
Obtains a single coefficient in \(g\).
- Parameters
afeidx
(i64
) – Index of an element in \(g\). (input)- Return
g
(f64
) – The value of \(g_{\mathrm{afeidx}}\).- Groups
- Task.get_afe_g_slice¶
pub fn Task::get_afe_g_slice (&self, first : i64, last : i64, g : &mut[f64]) -> Result<(),String>
Obtains a sequence of elements from the vector \(g\) of constant terms in the affine expressions list.
- Parameters
first
(i64
) – First index in the sequence. (input)last
(i64
) – Last index plus 1 in the sequence. (input)g
(f64
[]
) – The slice \(g\) as a dense vector. The length islast-first
. (output)
- Groups
- Task.get_aij¶
pub fn Task::get_aij (&self, i : i32, j : i32) -> Result<f64,String>
Obtains a single coefficient in \(A\).
- Parameters
i
(i32
) – Row index of the coefficient to be returned. (input)j
(i32
) – Column index of the coefficient to be returned. (input)
- Return
aij
(f64
) – The required coefficient \(a_{i,j}\).- Groups
- Task.get_bara_block_triplet¶
pub fn Task::get_bara_block_triplet (&self, subi : &mut[i32], subj : &mut[i32], subk : &mut[i32], subl : &mut[i32], valijkl : &mut[f64]) -> Result<i64,String>
Obtains \(\barA\) in block triplet form.
- Parameters
subi
(i32
[]
) – Constraint index. (output)subj
(i32
[]
) – Symmetric matrix variable index. (output)subk
(i32
[]
) – Block row index. (output)subl
(i32
[]
) – Block column index. (output)valijkl
(f64
[]
) – The numerical value associated with each block triplet. (output)
- Return
num
(i64
) – Number of elements in the block triplet form.- Groups
- Task.get_bara_idx¶
pub fn Task::get_bara_idx (&self, idx : i64, i : &mut i32, j : &mut i32, sub : &mut[i64], weights : &mut[f64]) -> Result<i64,String>
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
(i64
) – Position of the element in the vectorized form. (input)i
(i32
by reference) – Row index of the element at positionidx
. (output)j
(i32
by reference) – Column index of the element at positionidx
. (output)sub
(i64
[]
) – A list indexes of the elements from symmetric matrix storage that appear in the weighted sum. (output)weights
(f64
[]
) – The weights associated with each term in the weighted sum. (output)
- Return
num
(i64
) – Number of terms in weighted sum that forms the element.- Groups
- Task.get_bara_idx_i_j¶
pub fn Task::get_bara_idx_i_j (&self, idx : i64, i : &mut i32, j : &mut i32) -> Result<(),String>
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
(i64
) – Position of the element in the vectorized form. (input)i
(i32
by reference) – Row index of the element at positionidx
. (output)j
(i32
by reference) – Column index of the element at positionidx
. (output)
- Groups
- Task.get_bara_idx_info¶
pub fn Task::get_bara_idx_info (&self, idx : i64) -> Result<i64,String>
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.append_sparse_sym_mat
for details about the weighted sum.- Parameters
idx
(i64
) – The internal position of the element for which information should be obtained. (input)- Return
num
(i64
) – Number of terms in the weighted sum that form the specified element in \(\barA\).- Groups
- Task.get_bara_sparsity¶
pub fn Task::get_bara_sparsity (&self, numnz : &mut i64, idxij : &mut[i64]) -> Result<(),String>
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.get_bara_idx_info
andTask.get_bara_idx
.- Parameters
numnz
(i64
by reference) – Number of nonzero elements in \(\barA\). (output)idxij
(i64
[]
) – Position of each nonzero element in the vectorized form of \(\barA\). (output)
- Groups
- Task.get_barc_block_triplet¶
pub fn Task::get_barc_block_triplet (&self, subj : &mut[i32], subk : &mut[i32], subl : &mut[i32], valjkl : &mut[f64]) -> Result<i64,String>
Obtains \(\barC\) in block triplet form.
- Parameters
subj
(i32
[]
) – Symmetric matrix variable index. (output)subk
(i32
[]
) – Block row index. (output)subl
(i32
[]
) – Block column index. (output)valjkl
(f64
[]
) – The numerical value associated with each block triplet. (output)
- Return
num
(i64
) – Number of elements in the block triplet form.- Groups
- Task.get_barc_idx¶
pub fn Task::get_barc_idx (&self, idx : i64, j : &mut i32, num : &mut i64, sub : &mut[i64], weights : &mut[f64]) -> Result<(),String>
Obtains information about an element in \(\barC\).
- Parameters
idx
(i64
) – Index of the element for which information should be obtained. (input)j
(i32
by reference) – Row index in \(\barC\). (output)num
(i64
by reference) – Number of terms in the weighted sum. (output)sub
(i64
[]
) – Elements appearing the weighted sum. (output)weights
(f64
[]
) – Weights of terms in the weighted sum. (output)
- Groups
- Task.get_barc_idx_info¶
pub fn Task::get_barc_idx_info (&self, idx : i64) -> Result<i64,String>
Obtains the number of terms in the weighted sum that forms a particular element in \(\barC\).
- Parameters
idx
(i64
) – Index of the element for which information should be obtained. The value is an index of a symmetric sparse variable. (input)- Return
num
(i64
) – Number of terms that appear in the weighted sum that forms the requested element.- Groups
- Task.get_barc_idx_j¶
pub fn Task::get_barc_idx_j (&self, idx : i64, j : &mut i32) -> Result<(),String>
Obtains the row index of an element in \(\barC\).
- Parameters
idx
(i64
) – Index of the element for which information should be obtained. (input)j
(i32
by reference) – Row index in \(\barC\). (output)
- Groups
- Task.get_barc_sparsity¶
pub fn Task::get_barc_sparsity (&self, numnz : &mut i64, idxj : &mut[i64]) -> Result<(),String>
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.get_barc_idx_info
andTask.get_barc_idx
.- Parameters
numnz
(i64
by reference) – Number of nonzero elements in \(\barC\). (output)idxj
(i64
[]
) – Internal positions of the nonzeros elements in \(\barC\). (output)
- Groups
- Task.get_bars_j¶
pub fn Task::get_bars_j (&self, whichsol : i32, j : i32, barsj : &mut[f64]) -> Result<(),String>
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
(i32
) – Index of the semidefinite variable. (input)barsj
(f64
[]
) – Value of \(\barS_j\). (output)
- Groups
- Task.get_bars_slice¶
pub fn Task::get_bars_slice (&self, whichsol : i32, first : i32, last : i32, slicesize : i64, barsslice : &mut[f64]) -> Result<(),String>
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.get_bars_j
.- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – Index of the first semidefinite variable in the slice. (input)last
(i32
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(i64
) – Denotes the length of the arraybarsslice
. (input)barsslice
(f64
[]
) – Dual solution values of symmetric matrix variables in the slice, stored sequentially. (output)
- Groups
- Task.get_barvar_name¶
pub fn Task::get_barvar_name (&self, i : i32) -> Result<String,String>
Obtains the name of a semidefinite variable.
- Parameters
i
(i32
) – Index of the variable. (input)- Return
name
(String
) – The requested name is copied to this buffer.- Groups
- Task.get_barvar_name_index¶
pub fn Task::get_barvar_name_index (&self, somename : &str, asgn : &mut i32) -> Result<i32,String>
Obtains the index of semidefinite variable from its name.
- Parameters
somename
(&str
) – The name of the variable. (input)asgn
(i32
by reference) – Non-zero if the namesomename
is assigned to some semidefinite variable. (output)
- Return
index
(i32
) – The index of a semidefinite variable with the namesomename
(if one exists).- Groups
- Task.get_barvar_name_len¶
pub fn Task::get_barvar_name_len (&self, i : i32) -> Result<i32,String>
Obtains the length of the name of a semidefinite variable.
- Parameters
i
(i32
) – Index of the variable. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
- Task.get_barx_j¶
pub fn Task::get_barx_j (&self, whichsol : i32, j : i32, barxj : &mut[f64]) -> Result<(),String>
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
(i32
) – Index of the semidefinite variable. (input)barxj
(f64
[]
) – Value of \(\barX_j\). (output)
- Groups
- Task.get_barx_slice¶
pub fn Task::get_barx_slice (&self, whichsol : i32, first : i32, last : i32, slicesize : i64, barxslice : &mut[f64]) -> Result<(),String>
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.get_barx_j
.- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – Index of the first semidefinite variable in the slice. (input)last
(i32
) – Index of the last semidefinite variable in the slice plus one. (input)slicesize
(i64
) – Denotes the length of the arraybarxslice
. (input)barxslice
(f64
[]
) – Solution values of symmetric matrix variables in the slice, stored sequentially. (output)
- Groups
- Task.get_c¶
pub fn Task::get_c (&self, c : &mut[f64]) -> Result<(),String>
Obtains all objective coefficients \(c\).
- Parameters
c
(f64
[]
) – 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.get_c_j¶
pub fn Task::get_c_j (&self, j : i32, cj : &mut f64) -> Result<(),String>
Obtains one coefficient of \(c\).
- Parameters
j
(i32
) – Index of the variable for which the \(c\) coefficient should be obtained. (input)cj
(f64
by reference) – The value of \(c_j\). (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - variables
- Task.get_c_list¶
pub fn Task::get_c_list (&self, subj : &[i32], c : &mut[f64]) -> Result<(),String>
Obtains a sequence of elements in \(c\).
- Parameters
subj
(i32
[]
) – A list of variable indexes. (input)c
(f64
[]
) – Linear terms of the requested list of the objective as a dense vector. (output)
- Groups
- Task.get_c_slice¶
pub fn Task::get_c_slice (&self, first : i32, last : i32, c : &mut[f64]) -> Result<(),String>
Obtains a sequence of elements in \(c\).
- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)c
(f64
[]
) – Linear terms of the requested slice of the objective as a dense vector. The length islast-first
. (output)
- Groups
- Task.get_cfix¶
pub fn Task::get_cfix(&self) -> Result<f64,String>
Obtains the fixed term in the objective.
- Return
cfix
(f64
) – Fixed term in the objective.- Groups
- Task.get_con_bound¶
pub fn Task::get_con_bound (&self, i : i32, bk : & mut i32, bl : &mut f64, bu : &mut f64) -> Result<(),String>
Obtains bound information for one constraint.
- Parameters
i
(i32
) – Index of the constraint for which the bound information should be obtained. (input)bk
(Boundkey
by reference) – Bound keys. (output)bl
(f64
by reference) – Values for lower bounds. (output)bu
(f64
by reference) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- Task.get_con_bound_slice¶
pub fn Task::get_con_bound_slice (&self, first : i32, last : i32, bk : &mut[i32], bl : &mut[f64], bu : &mut[f64]) -> Result<(),String>
Obtains bounds information for a slice of the constraints.
- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bk
(Boundkey
[]
) – Bound keys. (output)bl
(f64
[]
) – Values for lower bounds. (output)bu
(f64
[]
) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - constraints
- Task.get_con_name¶
pub fn Task::get_con_name (&self, i : i32) -> Result<String,String>
Obtains the name of a constraint.
- Parameters
i
(i32
) – Index of the constraint. (input)- Return
name
(String
) – The required name.- Groups
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.get_con_name_index¶
pub fn Task::get_con_name_index (&self, somename : &str, asgn : &mut i32) -> Result<i32,String>
Checks whether the name
somename
has been assigned to any constraint. If so, the index of the constraint is reported.- Parameters
somename
(&str
) – The name which should be checked. (input)asgn
(i32
by reference) – Is non-zero if the namesomename
is assigned to some constraint. (output)
- Return
index
(i32
) – 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.get_con_name_len¶
pub fn Task::get_con_name_len (&self, i : i32) -> Result<i32,String>
Obtains the length of the name of a constraint.
- Parameters
i
(i32
) – Index of the constraint. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
Names, Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.get_cone Deprecated¶
pub fn Task::get_cone (&mut self, k : i32, ct : & mut i32, conepar : &mut f64, nummem : &mut i32, submem : &mut[i32]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
k
(i32
) – Index of the cone. (input)ct
(Conetype
by reference) – Specifies the type of the cone. (output)conepar
(f64
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
(i32
by reference) – Number of member variables in the cone. (output)submem
(i32
[]
) – Variable subscripts of the members in the cone. (output)
- Groups
- Task.get_cone_info Deprecated¶
pub fn Task::get_cone_info (&self, k : i32, ct : & mut i32, conepar : &mut f64, nummem : &mut i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
k
(i32
) – Index of the cone. (input)ct
(Conetype
by reference) – Specifies the type of the cone. (output)conepar
(f64
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
(i32
by reference) – Number of member variables in the cone. (output)
- Groups
- Task.get_cone_name Deprecated¶
pub fn Task::get_cone_name (&self, i : i32) -> Result<String,String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
i
(i32
) – Index of the cone. (input)- Return
name
(String
) – The required name.- Groups
Names, Problem data - cones (deprecated), Inspecting the task
- Task.get_cone_name_index Deprecated¶
pub fn Task::get_cone_name_index (&self, somename : &str, asgn : &mut i32) -> Result<i32,String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(&str
) – The name which should be checked. (input)asgn
(i32
by reference) – Is non-zero if the namesomename
is assigned to some cone. (output)
- Return
index
(i32
) – 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.get_cone_name_len Deprecated¶
pub fn Task::get_cone_name_len (&self, i : i32) -> Result<i32,String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
i
(i32
) – Index of the cone. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
Names, Problem data - cones (deprecated), Inspecting the task
- Task.get_dim_barvar_j¶
pub fn Task::get_dim_barvar_j (&self, j : i32) -> Result<i32,String>
Obtains the dimension of a symmetric matrix variable.
- Parameters
j
(i32
) – Index of the semidefinite variable whose dimension is requested. (input)- Return
dimbarvarj
(i32
) – The dimension of the \(j\)-th semidefinite variable.- Groups
- Task.get_djc_afe_idx_list¶
pub fn Task::get_djc_afe_idx_list (&self, djcidx : i64, afeidxlist : &mut[i64]) -> Result<(),String>
Obtains the list of affine expression indexes in a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (output)
- Groups
- Task.get_djc_b¶
pub fn Task::get_djc_b (&self, djcidx : i64, b : &mut[f64]) -> Result<(),String>
Obtains the optional constant term vector of a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)b
(f64
[]
) – The vector b. (output)
- Groups
- Task.get_djc_domain_idx_list¶
pub fn Task::get_djc_domain_idx_list (&self, djcidx : i64, domidxlist : &mut[i64]) -> Result<(),String>
Obtains the list of domain indexes in a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)domidxlist
(i64
[]
) – List of term sizes. (output)
- Groups
- Task.get_djc_name¶
pub fn Task::get_djc_name (&self, djcidx : i64) -> Result<String,String>
Obtains the name of a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of a disjunctive constraint. (input)- Return
name
(String
) – Returns the required name.- Groups
Names, Problem data - disjunctive constraints, Inspecting the task
- Task.get_djc_name_len¶
pub fn Task::get_djc_name_len (&self, djcidx : i64) -> Result<i32,String>
Obtains the length of the name of a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of a disjunctive constraint. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
Names, Problem data - disjunctive constraints, Inspecting the task
- Task.get_djc_num_afe¶
pub fn Task::get_djc_num_afe (&mut self, djcidx : i64) -> Result<i64,String>
Obtains the number of affine expressions in the disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)- Return
numafe
(i64
) – Number of affine expressions in the disjunctive constraint.- Groups
- Task.get_djc_num_afe_tot¶
pub fn Task::get_djc_num_afe_tot(&mut self) -> Result<i64,String>
Obtains the total number of affine expressions in all disjunctive constraints.
- Return
numafetot
(i64
) – Number of affine expressions in all disjunctive constraints.- Groups
- Task.get_djc_num_domain¶
pub fn Task::get_djc_num_domain (&mut self, djcidx : i64) -> Result<i64,String>
Obtains the number of domains in the disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)- Return
numdomain
(i64
) – Number of domains in the disjunctive constraint.- Groups
- Task.get_djc_num_domain_tot¶
pub fn Task::get_djc_num_domain_tot(&mut self) -> Result<i64,String>
Obtains the total number of domains in all disjunctive constraints.
- Return
numdomaintot
(i64
) – Number of domains in all disjunctive constraints.- Groups
- Task.get_djc_num_term¶
pub fn Task::get_djc_num_term (&mut self, djcidx : i64) -> Result<i64,String>
Obtains the number terms in the disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)- Return
numterm
(i64
) – Number of terms in the disjunctive constraint.- Groups
- Task.get_djc_num_term_tot¶
pub fn Task::get_djc_num_term_tot(&mut self) -> Result<i64,String>
Obtains the total number of terms in all disjunctive constraints.
- Return
numtermtot
(i64
) – Total number of terms in all disjunctive constraints.- Groups
- Task.get_djc_term_size_list¶
pub fn Task::get_djc_term_size_list (&self, djcidx : i64, termsizelist : &mut[i64]) -> Result<(),String>
Obtains the list of term sizes in a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)termsizelist
(i64
[]
) – List of term sizes. (output)
- Groups
- Task.get_djcs¶
pub fn Task::get_djcs (&self, domidxlist : &mut[i64], afeidxlist : &mut[i64], b : &mut[f64], termsizelist : &mut[i64], numterms : &mut[i64]) -> Result<(),String>
Obtains full data of all disjunctive constraints. The output arrays must have minimal lengths determined by the following methods:
domainidxlist
byTask.get_djc_num_domain_tot
,afeidxlist
andb
byTask.get_djc_num_afe_tot
,termsizelist
byTask.get_djc_num_term_tot
andnumterms
byTask.get_num_domain
.- Parameters
domidxlist
(i64
[]
) – The concatenation of index lists of domains appearing in all disjunctive constraints. (output)afeidxlist
(i64
[]
) – The concatenation of index lists of affine expressions appearing in all disjunctive constraints. (output)b
(f64
[]
) – The concatenation of vectors b appearing in all disjunctive constraints. (output)termsizelist
(i64
[]
) – The concatenation of lists of term sizes appearing in all disjunctive constraints. (output)numterms
(i64
[]
) – The number of terms in each of the disjunctive constraints. (output)
- Groups
- Task.get_domain_n¶
pub fn Task::get_domain_n (&self, domidx : i64) -> Result<i64,String>
Obtains the dimension of the domain.
- Parameters
domidx
(i64
) – Index of the domain. (input)- Return
n
(i64
) – Dimension of the domain.- Groups
- Task.get_domain_name¶
pub fn Task::get_domain_name (&self, domidx : i64) -> Result<String,String>
Obtains the name of a domain.
- Parameters
domidx
(i64
) – Index of a domain. (input)- Return
name
(String
) – Returns the required name.- Groups
- Task.get_domain_name_len¶
pub fn Task::get_domain_name_len (&self, domidx : i64) -> Result<i32,String>
Obtains the length of the name of a domain.
- Parameters
domidx
(i64
) – Index of a domain. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
- Task.get_domain_type¶
pub fn Task::get_domain_type (&self, domidx : i64) -> Result<i32,String>
Returns the type of the domain.
- Parameters
domidx
(i64
) – Index of the domain. (input)- Return
domtype
(Domaintype
) – The type of the domain.- Groups
- Task.get_dou_inf¶
pub fn Task::get_dou_inf (&self, whichdinf : i32) -> Result<f64,String>
Obtains a double information item from the task information database.
- Parameters
whichdinf
(Dinfitem
) – Specifies a double information item. (input)- Return
dvalue
(f64
) – The value of the required double information item.- Groups
- Task.get_dou_param¶
pub fn Task::get_dou_param (&self, param : i32) -> Result<f64,String>
Obtains the value of a double parameter.
- Parameters
param
(Dparam
) – Which parameter. (input)- Return
parvalue
(f64
) – Parameter value.- Groups
- Task.get_dual_obj¶
pub fn Task::get_dual_obj (&self, whichsol : i32, dualobj : &mut f64) -> Result<(),String>
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
(f64
by reference) – Objective value corresponding to the dual solution. (output)
- Groups
- Task.get_dual_solution_norms¶
pub fn Task::get_dual_solution_norms (&self, whichsol : i32, nrmy : &mut f64, nrmslc : &mut f64, nrmsuc : &mut f64, nrmslx : &mut f64, nrmsux : &mut f64, nrmsnx : &mut f64, nrmbars : &mut f64) -> Result<(),String>
Compute norms of the dual solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)nrmy
(f64
by reference) – The norm of the \(y\) vector. (output)nrmslc
(f64
by reference) – The norm of the \(s_l^c\) vector. (output)nrmsuc
(f64
by reference) – The norm of the \(s_u^c\) vector. (output)nrmslx
(f64
by reference) – The norm of the \(s_l^x\) vector. (output)nrmsux
(f64
by reference) – The norm of the \(s_u^x\) vector. (output)nrmsnx
(f64
by reference) – The norm of the \(s_n^x\) vector. (output)nrmbars
(f64
by reference) – The norm of the \(\barS\) vector. (output)
- Groups
- Task.get_dviol_acc¶
pub fn Task::get_dviol_acc (&self, whichsol : i32, accidxlist : &[i64], viol : &mut[f64]) -> Result<(),String>
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
(i64
[]
) – An array of indexes of conic constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
. (output)
- Groups
- Task.get_dviol_barvar¶
pub fn Task::get_dviol_barvar (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of \(\barX\) variables. (input)viol
(f64
[]
) –viol[k]
is the violation of the solution for the constraint \(\barS_{\mathtt{sub}[k]} \in \PSD\). (output)
- Groups
- Task.get_dviol_con¶
pub fn Task::get_dviol_con (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of dual solution associated with the constraintsub[k]
. (output)
- Groups
- Task.get_dviol_cones Deprecated¶
pub fn Task::get_dviol_cones (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(i32
[]
) – An array of indexes of conic constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of the dual solution associated with the conic constraintsub[k]
. (output)
- Groups
- Task.get_dviol_var¶
pub fn Task::get_dviol_var (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of \(x\) variables. (input)viol
(f64
[]
) –viol[k]
is the violation of dual solution associated with the variablesub[k]
. (output)
- Groups
- Task.get_inf_index¶
pub fn Task::get_inf_index (&self, inftype : i32, infname : &str, infindex : &mut i32) -> Result<(),String>
Obtains the index of a named information item.
- Parameters
inftype
(Inftype
) – Type of the information item. (input)infname
(&str
) – Name of the information item. (input)infindex
(i32
by reference) – The item index. (output)
- Groups
- Task.get_inf_max¶
pub fn Task::get_inf_max (&self, inftype : i32, infmax : &mut[i32]) -> Result<(),String>
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
(i32
[]
) – The maximum index (plus 1) requested. (output)
- Groups
- Task.get_inf_name¶
pub fn Task::get_inf_name (&self, inftype : i32, whichinf : i32) -> Result<String,String>
Obtains the name of an information item.
- Parameters
inftype
(Inftype
) – Type of the information item. (input)whichinf
(i32
) – An information item. (input)
- Return
infname
(String
) – Name of the information item.- Groups
- Task.get_int_inf¶
pub fn Task::get_int_inf (&self, whichiinf : i32) -> Result<i32,String>
Obtains an integer information item from the task information database.
- Parameters
whichiinf
(Iinfitem
) – Specifies an integer information item. (input)- Return
ivalue
(i32
) – The value of the required integer information item.- Groups
- Task.get_int_param¶
pub fn Task::get_int_param (&self, param : i32) -> Result<i32,String>
Obtains the value of an integer parameter.
- Parameters
param
(Iparam
) – Which parameter. (input)- Return
parvalue
(i32
) – Parameter value.- Groups
- Task.get_len_barvar_j¶
pub fn Task::get_len_barvar_j (&self, j : i32) -> Result<i64,String>
Obtains the length of the \(j\)-th semidefinite variable i.e. the number of elements in the lower triangular part.
- Parameters
j
(i32
) – Index of the semidefinite variable whose length if requested. (input)- Return
lenbarvarj
(i64
) – Number of scalar elements in the lower triangular part of the semidefinite variable.- Groups
- Task.get_lint_inf¶
pub fn Task::get_lint_inf (&self, whichliinf : i32) -> Result<i64,String>
Obtains a long integer information item from the task information database.
- Parameters
whichliinf
(Liinfitem
) – Specifies a long information item. (input)- Return
ivalue
(i64
) – The value of the required long integer information item.- Groups
- Task.get_max_name_len¶
pub fn Task::get_max_name_len (&self, maxlen : &mut i32) -> Result<(),String>
Obtains the maximum length (not including terminating zero character) of any objective, constraint, variable, domain or cone name.
- Parameters
maxlen
(i32
by reference) – The maximum length of any name. (output)- Groups
- Task.get_max_num_a_nz¶
pub fn Task::get_max_num_a_nz(&self) -> Result<i64,String>
Obtains number of preallocated non-zeros in \(A\). When this number of non-zeros is reached MOSEK will automatically allocate more space for \(A\).
- Return
maxnumanz
(i64
) – Number of preallocated non-zero linear matrix elements.- Groups
- Task.get_max_num_barvar¶
pub fn Task::get_max_num_barvar(&self) -> Result<i32,String>
Obtains maximum number of symmetric matrix variables for which space is currently preallocated.
- Return
maxnumbarvar
(i32
) – Maximum number of symmetric matrix variables for which space is currently preallocated.- Groups
- Task.get_max_num_con¶
pub fn Task::get_max_num_con (&self, maxnumcon : &mut i32) -> Result<(),String>
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
(i32
by reference) – Number of preallocated constraints in the optimization task. (output)- Groups
Inspecting the task, Problem data - linear part, Problem data - constraints
- Task.get_max_num_cone Deprecated¶
pub fn Task::get_max_num_cone (&self, maxnumcone : &mut i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Obtains the 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
(i32
by reference) – Number of preallocated conic constraints in the optimization task. (output)- Groups
- Task.get_max_num_q_nz¶
pub fn Task::get_max_num_q_nz (&self, maxnumqnz : &mut i64) -> Result<(),String>
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
(i64
by reference) – Number of non-zero elements preallocated in quadratic coefficient matrices. (output)- Groups
- Task.get_max_num_var¶
pub fn Task::get_max_num_var (&self, maxnumvar : &mut i32) -> Result<(),String>
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
(i32
by reference) – Number of preallocated variables in the optimization task. (output)- Groups
Inspecting the task, Problem data - linear part, Problem data - variables
- Task.get_mem_usage¶
pub fn Task::get_mem_usage (&self, meminuse : &mut i64, maxmemuse : &mut i64) -> Result<(),String>
Obtains information about the amount of memory used by a task.
- Parameters
meminuse
(i64
by reference) – Amount of memory currently used by thetask
. (output)maxmemuse
(i64
by reference) – Maximum amount of memory used by thetask
until now. (output)
- Groups
- Task.get_na_dou_inf¶
pub fn Task::get_na_dou_inf (&self, infitemname : &str, dvalue : &mut f64) -> Result<(),String>
Obtains a named double information item from task information database.
- Parameters
infitemname
(&str
) – The name of a double information item. (input)dvalue
(f64
by reference) – The value of the required double information item. (output)
- Groups
- Task.get_na_dou_param¶
pub fn Task::get_na_dou_param (&self, paramname : &str, parvalue : &mut f64) -> Result<(),String>
Obtains the value of a named double parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)parvalue
(f64
by reference) – Parameter value. (output)
- Groups
- Task.get_na_int_inf¶
pub fn Task::get_na_int_inf (&self, infitemname : &str, ivalue : &mut i32) -> Result<(),String>
Obtains a named integer information item from the task information database.
- Parameters
infitemname
(&str
) – The name of an integer information item. (input)ivalue
(i32
by reference) – The value of the required integer information item. (output)
- Groups
- Task.get_na_int_param¶
pub fn Task::get_na_int_param (&self, paramname : &str, parvalue : &mut i32) -> Result<(),String>
Obtains the value of a named integer parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)parvalue
(i32
by reference) – Parameter value. (output)
- Groups
- Task.get_na_str_param¶
pub fn Task::get_na_str_param (&self, paramname : &str, sizeparamname : i32, len : &mut i32) -> Result<String,String>
Obtains the value of a named string parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)sizeparamname
(i32
) – Size of the name bufferparvalue
. (input)len
(i32
by reference) – Length of the string inparvalue
. (output)
- Return
parvalue
(String
) – Parameter value.- Groups
- Task.get_num_a_nz¶
pub fn Task::get_num_a_nz(&self) -> Result<i32,String>
Obtains the number of non-zeros in \(A\).
- Return
numanz
(i32
) – Number of non-zero elements in the linear constraint matrix.- Groups
- Task.get_num_a_nz_64¶
pub fn Task::get_num_a_nz_64(&self) -> Result<i64,String>
Obtains the number of non-zeros in \(A\).
- Return
numanz
(i64
) – Number of non-zero elements in the linear constraint matrix.- Groups
- Task.get_num_acc¶
pub fn Task::get_num_acc(&mut self) -> Result<i64,String>
Obtains the number of affine conic constraints.
- Return
num
(i64
) – The number of affine conic constraints.- Groups
Problem data - affine conic constraints, Inspecting the task
- Task.get_num_afe¶
pub fn Task::get_num_afe(&mut self) -> Result<i64,String>
Obtains the number of affine expressions.
- Return
numafe
(i64
) – Number of affine expressions.- Groups
- Task.get_num_bara_block_triplets¶
pub fn Task::get_num_bara_block_triplets(&self) -> Result<i64,String>
Obtains an upper bound on the number of elements in the block triplet form of \(\barA\).
- Return
num
(i64
) – An upper bound on the number of elements in the block triplet form of \(\barA.\)- Groups
- Task.get_num_bara_nz¶
pub fn Task::get_num_bara_nz(&self) -> Result<i64,String>
Get the number of nonzero elements in \(\barA\).
- Return
nz
(i64
) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero.- Groups
- Task.get_num_barc_block_triplets¶
pub fn Task::get_num_barc_block_triplets(&self) -> Result<i64,String>
Obtains an upper bound on the number of elements in the block triplet form of \(\barC\).
- Return
num
(i64
) – An upper bound on the number of elements in the block triplet form of \(\barC.\)- Groups
- Task.get_num_barc_nz¶
pub fn Task::get_num_barc_nz(&self) -> Result<i64,String>
Obtains the number of nonzero elements in \(\barC\).
- Return
nz
(i64
) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero.- Groups
- Task.get_num_barvar¶
pub fn Task::get_num_barvar(&self) -> Result<i32,String>
Obtains the number of semidefinite variables.
- Return
numbarvar
(i32
) – Number of semidefinite variables in the problem.- Groups
- Task.get_num_con¶
pub fn Task::get_num_con(&self) -> Result<i32,String>
Obtains the number of constraints.
- Return
numcon
(i32
) – Number of constraints.- Groups
Problem data - linear part, Problem data - constraints, Inspecting the task
- Task.get_num_cone Deprecated¶
pub fn Task::get_num_cone(&self) -> Result<i32,String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Return
numcone
(i32
) – Number of conic constraints.- Groups
- Task.get_num_cone_mem Deprecated¶
pub fn Task::get_num_cone_mem (&self, k : i32, nummem : &mut i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
k
(i32
) – Index of the cone. (input)nummem
(i32
by reference) – Number of member variables in the cone. (output)
- Groups
- Task.get_num_djc¶
pub fn Task::get_num_djc(&mut self) -> Result<i64,String>
Obtains the number of disjunctive constraints.
- Return
num
(i64
) – The number of disjunctive constraints.- Groups
- Task.get_num_domain¶
pub fn Task::get_num_domain(&mut self) -> Result<i64,String>
Obtain the number of domains defined.
- Return
numdomain
(i64
) – Number of domains in the task.- Groups
- Task.get_num_int_var¶
pub fn Task::get_num_int_var(&self) -> Result<i32,String>
Obtains the number of integer-constrained variables.
- Return
numintvar
(i32
) – Number of integer variables.- Groups
- Task.get_num_param¶
pub fn Task::get_num_param (&self, partype : i32, numparam : &mut i32) -> Result<(),String>
Obtains the number of parameters of a given type.
- Parameters
partype
(Parametertype
) – Parameter type. (input)numparam
(i32
by reference) – The number of parameters of typepartype
. (output)
- Groups
- Task.get_num_q_con_k_nz¶
pub fn Task::get_num_q_con_k_nz (&self, k : i32) -> Result<i64,String>
Obtains the number of non-zero quadratic terms in a constraint.
- Parameters
k
(i32
) – Index of the constraint for which the number quadratic terms should be obtained. (input)- Return
numqcnz
(i64
) – Number of quadratic terms.- Groups
Inspecting the task, Problem data - constraints, Problem data - quadratic part
- Task.get_num_q_obj_nz¶
pub fn Task::get_num_q_obj_nz(&self) -> Result<i64,String>
Obtains the number of non-zero quadratic terms in the objective.
- Return
numqonz
(i64
) – Number of non-zero elements in the quadratic objective terms.- Groups
- Task.get_num_sym_mat¶
pub fn Task::get_num_sym_mat (&self, num : &mut i64) -> Result<(),String>
Obtains the number of symmetric matrices stored in the vector \(E\).
- Parameters
num
(i64
by reference) – The number of symmetric sparse matrices. (output)- Groups
- Task.get_num_var¶
pub fn Task::get_num_var(&self) -> Result<i32,String>
Obtains the number of variables.
- Return
numvar
(i32
) – Number of variables.- Groups
- Task.get_obj_name¶
pub fn Task::get_obj_name(&self) -> Result<String,String>
Obtains the name assigned to the objective function.
- Return
objname
(String
) – Assigned the objective name.- Groups
- Task.get_obj_name_len¶
pub fn Task::get_obj_name_len(&self) -> Result<i32,String>
Obtains the length of the name assigned to the objective function.
- Return
len
(i32
) – Assigned the length of the objective name.- Groups
- Task.get_obj_sense¶
pub fn Task::get_obj_sense(&self) -> Result<i32,String>
Gets the objective sense of the task.
- Return
sense
(Objsense
) – The returned objective sense.- Groups
- Task.get_param_max¶
pub fn Task::get_param_max (&self, partype : i32, parammax : &mut i32) -> Result<(),String>
Obtains the maximum index of a parameter of type
partype
plus 1.- Parameters
partype
(Parametertype
) – Parameter type. (input)parammax
(i32
by reference) – The maximum index (plus 1) of the given parameter type. (output)
- Groups
- Task.get_param_name¶
pub fn Task::get_param_name (&self, partype : i32, param : i32) -> Result<String,String>
Obtains the name for a parameter
param
of typepartype
.- Parameters
partype
(Parametertype
) – Parameter type. (input)param
(i32
) – Which parameter. (input)
- Return
parname
(String
) – Parameter name.- Groups
- Task.get_power_domain_alpha¶
pub fn Task::get_power_domain_alpha (&mut self, domidx : i64, alpha : &mut[f64]) -> Result<(),String>
Obtains the exponent vector \(\alpha\) of a primal or dual power cone domain.
- Parameters
domidx
(i64
) – Index of the domain. (input)alpha
(f64
[]
) – The vector \(\alpha\). (output)
- Groups
- Task.get_power_domain_info¶
pub fn Task::get_power_domain_info (&mut self, domidx : i64, n : &mut i64, nleft : &mut i64) -> Result<(),String>
Obtains structural information about a primal or dual power cone domain.
- Parameters
domidx
(i64
) – Index of the domain. (input)n
(i64
by reference) – Dimension of the domain. (output)nleft
(i64
by reference) – Number of variables on the left hand side. (output)
- Groups
- Task.get_primal_obj¶
pub fn Task::get_primal_obj (&self, whichsol : i32) -> Result<f64,String>
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)- Return
primalobj
(f64
) – Objective value corresponding to the primal solution.- Groups
- Task.get_primal_solution_norms¶
pub fn Task::get_primal_solution_norms (&self, whichsol : i32, nrmxc : &mut f64, nrmxx : &mut f64, nrmbarx : &mut f64) -> Result<(),String>
Compute norms of the primal solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)nrmxc
(f64
by reference) – The norm of the \(x^c\) vector. (output)nrmxx
(f64
by reference) – The norm of the \(x\) vector. (output)nrmbarx
(f64
by reference) – The norm of the \(\barX\) vector. (output)
- Groups
- Task.get_pro_sta¶
pub fn Task::get_pro_sta (&self, whichsol : i32) -> Result<i32,String>
Obtains the problem status.
- Task.get_prob_type¶
pub fn Task::get_prob_type(&self) -> Result<i32,String>
Obtains the problem type.
- Return
probtype
(Problemtype
) – The problem type.- Groups
- Task.get_pviol_acc¶
pub fn Task::get_pviol_acc (&self, whichsol : i32, accidxlist : &[i64], viol : &mut[f64]) -> Result<(),String>
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
(i64
[]
) – An array of indexes of conic constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of the solution associated with the affine conic constraint numberaccidxlist[k]
. (output)
- Groups
- Task.get_pviol_barvar¶
pub fn Task::get_pviol_barvar (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of \(\barX\) variables. (input)viol
(f64
[]
) –viol[k]
is how much the solution violates the constraint \(\barX_{\mathtt{sub}[k]} \in \PSD\). (output)
- Groups
- Task.get_pviol_con¶
pub fn Task::get_pviol_con (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of constraints. (input)viol
(f64
[]
) –viol[k]
is the violation associated with the solution for the constraintsub[k]
. (output)
- Groups
- Task.get_pviol_cones Deprecated¶
pub fn Task::get_pviol_cones (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(i32
[]
) – An array of indexes of conic constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of the solution associated with the conic constraint numbersub[k]
. (output)
- Groups
- Task.get_pviol_djc¶
pub fn Task::get_pviol_djc (&self, whichsol : i32, djcidxlist : &[i64], viol : &mut[f64]) -> Result<(),String>
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
(i64
[]
) – An array of indexes of disjunctive constraints. (input)viol
(f64
[]
) –viol[k]
is the violation of the solution associated with the disjunctive constraint numberdjcidxlist[k]
. (output)
- Groups
- Task.get_pviol_var¶
pub fn Task::get_pviol_var (&self, whichsol : i32, sub : &[i32], viol : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – An array of indexes of \(x\) variables. (input)viol
(f64
[]
) –viol[k]
is the violation associated with the solution for the variable \(x_\mathtt{sub[k]}\). (output)
- Groups
- Task.get_q_con_k¶
pub fn Task::get_q_con_k (&self, k : i32, qcsubi : &mut[i32], qcsubj : &mut[i32], qcval : &mut[f64]) -> Result<i64,String>
Obtains all the quadratic terms in a constraint. The quadratic terms are stored sequentially in
qcsubi
,qcsubj
, andqcval
.- Parameters
k
(i32
) – Which constraint. (input)qcsubi
(i32
[]
) – Row subscripts for quadratic constraint matrix. (output)qcsubj
(i32
[]
) – Column subscripts for quadratic constraint matrix. (output)qcval
(f64
[]
) – Quadratic constraint coefficient values. (output)
- Return
numqcnz
(i64
) – Number of quadratic terms.- Groups
Inspecting the task, Problem data - quadratic part, Problem data - constraints
- Task.get_q_obj¶
pub fn Task::get_q_obj (&self, numqonz : &mut i64, qosubi : &mut[i32], qosubj : &mut[i32], qoval : &mut[f64]) -> Result<(),String>
Obtains the quadratic terms in the objective. The required quadratic terms are stored sequentially in
qosubi
,qosubj
, andqoval
.- Parameters
numqonz
(i64
by reference) – Number of non-zero elements in the quadratic objective terms. (output)qosubi
(i32
[]
) – Row subscripts for quadratic objective coefficients. (output)qosubj
(i32
[]
) – Column subscripts for quadratic objective coefficients. (output)qoval
(f64
[]
) – Quadratic objective coefficient values. (output)
- Groups
- Task.get_q_obj_i_j¶
pub fn Task::get_q_obj_i_j (&self, i : i32, j : i32, qoij : &mut f64) -> Result<(),String>
Obtains one coefficient \(q_{ij}^o\) in the quadratic term of the objective.
- Parameters
i
(i32
) – Row index of the coefficient. (input)j
(i32
) – Column index of coefficient. (input)qoij
(f64
by reference) – The required coefficient. (output)
- Groups
- Task.get_reduced_costs¶
pub fn Task::get_reduced_costs (&self, whichsol : i32, first : i32, last : i32, redcosts : &mut[f64]) -> Result<(),String>
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
(i32
) – The index of the first variable in the sequence. (input)last
(i32
) – The index of the last variable in the sequence plus 1. (input)redcosts
(f64
[]
) – The reduced costs for the required slice of variables. (output)
- Groups
- Task.get_skc¶
pub fn Task::get_skc (&self, whichsol : i32, skc : &mut[i32]) -> Result<(),String>
Obtains the status keys for the constraints.
- Parameters
- Groups
- Task.get_skc_slice¶
pub fn Task::get_skc_slice (&self, whichsol : i32, first : i32, last : i32, skc : &mut[i32]) -> Result<(),String>
Obtains the status keys for a slice of the constraints.
- Parameters
- Groups
- Task.get_skn¶
pub fn Task::get_skn (&self, whichsol : i32, skn : &mut[i32]) -> Result<(),String>
Obtains the status keys for the conic constraints.
- Parameters
- Groups
- Task.get_skx¶
pub fn Task::get_skx (&self, whichsol : i32, skx : &mut[i32]) -> Result<(),String>
Obtains the status keys for the scalar variables.
- Parameters
- Groups
- Task.get_skx_slice¶
pub fn Task::get_skx_slice (&self, whichsol : i32, first : i32, last : i32, skx : &mut[i32]) -> Result<(),String>
Obtains the status keys for a slice of the scalar variables.
- Parameters
- Groups
- Task.get_slc¶
pub fn Task::get_slc (&self, whichsol : i32, slc : &mut[f64]) -> Result<(),String>
Obtains the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)
- Groups
- Task.get_slc_slice¶
pub fn Task::get_slc_slice (&self, whichsol : i32, first : i32, last : i32, slc : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)
- Groups
- Task.get_slx¶
pub fn Task::get_slx (&self, whichsol : i32, slx : &mut[f64]) -> Result<(),String>
Obtains the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)
- Groups
- Task.get_slx_slice¶
pub fn Task::get_slx_slice (&self, whichsol : i32, first : i32, last : i32, slx : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)
- Groups
- Task.get_snx¶
pub fn Task::get_snx (&self, whichsol : i32, snx : &mut[f64]) -> Result<(),String>
Obtains the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Groups
- Task.get_snx_slice¶
pub fn Task::get_snx_slice (&self, whichsol : i32, first : i32, last : i32, snx : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Groups
- Task.get_sol_sta¶
pub fn Task::get_sol_sta (&self, whichsol : i32) -> Result<i32,String>
Obtains the solution status.
- Task.get_solution¶
pub fn Task::get_solution (&self, whichsol : i32, problemsta : & mut i32, solutionsta : & mut i32, skc : &mut[i32], skx : &mut[i32], skn : &mut[i32], xc : &mut[f64], xx : &mut[f64], y : &mut[f64], slc : &mut[f64], suc : &mut[f64], slx : &mut[f64], sux : &mut[f64], snx : &mut[f64]) -> Result<(),String>
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.get_barx_j
andTask.get_bars_j
.- Parameters
whichsol
(Soltype
) – Selects a solution. (input)problemsta
(Prosta
by reference) – Problem status. (output)solutionsta
(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
(f64
[]
) – Primal constraint solution. (output)xx
(f64
[]
) – Primal variable solution. (output)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (output)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)
- Groups
- Task.get_solution_info¶
pub fn Task::get_solution_info (&self, whichsol : i32, pobj : &mut f64, pviolcon : &mut f64, pviolvar : &mut f64, pviolbarvar : &mut f64, pviolcone : &mut f64, pviolitg : &mut f64, dobj : &mut f64, dviolcon : &mut f64, dviolvar : &mut f64, dviolbarvar : &mut f64, dviolcone : &mut f64) -> Result<(),String>
Obtains information about a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)pobj
(f64
by reference) – The primal objective value as computed byTask.get_primal_obj
. (output)pviolcon
(f64
by reference) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed byTask.get_pviol_con
. (output)pviolvar
(f64
by reference) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed byTask.get_pviol_var
. (output)pviolbarvar
(f64
by reference) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed byTask.get_pviol_barvar
. (output)pviolcone
(f64
by reference) – Maximal primal violation of solution for the conic constraints where the violations are computed byTask.get_pviol_cones
. (output)pviolitg
(f64
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
(f64
by reference) – Dual objective value as computed byTask.get_dual_obj
. (output)dviolcon
(f64
by reference) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed byTask.get_dviol_con
. (output)dviolvar
(f64
by reference) – Maximal violation of the dual solution associated with the \(x\) variable as computed byTask.get_dviol_var
. (output)dviolbarvar
(f64
by reference) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed byTask.get_dviol_barvar
. (output)dviolcone
(f64
by reference) – Maximal violation of the dual solution associated with the dual conic constraints as computed byTask.get_dviol_cones
. (output)
- Groups
- Task.get_solution_info_new¶
pub fn Task::get_solution_info_new (&self, whichsol : i32, pobj : &mut f64, pviolcon : &mut f64, pviolvar : &mut f64, pviolbarvar : &mut f64, pviolcone : &mut f64, pviolacc : &mut f64, pvioldjc : &mut f64, pviolitg : &mut f64, dobj : &mut f64, dviolcon : &mut f64, dviolvar : &mut f64, dviolbarvar : &mut f64, dviolcone : &mut f64, dviolacc : &mut f64) -> Result<(),String>
Obtains information about a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)pobj
(f64
by reference) – The primal objective value as computed byTask.get_primal_obj
. (output)pviolcon
(f64
by reference) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed byTask.get_pviol_con
. (output)pviolvar
(f64
by reference) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed byTask.get_pviol_var
. (output)pviolbarvar
(f64
by reference) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed byTask.get_pviol_barvar
. (output)pviolcone
(f64
by reference) – Maximal primal violation of solution for the conic constraints where the violations are computed byTask.get_pviol_cones
. (output)pviolacc
(f64
by reference) – Maximal primal violation of solution for the affine conic constraints where the violations are computed byTask.get_pviol_acc
. (output)pvioldjc
(f64
by reference) – Maximal primal violation of solution for the disjunctive constraints where the violations are computed byTask.get_pviol_djc
. (output)pviolitg
(f64
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
(f64
by reference) – Dual objective value as computed byTask.get_dual_obj
. (output)dviolcon
(f64
by reference) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed byTask.get_dviol_con
. (output)dviolvar
(f64
by reference) – Maximal violation of the dual solution associated with the \(x\) variable as computed byTask.get_dviol_var
. (output)dviolbarvar
(f64
by reference) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed byTask.get_dviol_barvar
. (output)dviolcone
(f64
by reference) – Maximal violation of the dual solution associated with the dual conic constraints as computed byTask.get_dviol_cones
. (output)dviolacc
(f64
by reference) – Maximal violation of the dual solution associated with the affine conic constraints as computed byTask.get_dviol_acc
. (output)
- Groups
- Task.get_solution_new¶
pub fn Task::get_solution_new (&self, whichsol : i32, problemsta : & mut i32, solutionsta : & mut i32, skc : &mut[i32], skx : &mut[i32], skn : &mut[i32], xc : &mut[f64], xx : &mut[f64], y : &mut[f64], slc : &mut[f64], suc : &mut[f64], slx : &mut[f64], sux : &mut[f64], snx : &mut[f64], doty : &mut[f64]) -> Result<(),String>
Obtains the complete solution. See
Task.get_solution
for further information.In order to retrieve the primal and dual values of semidefinite variables see
Task.get_barx_j
andTask.get_bars_j
.- Parameters
whichsol
(Soltype
) – Selects a solution. (input)problemsta
(Prosta
by reference) – Problem status. (output)solutionsta
(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
(f64
[]
) – Primal constraint solution. (output)xx
(f64
[]
) – Primal variable solution. (output)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (output)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (output)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (output)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (output)doty
(f64
[]
) – Dual variables corresponding to affine conic constraints. (output)
- Groups
- Task.get_solution_slice¶
pub fn Task::get_solution_slice (&self, whichsol : i32, solitem : i32, first : i32, last : i32, values : &mut[f64]) -> Result<(),String>
Obtains a slice of one item from the solution. The format of the solution is exactly as in
Task.get_solution
. 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
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)values
(f64
[]
) – The values in the required sequence are stored sequentially invalues
. (output)
- Groups
- Task.get_sparse_sym_mat¶
pub fn Task::get_sparse_sym_mat (&self, idx : i64, subi : &mut[i32], subj : &mut[i32], valij : &mut[f64]) -> Result<(),String>
Get a single symmetric matrix from the matrix store.
- Parameters
idx
(i64
) – Index of the matrix to retrieve. (input)subi
(i32
[]
) – Row subscripts of the matrix non-zero elements. (output)subj
(i32
[]
) – Column subscripts of the matrix non-zero elements. (output)valij
(f64
[]
) – Coefficients of the matrix non-zero elements. (output)
- Groups
- Task.get_str_param¶
pub fn Task::get_str_param (&self, param : i32, len : &mut i32) -> Result<String,String>
Obtains the value of a string parameter.
- Parameters
param
(Sparam
) – Which parameter. (input)len
(i32
by reference) – The length of the parameter value. (output)
- Return
parvalue
(String
) – Parameter value.- Groups
- Task.get_str_param_len¶
pub fn Task::get_str_param_len (&self, param : i32) -> Result<i32,String>
Obtains the length of a string parameter.
- Parameters
param
(Sparam
) – Which parameter. (input)- Return
len
(i32
) – The length of the parameter value.- Groups
- Task.get_suc¶
pub fn Task::get_suc (&self, whichsol : i32, suc : &mut[f64]) -> Result<(),String>
Obtains the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)
- Groups
- Task.get_suc_slice¶
pub fn Task::get_suc_slice (&self, whichsol : i32, first : i32, last : i32, suc : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (output)
- Groups
- Task.get_sux¶
pub fn Task::get_sux (&self, whichsol : i32, sux : &mut[f64]) -> Result<(),String>
Obtains the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)
- Groups
- Task.get_sux_slice¶
pub fn Task::get_sux_slice (&self, whichsol : i32, first : i32, last : i32, sux : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (output)
- Groups
- Task.get_sym_mat_info¶
pub fn Task::get_sym_mat_info (&self, idx : i64, dim : &mut i32, nz : &mut i64, mattype : & mut i32) -> Result<(),String>
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
(i64
) – Index of the matrix for which information is requested. (input)dim
(i32
by reference) – Returns the dimension of the requested matrix. (output)nz
(i64
by reference) – Returns the number of non-zeros in the requested matrix. (output)mattype
(Symmattype
by reference) – Returns the type of the requested matrix. (output)
- Groups
- Task.get_symb_con¶
pub fn Task::get_symb_con (&self, i : i32, value : &mut i32) -> Result<String,String>
Obtains the name and corresponding value for the \(i\)th symbolic constant.
- Parameters
i
(i32
) – Index. (input)value
(i32
by reference) – The corresponding value. (output)
- Return
name
(String
) – Name of the \(i\)th symbolic constant.- Groups
- Task.get_task_name¶
pub fn Task::get_task_name(&self) -> Result<String,String>
Obtains the name assigned to the task.
- Return
taskname
(String
) – Returns the task name.- Groups
- Task.get_task_name_len¶
pub fn Task::get_task_name_len(&self) -> Result<i32,String>
Obtains the length the task name.
- Return
len
(i32
) – Returns the length of the task name.- Groups
- Task.get_var_bound¶
pub fn Task::get_var_bound (&self, i : i32, bk : & mut i32, bl : &mut f64, bu : &mut f64) -> Result<(),String>
Obtains bound information for one variable.
- Parameters
i
(i32
) – Index of the variable for which the bound information should be obtained. (input)bk
(Boundkey
by reference) – Bound keys. (output)bl
(f64
by reference) – Values for lower bounds. (output)bu
(f64
by reference) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- Task.get_var_bound_slice¶
pub fn Task::get_var_bound_slice (&self, first : i32, last : i32, bk : &mut[i32], bl : &mut[f64], bu : &mut[f64]) -> Result<(),String>
Obtains bounds information for a slice of the variables.
- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bk
(Boundkey
[]
) – Bound keys. (output)bl
(f64
[]
) – Values for lower bounds. (output)bu
(f64
[]
) – Values for upper bounds. (output)
- Groups
Problem data - linear part, Inspecting the task, Problem data - bounds, Problem data - variables
- Task.get_var_name¶
pub fn Task::get_var_name (&self, j : i32) -> Result<String,String>
Obtains the name of a variable.
- Parameters
j
(i32
) – Index of a variable. (input)- Return
name
(String
) – Returns the required name.- Groups
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- Task.get_var_name_index¶
pub fn Task::get_var_name_index (&self, somename : &str, asgn : &mut i32) -> Result<i32,String>
Checks whether the name
somename
has been assigned to any variable. If so, the index of the variable is reported.- Parameters
somename
(&str
) – The name which should be checked. (input)asgn
(i32
by reference) – Is non-zero if the namesomename
is assigned to a variable. (output)
- Return
index
(i32
) – 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.get_var_name_len¶
pub fn Task::get_var_name_len (&self, i : i32) -> Result<i32,String>
Obtains the length of the name of a variable.
- Parameters
i
(i32
) – Index of a variable. (input)- Return
len
(i32
) – Returns the length of the indicated name.- Groups
Names, Problem data - linear part, Problem data - variables, Inspecting the task
- Task.get_var_type¶
pub fn Task::get_var_type (&self, j : i32) -> Result<i32,String>
Gets the variable type of one variable.
- Parameters
j
(i32
) – Index of the variable. (input)- Return
vartype
(Variabletype
) – Variable type of the \(j\)-th variable.- Groups
- Task.get_var_type_list¶
pub fn Task::get_var_type_list (&self, subj : &[i32], vartype : &mut[i32]) -> Result<(),String>
Obtains the variable type of one or more variables. Upon return
vartype[k]
is the variable type of variablesubj[k]
.- Parameters
subj
(i32
[]
) – A list of variable indexes. (input)vartype
(Variabletype
[]
) – The variables types corresponding to the variables specified bysubj
. (output)
- Groups
- Task.get_xc¶
pub fn Task::get_xc (&self, whichsol : i32, xc : &mut[f64]) -> Result<(),String>
Obtains the \(x^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)xc
(f64
[]
) – Primal constraint solution. (output)
- Groups
- Task.get_xc_slice¶
pub fn Task::get_xc_slice (&self, whichsol : i32, first : i32, last : i32, xc : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(x^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)xc
(f64
[]
) – Primal constraint solution. (output)
- Groups
- Task.get_xx¶
pub fn Task::get_xx (&self, whichsol : i32, xx : &mut[f64]) -> Result<(),String>
Obtains the \(x^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)xx
(f64
[]
) – Primal variable solution. (output)
- Groups
- Task.get_xx_slice¶
pub fn Task::get_xx_slice (&self, whichsol : i32, first : i32, last : i32, xx : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(x^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)xx
(f64
[]
) – Primal variable solution. (output)
- Groups
- Task.get_y¶
pub fn Task::get_y (&self, whichsol : i32, y : &mut[f64]) -> Result<(),String>
Obtains the \(y\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (output)
- Groups
- Task.get_y_slice¶
pub fn Task::get_y_slice (&self, whichsol : i32, first : i32, last : i32, y : &mut[f64]) -> Result<(),String>
Obtains a slice of the \(y\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (output)
- Groups
- Task.infeasibility_report¶
pub fn Task::infeasibility_report (&mut self, whichstream : i32, whichsol : i32) -> Result<(),String>
Prints the infeasibility report to an output stream.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)whichsol
(Soltype
) – Selects a solution. (input)
- Groups
- Task.init_basis_solve¶
pub fn Task::init_basis_solve (&mut self, basis : &mut[i32]) -> Result<(),String>
Prepare a task for use with the
Task.solve_with_basis
function.This function should be called
immediately before the first call to
Task.solve_with_basis
, andimmediately before any subsequent call to
Task.solve_with_basis
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
(i32
[]
) – 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.input_data¶
pub fn Task::input_data (&mut self, maxnumcon : i32, maxnumvar : i32, c : &[f64], cfix : f64, aptrb : &[i64], aptre : &[i64], asub : &[i32], aval : &[f64], bkc : &[i32], blc : &[f64], buc : &[f64], bkx : &[i32], blx : &[f64], bux : &[f64]) -> Result<(),String>
Input the linear part of an optimization problem.
The non-zeros of \(A\) are inputted column-wise in the format described in Section Column or Row Ordered Sparse Matrix.
For an explained code example see Section Linear Optimization and Section Matrix Formats.
- Parameters
maxnumcon
(i32
) – Number of preallocated constraints in the optimization task. (input)maxnumvar
(i32
) – Number of preallocated variables in the optimization task. (input)c
(f64
[]
) – Linear terms of the objective as a dense vector. The length is the number of variables. (input)cfix
(f64
) – Fixed term in the objective. (input)aptrb
(i64
[]
) – Row or column start pointers. (input)aptre
(i64
[]
) – Row or column end pointers. (input)asub
(i32
[]
) – Coefficient subscripts. (input)aval
(f64
[]
) – Coefficient values. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(f64
[]
) – Lower bounds for the constraints. (input)buc
(f64
[]
) – Upper bounds for the constraints. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(f64
[]
) – Lower bounds for the variables. (input)bux
(f64
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - bounds, Problem data - constraints
- Task.is_dou_par_name¶
pub fn Task::is_dou_par_name (&self, parname : &str, param : & mut i32) -> Result<(),String>
Checks whether
parname
is a valid double parameter name.- Parameters
parname
(&str
) – Parameter name. (input)param
(Dparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.is_int_par_name¶
pub fn Task::is_int_par_name (&self, parname : &str, param : & mut i32) -> Result<(),String>
Checks whether
parname
is a valid integer parameter name.- Parameters
parname
(&str
) – Parameter name. (input)param
(Iparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.is_str_par_name¶
pub fn Task::is_str_par_name (&self, parname : &str, param : & mut i32) -> Result<(),String>
Checks whether
parname
is a valid string parameter name.- Parameters
parname
(&str
) – Parameter name. (input)param
(Sparam
by reference) – Returns the parameter corresponding to the name, if one exists. (output)
- Groups
- Task.link_file_to_stream¶
pub fn Task::link_file_to_stream (&mut self, whichstream : i32, filename : &str, append : i32) -> Result<(),String>
Directs all output from a task stream
whichstream
to a filefilename
.- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)filename
(&str
) – A valid file name. (input)append
(i32
) – If this argument is 0 the output file will be overwritten, otherwise it will be appended to. (input)
- Groups
- Task.one_solution_summary¶
pub fn Task::one_solution_summary (&self, whichstream : i32, whichsol : i32) -> Result<(),String>
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¶
pub fn Task::optimize(&mut self) -> Result<i32,String>
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
.- Return
trmcode
(Rescode
) – Is eitherRescode::OK
or a termination response code.- Groups
- Task.optimize_rmt¶
pub fn Task::optimize_rmt (&mut self, address : &str, accesstoken : &str, trmcode : & mut i32) -> Result<(),String>
Offload the optimization task to an instance of OptServer specified by
addr
, which should be a valid URL, for examplehttp://server:port
orhttps://server:port
. The call will 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
(&str
) – Address of the OptServer. (input)accesstoken
(&str
) – Access token. (input)trmcode
(Rescode
by reference) – Is eitherRescode::OK
or a termination response code. (output)
- Groups
- Task.optimizer_summary¶
pub fn Task::optimizer_summary (&self, whichstream : i32) -> Result<(),String>
Prints a short summary with optimizer statistics from last optimization.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)- Groups
- Task.primal_repair¶
pub fn Task::primal_repair (&mut self, wlc : &[f64], wuc : &[f64], wlx : &[f64], wux : &[f64]) -> Result<(),String>
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
(f64
[]
) – \((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 isNone
, then all the weights are assumed to be \(1\). (input)wuc
(f64
[]
) – \((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 isNone
, then all the weights are assumed to be \(1\). (input)wlx
(f64
[]
) – \((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 isNone
, then all the weights are assumed to be \(1\). (input)wux
(f64
[]
) – \((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 isNone
, then all the weights are assumed to be \(1\). (input)
- Groups
- Task.primal_sensitivity¶
pub fn Task::primal_sensitivity (&mut self, subi : &[i32], marki : &[i32], subj : &[i32], markj : &[i32], leftpricei : &mut[f64], rightpricei : &mut[f64], leftrangei : &mut[f64], rightrangei : &mut[f64], leftpricej : &mut[f64], rightpricej : &mut[f64], leftrangej : &mut[f64], rightrangej : &mut[f64]) -> Result<(),String>
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
(i32
[]
) – 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
(i32
[]
) – 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
(f64
[]
) –leftpricei[i]
is the left shadow price for the boundmarki[i]
of constraintsubi[i]
. (output)rightpricei
(f64
[]
) –rightpricei[i]
is the right shadow price for the boundmarki[i]
of constraintsubi[i]
. (output)leftrangei
(f64
[]
) –leftrangei[i]
is the left range \(\beta_1\) for the boundmarki[i]
of constraintsubi[i]
. (output)rightrangei
(f64
[]
) –rightrangei[i]
is the right range \(\beta_2\) for the boundmarki[i]
of constraintsubi[i]
. (output)leftpricej
(f64
[]
) –leftpricej[j]
is the left shadow price for the boundmarkj[j]
of variablesubj[j]
. (output)rightpricej
(f64
[]
) –rightpricej[j]
is the right shadow price for the boundmarkj[j]
of variablesubj[j]
. (output)leftrangej
(f64
[]
) –leftrangej[j]
is the left range \(\beta_1\) for the boundmarkj[j]
of variablesubj[j]
. (output)rightrangej
(f64
[]
) –rightrangej[j]
is the right range \(\beta_2\) for the boundmarkj[j]
of variablesubj[j]
. (output)
- Groups
- Task.print_param¶
pub fn Task::print_param(&self) -> Result<(),String>
Prints the current parameter settings to the message stream.
- Groups
- Task.put_a_col¶
pub fn Task::put_a_col (&mut self, j : i32, subj : &[i32], valj : &[f64]) -> Result<(),String>
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
(i32
) – Index of a column in \(A\). (input)subj
(i32
[]
) – Row indexes of non-zero values in column \(j\) of \(A\). (input)valj
(f64
[]
) – New non-zero values of column \(j\) in \(A\). (input)
- Groups
- Task.put_a_col_list¶
pub fn Task::put_a_col_list (&mut self, sub : &[i32], ptrb : &[i64], ptre : &[i64], asub : &[i32], aval : &[f64]) -> Result<(),String>
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
(i32
[]
) – Indexes of columns that should be replaced, no duplicates. (input)ptrb
(i64
[]
) – Array of pointers to the first element in each column. (input)ptre
(i64
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(i32
[]
) – Row indexes of new elements. (input)aval
(f64
[]
) – Coefficient values. (input)
- Groups
- Task.put_a_col_slice¶
pub fn Task::put_a_col_slice (&mut self, first : i32, last : i32, ptrb : &[i64], ptre : &[i64], asub : &[i32], aval : &[f64]) -> Result<(),String>
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
(i32
) – First column in the slice. (input)last
(i32
) – Last column plus one in the slice. (input)ptrb
(i64
[]
) – Array of pointers to the first element in each column. (input)ptre
(i64
[]
) – Array of pointers to the last element plus one in each column. (input)asub
(i32
[]
) – Row indexes of new elements. (input)aval
(f64
[]
) – Coefficient values. (input)
- Groups
- Task.put_a_row¶
pub fn Task::put_a_row (&mut self, i : i32, subi : &[i32], vali : &[f64]) -> Result<(),String>
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
(i32
) – Index of a row in \(A\). (input)subi
(i32
[]
) – Column indexes of non-zero values in row \(i\) of \(A\). (input)vali
(f64
[]
) – New non-zero values of row \(i\) in \(A\). (input)
- Groups
- Task.put_a_row_list¶
pub fn Task::put_a_row_list (&mut self, sub : &[i32], ptrb : &[i64], ptre : &[i64], asub : &[i32], aval : &[f64]) -> Result<(),String>
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
(i32
[]
) – Indexes of rows that should be replaced, no duplicates. (input)ptrb
(i64
[]
) – Array of pointers to the first element in each row. (input)ptre
(i64
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(i32
[]
) – Column indexes of new elements. (input)aval
(f64
[]
) – Coefficient values. (input)
- Groups
- Task.put_a_row_slice¶
pub fn Task::put_a_row_slice (&mut self, first : i32, last : i32, ptrb : &[i64], ptre : &[i64], asub : &[i32], aval : &[f64]) -> Result<(),String>
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
(i32
) – First row in the slice. (input)last
(i32
) – Last row plus one in the slice. (input)ptrb
(i64
[]
) – Array of pointers to the first element in each row. (input)ptre
(i64
[]
) – Array of pointers to the last element plus one in each row. (input)asub
(i32
[]
) – Column indexes of new elements. (input)aval
(f64
[]
) – Coefficient values. (input)
- Groups
- Task.put_a_truncate_tol¶
pub fn Task::put_a_truncate_tol (&mut self, tolzero : f64) -> Result<(),String>
Truncates (sets to zero) all elements in \(A\) that satisfy
\[|a_{i,j}| \leq \mathtt{tolzero}.\]- Parameters
tolzero
(f64
) – Truncation tolerance. (input)- Groups
- Task.put_acc¶
pub fn Task::put_acc (&mut self, accidx : i64, domidx : i64, afeidxlist : &[i64], b : &[f64]) -> Result<(),String>
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.append_acc
.- Parameters
accidx
(i64
) – Affine conic constraint index. (input)domidx
(i64
) – Domain index. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.put_acc_b¶
pub fn Task::put_acc_b (&mut self, accidx : i64, b : &[f64]) -> Result<(),String>
Updates an existing affine conic constraint number
accidx
by putting a new vector \(b\).- Parameters
accidx
(i64
) – Affine conic constraint index. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.put_acc_b_j¶
pub fn Task::put_acc_b_j (&mut self, accidx : i64, j : i64, bj : f64) -> Result<(),String>
Sets one value \(b[j]\) in the \(b\) vector for the affine conic constraint number
accidx
.- Parameters
accidx
(i64
) – Affine conic constraint index. (input)j
(i64
) – The index of an element in b to change. (input)bj
(f64
) – The new value of \(b[j]\). (input)
- Groups
- Task.put_acc_dot_y¶
pub fn Task::put_acc_dot_y (&self, whichsol : i32, accidx : i64, doty : &mut[f64]) -> Result<(),String>
Puts the \(\dot{y}\) vector for a solution (the dual values of an affine conic constraint).
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)accidx
(i64
) – The index of the affine conic constraint. (input)doty
(f64
[]
) – The dual values for this affine conic constraint. The array should have length equal to the dimension of the constraint. (output)
- Groups
- Task.put_acc_list¶
pub fn Task::put_acc_list (&mut self, accidxs : &[i64], domidxs : &[i64], afeidxlist : &[i64], b : &[f64]) -> Result<(),String>
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.append_acc
(see alsoTask.append_accs
).- Parameters
accidxs
(i64
[]
) – Affine conic constraint indices. (input)domidxs
(i64
[]
) – Domain indices. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)
- Groups
- Task.put_acc_name¶
pub fn Task::put_acc_name (&mut self, accidx : i64, name : &str) -> Result<(),String>
Sets the name of an affine conic constraint.
- Parameters
accidx
(i64
) – Index of the affine conic constraint. (input)name
(&str
) – The name of the affine conic constraint. (input)
- Groups
- Task.put_afe_barf_block_triplet¶
pub fn Task::put_afe_barf_block_triplet (&mut self, afeidx : &[i64], barvaridx : &[i32], subk : &[i32], subl : &[i32], valkl : &[f64]) -> Result<(),String>
Inputs the \(\barF\) matrix data in block triplet form.
- Parameters
afeidx
(i64
[]
) – Constraint index. (input)barvaridx
(i32
[]
) – Symmetric matrix variable index. (input)subk
(i32
[]
) – Block row index. (input)subl
(i32
[]
) – Block column index. (input)valkl
(f64
[]
) – The numerical value associated with each block triplet. (input)
- Groups
Problem data - affine expressions, Problem data - semidefinite
- Task.put_afe_barf_entry¶
pub fn Task::put_afe_barf_entry (&mut self, afeidx : i64, barvaridx : i32, termidx : &[i64], termweight : &[f64]) -> Result<(),String>
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.append_sparse_sym_mat
.- Parameters
afeidx
(i64
) – Row index of \(\barF\). (input)barvaridx
(i32
) – Semidefinite variable index. (input)termidx
(i64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for the \(\barF\) entry being specified. (input)termweight
(f64
[]
) –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.put_afe_barf_entry_list¶
pub fn Task::put_afe_barf_entry_list (&mut self, afeidx : &[i64], barvaridx : &[i32], numterm : &[i64], ptrterm : &[i64], termidx : &[i64], termweight : &[f64]) -> Result<(),String>
This function sets a list of entries in \(\barF\). Each entry should be described as in
Task.put_afe_barf_entry
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.put_afe_barf_entry
for details.- Parameters
afeidx
(i64
[]
) – Row indexes of \(\barF\). (input)barvaridx
(i32
[]
) – Semidefinite variable indexes. (input)numterm
(i64
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(i64
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(i64
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) being specified. (input)termweight
(f64
[]
) – 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.put_afe_barf_row¶
pub fn Task::put_afe_barf_row (&mut self, afeidx : i64, barvaridx : &[i32], numterm : &[i64], ptrterm : &[i64], termidx : &[i64], termweight : &[f64]) -> Result<(),String>
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.put_afe_barf_entry
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.put_afe_barf_entry
for details.- Parameters
afeidx
(i64
) – Row index of \(\barF\). (input)barvaridx
(i32
[]
) – Semidefinite variable indexes. (input)numterm
(i64
[]
) – The number of terms in the weighted sums that form each entry. (input)ptrterm
(i64
[]
) – The pointer to the beginning of the description of each entry. (input)termidx
(i64
[]
) – Concatenated lists of indices in \(E\) of the matrices appearing in the weighted sums for the \(\barF\) entries in the row. (input)termweight
(f64
[]
) – 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.put_afe_f_col¶
pub fn Task::put_afe_f_col (&mut self, varidx : i32, afeidx : &[i64], val : &[f64]) -> Result<(),String>
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
(i32
) – Index of a column in \(F\). (input)afeidx
(i64
[]
) – Row indexes of non-zero values in the column of \(F\). (input)val
(f64
[]
) – New non-zero values in the column of \(F\). (input)
- Groups
- Task.put_afe_f_entry¶
pub fn Task::put_afe_f_entry (&mut self, afeidx : i64, varidx : i32, value : f64) -> Result<(),String>
Replaces one entry in the affine expression store \(F\), that is it sets:
\[F_{\mathrm{afeidx}, \mathrm{varidx}} = \mathrm{value}.\]- Parameters
afeidx
(i64
) – Row index in \(F\). (input)varidx
(i32
) – Column index in \(F\). (input)value
(f64
) – Value of \(F_{\mathrm{afeidx},\mathrm{varidx}}\). (input)
- Groups
- Task.put_afe_f_entry_list¶
pub fn Task::put_afe_f_entry_list (&mut self, afeidx : &[i64], varidx : &[i32], val : &[f64]) -> Result<(),String>
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
(i64
[]
) – Row indices in \(F\). (input)varidx
(i32
[]
) – Column indices in \(F\). (input)val
(f64
[]
) – Values of the entries in \(F\). (input)
- Groups
- Task.put_afe_f_row¶
pub fn Task::put_afe_f_row (&mut self, afeidx : i64, varidx : &[i32], val : &[f64]) -> Result<(),String>
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
(i64
) – Index of a row in \(F\). (input)varidx
(i32
[]
) – Column indexes of non-zero values in the row of \(F\). (input)val
(f64
[]
) – New non-zero values in the row of \(F\). (input)
- Groups
- Task.put_afe_f_row_list¶
pub fn Task::put_afe_f_row_list (&mut self, afeidx : &[i64], numnzrow : &[i32], ptrrow : &[i64], varidx : &[i32], val : &[f64]) -> Result<(),String>
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.put_afe_f_row
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
(i64
[]
) – Indices of rows in \(F\). (input)numnzrow
(i32
[]
) – Number of non-zeros in each of the modified rows of \(F\). (input)ptrrow
(i64
[]
) – Pointer to the first nonzero in each row of \(F\). (input)varidx
(i32
[]
) – Column indexes of non-zero values. (input)val
(f64
[]
) – New non-zero values in the rows of \(F\). (input)
- Groups
- Task.put_afe_g¶
pub fn Task::put_afe_g (&mut self, afeidx : i64, g : f64) -> Result<(),String>
Change one element of the vector \(g\) in affine expressions i.e.
\[g_{\mathtt{afeidx}} = \mathtt{gi}.\]- Parameters
afeidx
(i64
) – Index of an entry in \(g\). (input)g
(f64
) – New value for \(g_{\mathrm{afeidx}}\). (input)
- Groups
- Task.put_afe_g_list¶
pub fn Task::put_afe_g_list (&mut self, afeidx : &[i64], g : &[f64]) -> Result<(),String>
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
(i64
[]
) – Indices of entries in \(g\). (input)g
(f64
[]
) – New values for \(g\). (input)
- Groups
- Task.put_afe_g_slice¶
pub fn Task::put_afe_g_slice (&mut self, first : i64, last : i64, slice : &[f64]) -> Result<(),String>
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
(i64
) – First index in the sequence. (input)last
(i64
) – Last index plus 1 in the sequence. (input)slice
(f64
[]
) – The slice of \(g\) as a dense vector. The length islast-first
. (input)
- Groups
- Task.put_aij¶
pub fn Task::put_aij (&mut self, i : i32, j : i32, aij : f64) -> Result<(),String>
Changes a coefficient in the linear coefficient matrix \(A\) using the method
\[a_{i,j} = \mathtt{aij}.\]- Parameters
i
(i32
) – Constraint (row) index. (input)j
(i32
) – Variable (column) index. (input)aij
(f64
) – New coefficient for \(a_{i,j}\). (input)
- Groups
- Task.put_aij_list¶
pub fn Task::put_aij_list (&mut self, subi : &[i32], subj : &[i32], valij : &[f64]) -> Result<(),String>
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
(i32
[]
) – Constraint (row) indices. (input)subj
(i32
[]
) – Variable (column) indices. (input)valij
(f64
[]
) – New coefficient values for \(a_{i,j}\). (input)
- Groups
- Task.put_bara_block_triplet¶
pub fn Task::put_bara_block_triplet (&mut self, subi : &[i32], subj : &[i32], subk : &[i32], subl : &[i32], valijkl : &[f64]) -> Result<(),String>
Inputs the \(\barA\) matrix in block triplet form.
- Parameters
subi
(i32
[]
) – Constraint index. (input)subj
(i32
[]
) – Symmetric matrix variable index. (input)subk
(i32
[]
) – Block row index. (input)subl
(i32
[]
) – Block column index. (input)valijkl
(f64
[]
) – The numerical value associated with each block triplet. (input)
- Groups
- Task.put_bara_ij¶
pub fn Task::put_bara_ij (&mut self, i : i32, j : i32, sub : &[i64], weights : &[f64]) -> Result<(),String>
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.append_sparse_sym_mat
.- Parameters
i
(i32
) – Row index of \(\barA\). (input)j
(i32
) – Column index of \(\barA\). (input)sub
(i64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(f64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
- Groups
- Task.put_bara_ij_list¶
pub fn Task::put_bara_ij_list (&mut self, subi : &[i32], subj : &[i32], alphaptrb : &[i64], alphaptre : &[i64], matidx : &[i64], weights : &[f64]) -> Result<(),String>
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.append_sparse_sym_mat
.- Parameters
subi
(i32
[]
) – Row index of \(\barA\). (input)subj
(i32
[]
) – Column index of \(\barA\). (input)alphaptrb
(i64
[]
) – Start entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)alphaptre
(i64
[]
) – End entries for terms in the weighted sum that forms \(\barA_{ij}\). (input)matidx
(i64
[]
) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)weights
(f64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
- Groups
- Task.put_bara_row_list¶
pub fn Task::put_bara_row_list (&mut self, subi : &[i32], ptrb : &[i64], ptre : &[i64], subj : &[i32], nummat : &[i64], matidx : &[i64], weights : &[f64]) -> Result<(),String>
This function replaces a list of rows in the \(\barA\) matrix.
- Parameters
subi
(i32
[]
) – Row indexes of \(\barA\). (input)ptrb
(i64
[]
) – Start of rows in \(\barA\). (input)ptre
(i64
[]
) – End of rows in \(\barA\). (input)subj
(i32
[]
) – Column index of \(\barA\). (input)nummat
(i64
[]
) – Number of entries in weighted sum of matrixes. (input)matidx
(i64
[]
) – Matrix indexes for weighted sum of matrixes. (input)weights
(f64
[]
) – Weights for weighted sum of matrixes. (input)
- Groups
- Task.put_barc_block_triplet¶
pub fn Task::put_barc_block_triplet (&mut self, subj : &[i32], subk : &[i32], subl : &[i32], valjkl : &[f64]) -> Result<(),String>
Inputs the \(\barC\) matrix in block triplet form.
- Parameters
subj
(i32
[]
) – Symmetric matrix variable index. (input)subk
(i32
[]
) – Block row index. (input)subl
(i32
[]
) – Block column index. (input)valjkl
(f64
[]
) – The numerical value associated with each block triplet. (input)
- Groups
- Task.put_barc_j¶
pub fn Task::put_barc_j (&mut self, j : i32, sub : &[i64], weights : &[f64]) -> Result<(),String>
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.append_sparse_sym_mat
.- Parameters
j
(i32
) – Index of the element in \(\barC\) that should be changed. (input)sub
(i64
[]
) – Indices in \(E\) of matrices appearing in the weighted sum for \(\barC_j\) (input)weights
(f64
[]
) –weights[k]
is the coefficient of thesub[k]
-th element of \(E\) in the weighted sum forming \(\barC_j\). (input)
- Groups
- Task.put_bars_j¶
pub fn Task::put_bars_j (&mut self, whichsol : i32, j : i32, barsj : &[f64]) -> Result<(),String>
Sets the dual solution for a semidefinite variable.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)j
(i32
) – Index of the semidefinite variable. (input)barsj
(f64
[]
) – Value of \(\barS_j\). Format as inTask.get_bars_j
. (input)
- Groups
- Task.put_barvar_name¶
pub fn Task::put_barvar_name (&mut self, j : i32, name : &str) -> Result<(),String>
Sets the name of a semidefinite variable.
- Parameters
j
(i32
) – Index of the variable. (input)name
(&str
) – The variable name. (input)
- Groups
- Task.put_barx_j¶
pub fn Task::put_barx_j (&mut self, whichsol : i32, j : i32, barxj : &[f64]) -> Result<(),String>
Sets the primal solution for a semidefinite variable.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)j
(i32
) – Index of the semidefinite variable. (input)barxj
(f64
[]
) – Value of \(\barX_j\). Format as inTask.get_barx_j
. (input)
- Groups
- Task.put_c_j¶
pub fn Task::put_c_j (&mut self, j : i32, cj : f64) -> Result<(),String>
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
(i32
) – Index of the variable for which \(c\) should be changed. (input)cj
(f64
) – New value of \(c_j\). (input)
- Groups
- Task.put_c_list¶
pub fn Task::put_c_list (&mut self, subj : &[i32], val : &[f64]) -> Result<(),String>
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.put_c_j
.- Parameters
subj
(i32
[]
) – Indices of variables for which the coefficient in \(c\) should be changed. (input)val
(f64
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - objective
- Task.put_c_slice¶
pub fn Task::put_c_slice (&mut self, first : i32, last : i32, slice : &[f64]) -> Result<(),String>
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.put_c_j
.- Parameters
first
(i32
) – First element in the slice of \(c\). (input)last
(i32
) – Last element plus 1 of the slice in \(c\) to be changed. (input)slice
(f64
[]
) – New numerical values for coefficients in \(c\) that should be modified. (input)
- Groups
- Task.put_callback¶
pub fn TaskCB::put_callback<F> (& mut self, func : F) -> Result<(),String> where F : 'static +FnMut(i32, &[f64], &[i32], &[i64]) -> bool
Receive callbacks with solver status and information during optimization.
- Parameters
func
(function
) – The callback function. (input)
- Task.put_cfix¶
pub fn Task::put_cfix (&mut self, cfix : f64) -> Result<(),String>
Replaces the fixed term in the objective by a new one.
- Parameters
cfix
(f64
) – Fixed term in the objective. (input)- Groups
- Task.put_con_bound¶
pub fn Task::put_con_bound (&mut self, i : i32, bkc : i32, blc : f64, buc : f64) -> Result<(),String>
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
(i32
) – Index of the constraint. (input)bkc
(Boundkey
) – New bound key. (input)blc
(f64
) – New lower bound. (input)buc
(f64
) – New upper bound. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.put_con_bound_list¶
pub fn Task::put_con_bound_list (&mut self, sub : &[i32], bkc : &[i32], blc : &[f64], buc : &[f64]) -> Result<(),String>
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.put_con_bound
.- Parameters
sub
(i32
[]
) – List of constraint indexes. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(f64
[]
) – Lower bounds for the constraints. (input)buc
(f64
[]
) – Upper bounds for the constraints. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.put_con_bound_list_const¶
pub fn Task::put_con_bound_list_const (&mut self, sub : &[i32], bkc : i32, blc : f64, buc : f64) -> Result<(),String>
Changes the bounds for one or more constraints. Data checks are performed as in
Task.put_con_bound
.- Parameters
sub
(i32
[]
) – List of constraint indexes. (input)bkc
(Boundkey
) – New bound key for all constraints in the list. (input)blc
(f64
) – New lower bound for all constraints in the list. (input)buc
(f64
) – New upper bound for all constraints in the list. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.put_con_bound_slice¶
pub fn Task::put_con_bound_slice (&mut self, first : i32, last : i32, bkc : &[i32], blc : &[f64], buc : &[f64]) -> Result<(),String>
Changes the bounds for a slice of the constraints. Data checks are performed as in
Task.put_con_bound
.- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bkc
(Boundkey
[]
) – Bound keys for the constraints. (input)blc
(f64
[]
) – Lower bounds for the constraints. (input)buc
(f64
[]
) – Upper bounds for the constraints. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.put_con_bound_slice_const¶
pub fn Task::put_con_bound_slice_const (&mut self, first : i32, last : i32, bkc : i32, blc : f64, buc : f64) -> Result<(),String>
Changes the bounds for a slice of the constraints. Data checks are performed as in
Task.put_con_bound
.- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bkc
(Boundkey
) – New bound key for all constraints in the slice. (input)blc
(f64
) – New lower bound for all constraints in the slice. (input)buc
(f64
) – New upper bound for all constraints in the slice. (input)
- Groups
Problem data - linear part, Problem data - constraints, Problem data - bounds
- Task.put_con_name¶
pub fn Task::put_con_name (&mut self, i : i32, name : &str) -> Result<(),String>
Sets the name of a constraint.
- Parameters
i
(i32
) – Index of the constraint. (input)name
(&str
) – The name of the constraint. (input)
- Groups
Names, Problem data - constraints, Problem data - linear part
- Task.put_con_solution_i¶
pub fn Task::put_con_solution_i (&mut self, i : i32, whichsol : i32, sk : i32, x : f64, sl : f64, su : f64) -> Result<(),String>
Sets the primal and dual solution information for a single constraint.
- Parameters
i
(i32
) – Index of the constraint. (input)whichsol
(Soltype
) – Selects a solution. (input)sk
(Stakey
) – Status key of the constraint. (input)x
(f64
) – Primal solution value of the constraint. (input)sl
(f64
) – Solution value of the dual variable associated with the lower bound. (input)su
(f64
) – Solution value of the dual variable associated with the upper bound. (input)
- Groups
- Task.put_cone Deprecated¶
pub fn Task::put_cone (&mut self, k : i32, ct : i32, conepar : f64, submem : &[i32]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
k
(i32
) – Index of the cone. (input)ct
(Conetype
) – Specifies the type of the cone. (input)conepar
(f64
) – For the power cone it denotes the exponent alpha. For other cone types it is unused and can be set to 0. (input)submem
(i32
[]
) – Variable subscripts of the members in the cone. (input)
- Groups
- Task.put_cone_name Deprecated¶
pub fn Task::put_cone_name (&mut self, j : i32, name : &str) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
- Parameters
j
(i32
) – Index of the cone. (input)name
(&str
) – The name of the cone. (input)
- Groups
- Task.put_djc¶
pub fn Task::put_djc (&mut self, djcidx : i64, domidxlist : &[i64], afeidxlist : &[i64], b : &[f64], termsizelist : &[i64]) -> Result<(),String>
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
(i64
) – Index of the disjunctive constraint. (input)domidxlist
(i64
[]
) – List of domain indexes. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. (input)termsizelist
(i64
[]
) – List of term sizes. (input)
- Groups
- Task.put_djc_name¶
pub fn Task::put_djc_name (&mut self, djcidx : i64, name : &str) -> Result<(),String>
Sets the name of a disjunctive constraint.
- Parameters
djcidx
(i64
) – Index of the disjunctive constraint. (input)name
(&str
) – The name of the disjunctive constraint. (input)
- Groups
- Task.put_djc_slice¶
pub fn Task::put_djc_slice (&mut self, idxfirst : i64, idxlast : i64, domidxlist : &[i64], afeidxlist : &[i64], b : &[f64], termsizelist : &[i64], termsindjc : &[i64]) -> Result<(),String>
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.put_djc
.- Parameters
idxfirst
(i64
) – Index of the first disjunctive constraint in the slice. (input)idxlast
(i64
) – Index of the last disjunctive constraint in the slice plus 1. (input)domidxlist
(i64
[]
) – List of domain indexes. (input)afeidxlist
(i64
[]
) – List of affine expression indexes. (input)b
(f64
[]
) – The vector of constant terms modifying affine expressions. Optional, pass an empty slice if not required. (input)termsizelist
(i64
[]
) – List of term sizes. (input)termsindjc
(i64
[]
) – Number of terms in each of the disjunctive constraints in the slice. (input)
- Groups
- Task.put_domain_name¶
pub fn Task::put_domain_name (&mut self, domidx : i64, name : &str) -> Result<(),String>
Sets the name of a domain.
- Parameters
domidx
(i64
) – Index of the domain. (input)name
(&str
) – The name of the domain. (input)
- Groups
- Task.put_dou_param¶
pub fn Task::put_dou_param (&mut self, param : i32, parvalue : f64) -> Result<(),String>
Sets the value of a double parameter.
- Parameters
param
(Dparam
) – Which parameter. (input)parvalue
(f64
) – Parameter value. (input)
- Groups
- Task.put_int_param¶
pub fn Task::put_int_param (&mut self, param : i32, parvalue : i32) -> Result<(),String>
Sets the value of an integer parameter.
- Parameters
param
(Iparam
) – Which parameter. (input)parvalue
(i32
) – Parameter value. (input)
- Groups
- Task.put_max_num_a_nz¶
pub fn Task::put_max_num_a_nz (&mut self, maxnumanz : i64) -> Result<(),String>
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
(i64
) – Number of preallocated non-zeros in \(A\). (input)- Groups
- Task.put_max_num_acc¶
pub fn Task::put_max_num_acc (&mut self, maxnumacc : i64) -> Result<(),String>
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
(i64
) – Number of preallocated affine conic constraints. (input)- Groups
Environment and task management, Problem data - affine conic constraints
- Task.put_max_num_afe¶
pub fn Task::put_max_num_afe (&mut self, maxnumafe : i64) -> Result<(),String>
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
(i64
) – Number of preallocated affine expressions. (input)- Groups
Environment and task management, Problem data - affine expressions
- Task.put_max_num_barvar¶
pub fn Task::put_max_num_barvar (&mut self, maxnumbarvar : i32) -> Result<(),String>
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
(i32
) – Number of preallocated symmetric matrix variables. (input)- Groups
Environment and task management, Problem data - semidefinite
- Task.put_max_num_con¶
pub fn Task::put_max_num_con (&mut self, maxnumcon : i32) -> Result<(),String>
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
(i32
) – Number of preallocated constraints in the optimization task. (input)- Groups
- Task.put_max_num_cone Deprecated¶
pub fn Task::put_max_num_cone (&mut self, maxnumcone : i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(i32
) – Number of preallocated conic constraints in the optimization task. (input)- Groups
Environment and task management, Problem data - cones (deprecated)
- Task.put_max_num_djc¶
pub fn Task::put_max_num_djc (&mut self, maxnumdjc : i64) -> Result<(),String>
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
(i64
) – Number of preallocated disjunctive constraints in the task. (input)- Groups
Environment and task management, Problem data - disjunctive constraints
- Task.put_max_num_domain¶
pub fn Task::put_max_num_domain (&mut self, maxnumdomain : i64) -> Result<(),String>
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
(i64
) – Number of preallocated domains. (input)- Groups
- Task.put_max_num_q_nz¶
pub fn Task::put_max_num_q_nz (&mut self, maxnumqnz : i64) -> Result<(),String>
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
(i64
) – Number of non-zero elements preallocated in quadratic coefficient matrices. (input)- Groups
Environment and task management, Problem data - quadratic part
- Task.put_max_num_var¶
pub fn Task::put_max_num_var (&mut self, maxnumvar : i32) -> Result<(),String>
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
(i32
) – Number of preallocated variables in the optimization task. (input)- Groups
- Task.put_na_dou_param¶
pub fn Task::put_na_dou_param (&mut self, paramname : &str, parvalue : f64) -> Result<(),String>
Sets the value of a named double parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)parvalue
(f64
) – Parameter value. (input)
- Groups
- Task.put_na_int_param¶
pub fn Task::put_na_int_param (&mut self, paramname : &str, parvalue : i32) -> Result<(),String>
Sets the value of a named integer parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)parvalue
(i32
) – Parameter value. (input)
- Groups
- Task.put_na_str_param¶
pub fn Task::put_na_str_param (&mut self, paramname : &str, parvalue : &str) -> Result<(),String>
Sets the value of a named string parameter.
- Parameters
paramname
(&str
) – Name of a parameter. (input)parvalue
(&str
) – Parameter value. (input)
- Groups
- Task.put_obj_name¶
pub fn Task::put_obj_name (&mut self, objname : &str) -> Result<(),String>
Assigns a new name to the objective.
- Parameters
objname
(&str
) – Name of the objective. (input)- Groups
- Task.put_obj_sense¶
pub fn Task::put_obj_sense (&mut self, sense : i32) -> Result<(),String>
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.put_optserver_host¶
pub fn Task::put_optserver_host (&mut self, host : &str) -> Result<(),String>
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. PassingNone
or empty string deactivates this redirection.Has the same effect as setting the parameter
Sparam::REMOTE_OPTSERVER_HOST
.- Parameters
host
(&str
) – A URL specifying the optimization server to be used. (input)- Groups
- Task.put_param¶
pub fn Task::put_param (&mut self, parname : &str, parvalue : &str) -> Result<(),String>
Checks if
parname
is valid parameter name. If it is, the parameter is assigned the value specified byparvalue
.- Parameters
parname
(&str
) – Parameter name. (input)parvalue
(&str
) – Parameter value. (input)
- Groups
- Task.put_q_con¶
pub fn Task::put_q_con (&mut self, qcsubk : &[i32], qcsubi : &[i32], qcsubj : &[i32], qcval : &[f64]) -> Result<(),String>
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.put_max_num_q_nz
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
(i32
[]
) – Constraint subscripts for quadratic coefficients. (input)qcsubi
(i32
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(i32
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(f64
[]
) – Quadratic constraint coefficient values. (input)
- Groups
- Task.put_q_con_k¶
pub fn Task::put_q_con_k (&mut self, k : i32, qcsubi : &[i32], qcsubj : &[i32], qcval : &[f64]) -> Result<(),String>
Replaces all the quadratic entries in one constraint. This function performs the same operations as
Task.put_q_con
but only with respect to constraint numberk
and it does not modify the other constraints. See the description ofTask.put_q_con
for definitions and important remarks.- Parameters
k
(i32
) – The constraint in which the new \(Q\) elements are inserted. (input)qcsubi
(i32
[]
) – Row subscripts for quadratic constraint matrix. (input)qcsubj
(i32
[]
) – Column subscripts for quadratic constraint matrix. (input)qcval
(f64
[]
) – Quadratic constraint coefficient values. (input)
- Groups
- Task.put_q_obj¶
pub fn Task::put_q_obj (&mut self, qosubi : &[i32], qosubj : &[i32], qoval : &[f64]) -> Result<(),String>
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.put_q_con
for important remarks and example.- Parameters
qosubi
(i32
[]
) – Row subscripts for quadratic objective coefficients. (input)qosubj
(i32
[]
) – Column subscripts for quadratic objective coefficients. (input)qoval
(f64
[]
) – Quadratic objective coefficient values. (input)
- Groups
- Task.put_q_obj_i_j¶
pub fn Task::put_q_obj_i_j (&mut self, i : i32, j : i32, qoij : f64) -> Result<(),String>
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.put_q_obj
instead whenever possible.- Parameters
i
(i32
) – Row index for the coefficient to be replaced. (input)j
(i32
) – Column index for the coefficient to be replaced. (input)qoij
(f64
) – The new value for \(q_{ij}^o\). (input)
- Groups
- Task.put_skc¶
pub fn Task::put_skc (&mut self, whichsol : i32, skc : &[i32]) -> Result<(),String>
Sets the status keys for the constraints.
- Parameters
- Groups
- Task.put_skc_slice¶
pub fn Task::put_skc_slice (&mut self, whichsol : i32, first : i32, last : i32, skc : &[i32]) -> Result<(),String>
Sets the status keys for a slice of the constraints.
- Parameters
- Groups
- Task.put_skx¶
pub fn Task::put_skx (&mut self, whichsol : i32, skx : &[i32]) -> Result<(),String>
Sets the status keys for the scalar variables.
- Parameters
- Groups
- Task.put_skx_slice¶
pub fn Task::put_skx_slice (&mut self, whichsol : i32, first : i32, last : i32, skx : &[i32]) -> Result<(),String>
Sets the status keys for a slice of the variables.
- Parameters
- Groups
- Task.put_slc¶
pub fn Task::put_slc (&mut self, whichsol : i32, slc : &[f64]) -> Result<(),String>
Sets the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups
- Task.put_slc_slice¶
pub fn Task::put_slc_slice (&mut self, whichsol : i32, first : i32, last : i32, slc : &[f64]) -> Result<(),String>
Sets a slice of the \(s_l^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)
- Groups
- Task.put_slx¶
pub fn Task::put_slx (&mut self, whichsol : i32, slx : &[f64]) -> Result<(),String>
Sets the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups
- Task.put_slx_slice¶
pub fn Task::put_slx_slice (&mut self, whichsol : i32, first : i32, last : i32, slx : &[f64]) -> Result<(),String>
Sets a slice of the \(s_l^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)
- Groups
- Task.put_snx¶
pub fn Task::put_snx (&mut self, whichsol : i32, sux : &[f64]) -> Result<(),String>
Sets the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.put_snx_slice¶
pub fn Task::put_snx_slice (&mut self, whichsol : i32, first : i32, last : i32, snx : &[f64]) -> Result<(),String>
Sets a slice of the \(s_n^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups
- Task.put_solution¶
pub fn Task::put_solution (&mut self, whichsol : i32, skc : &[i32], skx : &[i32], skn : &[i32], xc : &[f64], xx : &[f64], y : &[f64], slc : &[f64], suc : &[f64], slx : &[f64], sux : &[f64], snx : &[f64]) -> Result<(),String>
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
(f64
[]
) – Primal constraint solution. (input)xx
(f64
[]
) – Primal variable solution. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)
- Groups
- Task.put_solution_new¶
pub fn Task::put_solution_new (&mut self, whichsol : i32, skc : &[i32], skx : &[i32], skn : &[i32], xc : &[f64], xx : &[f64], y : &[f64], slc : &[f64], suc : &[f64], slx : &[f64], sux : &[f64], snx : &[f64], doty : &[f64]) -> Result<(),String>
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
(f64
[]
) – Primal constraint solution. (input)xx
(f64
[]
) – Primal variable solution. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (input)slc
(f64
[]
) – Dual variables corresponding to the lower bounds on the constraints. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)slx
(f64
[]
) – Dual variables corresponding to the lower bounds on the variables. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)snx
(f64
[]
) – Dual variables corresponding to the conic constraints on the variables. (input)doty
(f64
[]
) – Dual variables corresponding to affine conic constraints. (input)
- Groups
- Task.put_solution_y_i¶
pub fn Task::put_solution_y_i (&mut self, i : i32, whichsol : i32, y : f64) -> Result<(),String>
Inputs the dual variable of a solution.
- Parameters
i
(i32
) – Index of the dual variable. (input)whichsol
(Soltype
) – Selects a solution. (input)y
(f64
) – Solution value of the dual variable. (input)
- Groups
- Task.put_str_param¶
pub fn Task::put_str_param (&mut self, param : i32, parvalue : &str) -> Result<(),String>
Sets the value of a string parameter.
- Parameters
param
(Sparam
) – Which parameter. (input)parvalue
(&str
) – Parameter value. (input)
- Groups
- Task.put_stream_callback¶
pub fn TaskCB::put_stream_callback<F> (&mut self, whichstream : i32, func : F) -> Result<(),String> where F : 'static+Fn(&str)
Directs all output from a task stream to a stream callback function. The function should accept a string.
Can for example be called as:
task.put_stream_callback(Streamtype::LOG, my_stream)?;
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)func
(function
) – The stream handler function. (input)
- Task.put_suc¶
pub fn Task::put_suc (&mut self, whichsol : i32, suc : &[f64]) -> Result<(),String>
Sets the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups
- Task.put_suc_slice¶
pub fn Task::put_suc_slice (&mut self, whichsol : i32, first : i32, last : i32, suc : &[f64]) -> Result<(),String>
Sets a slice of the \(s_u^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)suc
(f64
[]
) – Dual variables corresponding to the upper bounds on the constraints. (input)
- Groups
- Task.put_sux¶
pub fn Task::put_sux (&mut self, whichsol : i32, sux : &[f64]) -> Result<(),String>
Sets the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.put_sux_slice¶
pub fn Task::put_sux_slice (&mut self, whichsol : i32, first : i32, last : i32, sux : &[f64]) -> Result<(),String>
Sets a slice of the \(s_u^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)sux
(f64
[]
) – Dual variables corresponding to the upper bounds on the variables. (input)
- Groups
- Task.put_task_name¶
pub fn Task::put_task_name (&mut self, taskname : &str) -> Result<(),String>
Assigns a new name to the task.
- Parameters
taskname
(&str
) – Name assigned to the task. (input)- Groups
- Task.put_var_bound¶
pub fn Task::put_var_bound (&mut self, j : i32, bkx : i32, blx : f64, bux : f64) -> Result<(),String>
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
(i32
) – Index of the variable. (input)bkx
(Boundkey
) – New bound key. (input)blx
(f64
) – New lower bound. (input)bux
(f64
) – New upper bound. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.put_var_bound_list¶
pub fn Task::put_var_bound_list (&mut self, sub : &[i32], bkx : &[i32], blx : &[f64], bux : &[f64]) -> Result<(),String>
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.put_var_bound
.- Parameters
sub
(i32
[]
) – List of variable indexes. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(f64
[]
) – Lower bounds for the variables. (input)bux
(f64
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.put_var_bound_list_const¶
pub fn Task::put_var_bound_list_const (&mut self, sub : &[i32], bkx : i32, blx : f64, bux : f64) -> Result<(),String>
Changes the bounds for one or more variables. Data checks are performed as in
Task.put_var_bound
.- Parameters
sub
(i32
[]
) – List of variable indexes. (input)bkx
(Boundkey
) – New bound key for all variables in the list. (input)blx
(f64
) – New lower bound for all variables in the list. (input)bux
(f64
) – New upper bound for all variables in the list. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.put_var_bound_slice¶
pub fn Task::put_var_bound_slice (&mut self, first : i32, last : i32, bkx : &[i32], blx : &[f64], bux : &[f64]) -> Result<(),String>
Changes the bounds for a slice of the variables. Data checks are performed as in
Task.put_var_bound
.- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bkx
(Boundkey
[]
) – Bound keys for the variables. (input)blx
(f64
[]
) – Lower bounds for the variables. (input)bux
(f64
[]
) – Upper bounds for the variables. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.put_var_bound_slice_const¶
pub fn Task::put_var_bound_slice_const (&mut self, first : i32, last : i32, bkx : i32, blx : f64, bux : f64) -> Result<(),String>
Changes the bounds for a slice of the variables. Data checks are performed as in
Task.put_var_bound
.- Parameters
first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)bkx
(Boundkey
) – New bound key for all variables in the slice. (input)blx
(f64
) – New lower bound for all variables in the slice. (input)bux
(f64
) – New upper bound for all variables in the slice. (input)
- Groups
Problem data - linear part, Problem data - variables, Problem data - bounds
- Task.put_var_name¶
pub fn Task::put_var_name (&mut self, j : i32, name : &str) -> Result<(),String>
Sets the name of a variable.
- Parameters
j
(i32
) – Index of the variable. (input)name
(&str
) – The variable name. (input)
- Groups
- Task.put_var_solution_j¶
pub fn Task::put_var_solution_j (&mut self, j : i32, whichsol : i32, sk : i32, x : f64, sl : f64, su : f64, sn : f64) -> Result<(),String>
Sets the primal and dual solution information for a single variable.
- Parameters
j
(i32
) – Index of the variable. (input)whichsol
(Soltype
) – Selects a solution. (input)sk
(Stakey
) – Status key of the variable. (input)x
(f64
) – Primal solution value of the variable. (input)sl
(f64
) – Solution value of the dual variable associated with the lower bound. (input)su
(f64
) – Solution value of the dual variable associated with the upper bound. (input)sn
(f64
) – Solution value of the dual variable associated with the conic constraint. (input)
- Groups
- Task.put_var_type¶
pub fn Task::put_var_type (&mut self, j : i32, vartype : i32) -> Result<(),String>
Sets the variable type of one variable.
- Parameters
j
(i32
) – Index of the variable. (input)vartype
(Variabletype
) – The new variable type. (input)
- Groups
- Task.put_var_type_list¶
pub fn Task::put_var_type_list (&mut self, subj : &[i32], vartype : &[i32]) -> Result<(),String>
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
(i32
[]
) – 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.put_xc¶
pub fn Task::put_xc (&mut self, whichsol : i32, xc : &mut[f64]) -> Result<(),String>
Sets the \(x^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)xc
(f64
[]
) – Primal constraint solution. (output)
- Groups
- Task.put_xc_slice¶
pub fn Task::put_xc_slice (&mut self, whichsol : i32, first : i32, last : i32, xc : &[f64]) -> Result<(),String>
Sets a slice of the \(x^c\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)xc
(f64
[]
) – Primal constraint solution. (input)
- Groups
- Task.put_xx¶
pub fn Task::put_xx (&mut self, whichsol : i32, xx : &[f64]) -> Result<(),String>
Sets the \(x^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)xx
(f64
[]
) – Primal variable solution. (input)
- Groups
- Task.put_xx_slice¶
pub fn Task::put_xx_slice (&mut self, whichsol : i32, first : i32, last : i32, xx : &[f64]) -> Result<(),String>
Sets a slice of the \(x^x\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)xx
(f64
[]
) – Primal variable solution. (input)
- Groups
- Task.put_y¶
pub fn Task::put_y (&mut self, whichsol : i32, y : &[f64]) -> Result<(),String>
Sets the \(y\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups
- Task.put_y_slice¶
pub fn Task::put_y_slice (&mut self, whichsol : i32, first : i32, last : i32, y : &[f64]) -> Result<(),String>
Sets a slice of the \(y\) vector for a solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)first
(i32
) – First index in the sequence. (input)last
(i32
) – Last index plus 1 in the sequence. (input)y
(f64
[]
) – Vector of dual variables corresponding to the constraints. (input)
- Groups
- Task.read_b_solution¶
pub fn Task::read_b_solution (&self, filename : &str, compress : i32) -> Result<(),String>
Read a binary dump of the task solution.
- Parameters
filename
(&str
) – A valid file name. (input)compress
(Compresstype
) – Data compression type. (input)
- Groups
- Task.read_data¶
pub fn Task::read_data (&mut self, filename : &str) -> Result<(),String>
Reads an optimization problem and associated data from a file.
- Parameters
filename
(&str
) – A valid file name. (input)- Groups
- Task.read_data_format¶
pub fn Task::read_data_format (&mut self, filename : &str, format : i32, compress : i32) -> Result<(),String>
Reads an optimization problem and associated data from a file.
- Parameters
filename
(&str
) – A valid file name. (input)format
(Dataformat
) – File data format. (input)compress
(Compresstype
) – File compression type. (input)
- Groups
- Task.read_json_sol¶
pub fn Task::read_json_sol (&mut self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups
- Task.read_json_string¶
pub fn Task::read_json_string (&mut self, data : &str) -> Result<(),String>
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
(&str
) – Problem data in text format. (input)- Groups
- Task.read_lp_string¶
pub fn Task::read_lp_string (&mut self, data : &str) -> Result<(),String>
Load task data from a string in LP format, replacing any data that already exists in the task object.
- Parameters
data
(&str
) – Problem data in text format. (input)- Groups
- Task.read_opf_string¶
pub fn Task::read_opf_string (&mut self, data : &str) -> Result<(),String>
Load task data from a string in OPF format, replacing any data that already exists in the task object.
- Parameters
data
(&str
) – Problem data in text format. (input)- Groups
- Task.read_param_file¶
pub fn Task::read_param_file (&mut self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups
- Task.read_ptf_string¶
pub fn Task::read_ptf_string (&mut self, data : &str) -> Result<(),String>
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
(&str
) – Problem data in text format. (input)- Groups
- Task.read_solution¶
pub fn Task::read_solution (&mut self, whichsol : i32, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)
- Groups
- Task.read_solution_file¶
pub fn Task::read_solution_file (&self, filename : &str) -> Result<(),String>
Read solution file in format determined by the filename
- Parameters
filename
(&str
) – A valid file name. (input)- Groups
- Task.read_summary¶
pub fn Task::read_summary (&mut self, whichstream : i32) -> Result<(),String>
Prints a short summary of last file that was read.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)- Groups
- Task.read_task¶
pub fn Task::read_task (&mut self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups
- Task.remove_barvars¶
pub fn Task::remove_barvars (&mut self, subset : &[i32]) -> Result<(),String>
The function removes a subset of the symmetric matrices from the optimization task. This implies that the remaining symmetric matrices are renumbered.
- Parameters
subset
(i32
[]
) – Indexes of symmetric matrices which should be removed. (input)- Groups
- Task.remove_cones Deprecated¶
pub fn Task::remove_cones (&mut self, subset : &[i32]) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
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
(i32
[]
) – Indexes of cones which should be removed. (input)- Groups
- Task.remove_cons¶
pub fn Task::remove_cons (&mut self, subset : &[i32]) -> Result<(),String>
The function removes a subset of the constraints from the optimization task. This implies that the remaining constraints are renumbered.
- Parameters
subset
(i32
[]
) – Indexes of constraints which should be removed. (input)- Groups
- Task.remove_vars¶
pub fn Task::remove_vars (&mut self, subset : &[i32]) -> Result<(),String>
The function removes a subset of the variables from the optimization task. This implies that the remaining variables are renumbered.
- Parameters
subset
(i32
[]
) – Indexes of variables which should be removed. (input)- Groups
- Task.resize_task¶
pub fn Task::resize_task (&mut self, maxnumcon : i32, maxnumvar : i32, maxnumcone : i32, maxnumanz : i64, maxnumqnz : i64) -> Result<(),String>
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
(i32
) – New maximum number of constraints. (input)maxnumvar
(i32
) – New maximum number of variables. (input)maxnumcone
(i32
) – New maximum number of cones. (input)maxnumanz
(i64
) – New maximum number of non-zeros in \(A\). (input)maxnumqnz
(i64
) – New maximum number of non-zeros in all \(Q\) matrices. (input)
- Groups
- Task.sensitivity_report¶
pub fn Task::sensitivity_report (&self, whichstream : i32) -> Result<(),String>
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_defaults¶
pub fn Task::set_defaults(&mut self) -> Result<(),String>
Resets all the parameters to their default values.
- Groups
- Task.solution_def¶
pub fn Task::solution_def (&self, whichsol : i32) -> Result<bool,String>
Checks whether a solution is defined.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)- Return
isdef
(bool
) – Is non-zero if the requested solution is defined.- Groups
- Task.solution_summary¶
pub fn Task::solution_summary (&self, whichstream : i32) -> Result<(),String>
Prints a short summary of the current solutions.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)- Groups
- Task.solve_with_basis¶
pub fn Task::solve_with_basis (&mut self, transp : bool, numnz : i32, sub : &mut[i32], val : &mut[f64]) -> Result<i32,String>
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.init_basis_solve
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.init_basis_solve
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
(bool
) – If this argument is zero, then (15.3) is solved, if non-zero then (15.4) is solved. (input)numnz
(i32
) – The number of non-zeros in \(b\). (input)sub
(i32
[]
) – 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
(f64
[]
) – As input it is the vector \(b\) as a dense vector (although the positions of non-zeros are specified insub
it is required that \(\mathtt{val}[i] = 0\) when \(b[i] = 0\)). As outputval
is the vector \(\barX\) as a dense vector. It must have length \(numcon\). (input/output)
- Return
numnzout
(i32
) – The number of non-zeros in \(\barX\).- Groups
- Task.str_to_cone_type Deprecated¶
pub fn Task::str_to_cone_type (&self, str : &str, conetype : & mut i32) -> Result<(),String>
NOTE: This interface to conic optimization is deprecated and will be removed in a future major release. Conic problems should be specified using the affine conic constraints interface (ACC), see Sec. 6.2 (From Linear to Conic Optimization) for details.
Obtains cone type code corresponding to a cone type string.
- Parameters
str
(&str
) – String corresponding to the cone type codeconetype
. (input)conetype
(Conetype
by reference) – The cone type corresponding to the stringstr
. (output)
- Groups
- Task.str_to_sk¶
pub fn Task::str_to_sk (&self, str : &str, sk : & mut i32) -> Result<(),String>
Obtains the status key corresponding to an abbreviation string.
- Parameters
str
(&str
) – A status key abbreviation string. (input)sk
(Stakey
by reference) – Status key corresponding to the string. (output)
- Groups
- Task.toconic Deprecated¶
pub fn Task::toconic(&mut self) -> Result<(),String>
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.unlink_func_from_stream¶
pub fn Task::unlink_func_from_stream (&mut self, whichstream : i32) -> Result<(),String>
Disconnects a user-defined function from a task stream.
- Parameters
whichstream
(Streamtype
) – Index of the stream. (input)- Groups
- Task.update_solution_info¶
pub fn Task::update_solution_info (&mut self, whichsol : i32) -> Result<(),String>
Update the information items related to the solution.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)- Groups
- Task.which_param¶
pub fn Task::which_param (&self, parname : &str, partype : & mut i32, param : &mut i32) -> Result<(),String>
Checks if
parname
is a valid parameter name. If yes thenpartype
andparam
denote the type and the index of the parameter, respectively.- Parameters
parname
(&str
) – Parameter name. (input)partype
(Parametertype
by reference) – Parameter type. (output)param
(i32
by reference) – Which parameter. (output)
- Groups
- Task.with_callbacks¶
pub fn Task::with_callbacks (self) -> TaskCB;
Converts a task into a task with callbacks. This function must be called to enable attachinf callback functions (log stream and information callbacks) due to the fact, that callbacks cannot be shared between multiple threads.
A task (
struct Task
) and task with callbacks (struct TaskCB
) share the same API, except for the callback, therefore we do not distinguish between them in the API reference.- Return
newtaskcb
(TaskCB
) – A task with callbacks.
- Task.without_callbacks¶
pub fn TaskCB::without_callbacks (self) -> Task;
Converts a task with callbacks into a task without.
- Return
newtask
(Task
) – A task without callbacks.
- Task.write_b_solution¶
pub fn Task::write_b_solution (&self, filename : &str, compress : i32) -> Result<(),String>
Write a binary dump of the task solution.
- Parameters
filename
(&str
) – A valid file name. (input)compress
(Compresstype
) – Data compression type. (input)
- Groups
- Task.write_data¶
pub fn Task::write_data (&self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups
- Task.write_data_stream¶
pub fn Task::write_data_stream (&mut self, stream : OutputStream, format : i32, compress : i32) -> Result<(),String>
Writes problem data associated with the optimization task to a stream in one of the supported formats.
Example:
task.write_data_stream(|s| if let Err(_) = io::stdout().write(s) { 0 } else { s.len() }, Dataformat::PTF, Compresstype::NONE); let mut outf = fs::File::create("outfile.task").unwrap(); task.write_data_stream(|s| if let Err(_) = outf.write(s) { 0 } else { s.len() }, Dataformat::TASK, Compresstype::NONE );
- Parameters
stream
(OutputStream
) – The output stream. (input)format
(mosek.dataformat
) – Data format. (input)compress
(mosek.compresstype
) – Selects compression type. (input)
- Task.write_json_sol¶
pub fn Task::write_json_sol (&self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups
- Task.write_param_file¶
pub fn Task::write_param_file (&self, filename : &str) -> Result<(),String>
Writes all the parameters to a parameter file.
- Parameters
filename
(&str
) – A valid file name. (input)- Groups
- Task.write_solution¶
pub fn Task::write_solution (&self, whichsol : i32, filename : &str) -> Result<(),String>
Saves the current basic, interior-point, or integer solution to a file.
- Parameters
whichsol
(Soltype
) – Selects a solution. (input)filename
(&str
) – A valid file name. (input)
- Groups
- Task.write_solution_file¶
pub fn Task::write_solution_file (&self, filename : &str) -> Result<(),String>
Write solution file in format determined by the filename
- Parameters
filename
(&str
) – A valid file name. (input)- Groups
- Task.write_task¶
pub fn Task::write_task (&self, filename : &str) -> Result<(),String>
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
(&str
) – A valid file name. (input)- Groups