16.4 Class Task

mosek.Task

Represents an optimization task.

Task.Task
Task(Env env)
Task(
  Env env,
  int numcon,
  int numvar)
Task(Task task)

Constructor of a new optimization task.

Parameters:
 
  • env (Env) – Parent environment. (input)
  • numcon (int) – An optional hint about the maximal number of constraints in the task. (input)
  • numvar (int) – An optional hint about the maximal number of variables in the task. (input)
  • task (Task) – A task that will be cloned. (input)
Task.Dispose
void Dispose()

Free the underlying native allocation.

Task.analyzenames
void analyzenames
  (streamtype whichstream,
   nametype nametype)

The function analyzes the names and issues an error if a name is invalid.

Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • nametype (nametype) – The type of names e.g. valid in MPS or LP files. (input)
Groups:
 

Task diagnostics

Task.analyzeproblem
void analyzeproblem (streamtype whichstream)

The function analyzes the data of a task and writes out a report.

Parameters:
 whichstream (streamtype) – Index of the stream. (input)
Groups:
 Task diagnostics
Task.analyzesolution
void analyzesolution
  (streamtype whichstream,
   soltype whichsol)

Print information related to the quality of the solution and other solution statistics.

By default this function prints information about the largest infeasibilites in the solution, the primal (and possibly dual) objective value and the solution status.

Following parameters can be used to configure the printed statistics:

  • iparam.ana_sol_basis enables or disables printing of statistics specific to the basis solution (condition number, number of basic variables etc.). Default is on.
  • iparam.ana_sol_print_violated enables or disables listing names of all constraints (both primal and dual) which are violated by the solution. Default is off.
  • dparam.ana_sol_infeas_tol is the tolerance defining when a constraint is considered violated. If a constraint is violated more than this, it will be listed in the summary.
Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • whichsol (soltype) – Selects a solution. (input)
Groups:
 

Task diagnostics

Task.appendbarvars
void appendbarvars (int[] dim)

Appends positive semidefinite matrix variables of dimensions given by dim to the problem.

Parameters:
 dim (int[]) – Dimensions of symmetric matrix variables to be added. (input)
Groups:
 Symmetric matrix variable data
Task.appendcone
void appendcone
  (conetype ct,
   double conepar,
   int[] submem)
void appendcone
  (conetype ct,
   double conepar,
   int nummem,
   int[] submem)

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.

Depending on the value of ct this function appends a normal (conetype.quad) or rotated quadratic cone (conetype.rquad).

Define

\[\hat{x} = x_{\mathtt{submem}[0]},\ldots,x_{\mathtt{submem}[\mathtt{nummem}-1]}.\]

Depending on the value of ct this function appends one of the constraints:

  • Quadratic cone (conetype.quad) :

    \[\hat{x}_0 \geq \sqrt{\sum_{i=1}^{i<\mathtt{nummem}} \hat{x}_i^2}\]
  • Rotated quadratic cone (conetype.rquad) :

    \[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\]

Please note that the sets of variables appearing in different conic constraints must be disjoint.

For an explained code example see Section 6.3.

Parameters:
 
  • ct (conetype) – Specifies the type of the cone. (input)
  • conepar (double) – This argument is currently not used. It can be set to 0 (input)
  • submem (int[]) – Variable subscripts of the members in the cone. (input)
  • nummem (int) – Number of member variables in the cone. (input)
Groups:
 

Conic constraint data

Task.appendconeseq
void appendconeseq
  (conetype ct,
   double conepar,
   int nummem,
   int j)

Appends a new conic constraint to the problem, as in Task.appendcone. The function assumes the members of cone are sequential where the first member has index j and the last j+nummem-1.

Parameters:
 
  • ct (conetype) – Specifies the type of the cone. (input)
  • conepar (double) – This argument is currently not used. It can be set to 0 (input)
  • nummem (int) – Number of member variables in the cone. (input)
  • j (int) – Index of the first variable in the conic constraint. (input)
Groups:
 

Conic constraint data

Task.appendconesseq
void appendconesseq
  (conetype[] ct,
   double[] conepar,
   int[] nummem,
   int j)

Appends a number of conic constraints to the problem, as in Task.appendcone. The \(k\)th cone is assumed to be of dimension nummem[k]. Moreover, it is assumed that the first variable of the first cone has index \(j\) and starting from there the sequentially following variables belong to the first cone, then to the second cone and so on.

Parameters:
 
  • ct (conetype[]) – Specifies the type of the cone. (input)
  • conepar (double[]) – This argument is currently not used. It can be set to 0 (input)
  • nummem (int[]) – Numbers of member variables in the cones. (input)
  • j (int) – Index of the first variable in the first cone to be appended. (input)
Groups:
 

Conic constraint data

Task.appendcons
void appendcons (int num)

Appends a number of constraints to the model. Appended constraints will be declared free. Please note that MOSEK will automatically expand the problem dimension to accommodate the additional constraints.

Parameters:
 num (int) – Number of constraints which should be appended. (input)
Groups:
 Linear constraint data
Task.appendsparsesymmat
long appendsparsesymmat
  (int dim,
   int[] subi,
   int[] subj,
   double[] valij)
void appendsparsesymmat
  (int dim,
   int[] subi,
   int[] subj,
   double[] valij,
   out long idx)

MOSEK maintains a storage of symmetric data matrices that is used to build \(\barC\) and \(\barA\). The storage can be thought of as a vector of symmetric matrices denoted \(E\). Hence, \(E_i\) is a symmetric matrix of certain dimension.

This function appends a general sparse symmetric matrix on triplet form to the vector \(E\) of symmetric matrices. The vectors subi, subj, and valij contains the row subscripts, column subscripts and values of each element in the symmetric matrix to be appended. Since the matrix that is appended is symmetric, only the lower triangular part should be specified. Moreover, duplicates are not allowed.

Observe the function reports the index (position) of the appended matrix in \(E\). This index should be used for later references to the appended matrix.

Parameters:
 
  • dim (int) – Dimension of the symmetric matrix that is appended. (input)
  • subi (int[]) – Row subscript in the triplets. (input)
  • subj (int[]) – Column subscripts in the triplets. (input)
  • valij (double[]) – Values of each triplet. (input)
  • idx (long) – Unique index assigned to the inputted matrix that can be used for later reference. (output)
Return:
 

(long) – Unique index assigned to the inputted matrix that can be used for later reference.

Groups:
 

Symmetric matrix variable data

Task.appendvars
void appendvars (int num)

Appends a number of variables to the model. Appended variables will be fixed at zero. Please note that MOSEK will automatically expand the problem dimension to accommodate the additional variables.

Parameters:
 num (int) – Number of variables which should be appended. (input)
Groups:
 Scalar variable data
Task.asyncgetresult
int asyncgetresult
  (string server,
   string port,
   string token,
   out rescode resp,
   out rescode trm)
void asyncgetresult
  (string server,
   string port,
   string token,
   out int respavailable,
   out rescode resp,
   out rescode trm)

Request a response from a remote job. If successful, solver response, termination code and solutions are retrieved.

Parameters:
 
  • server (string) – Name or IP address of the solver server. (input)
  • port (string) – Network port of the solver service. (input)
  • token (string) – The task token. (input)
  • resp (rescode) – Is the response code from the remote solver. (output)
  • trm (rescode) – Is either rescode.ok or a termination response code. (output)
  • respavailable (int) – Indicates if a remote response is available. If this is not true, resp and trm should be ignored. (output)
Return:
 

(int) – Indicates if a remote response is available. If this is not true, resp and trm should be ignored.

Task.asyncoptimize
string asyncoptimize
  (string server,
   string port)
void asyncoptimize
  (string server,
   string port,
   StringBuilder token)

Offload the optimization task to a solver server defined by server:port. The call will return immediately and not wait for the result.

If the string parameter sparam.remote_access_token is not blank, it will be passed to the server as authentication.

Parameters:
 
  • server (string) – Name or IP address of the solver server (input)
  • port (string) – Network port of the solver service (input)
  • token (StringBuilder) – Returns the task token (output)
Return:
 

(string) – Returns the task token

Task.asyncpoll
int asyncpoll
  (string server,
   string port,
   string token,
   out rescode resp,
   out rescode trm)
void asyncpoll
  (string server,
   string port,
   string token,
   out int respavailable,
   out rescode resp,
   out rescode trm)

Requests information about the status of the remote job.

Parameters:
 
  • server (string) – Name or IP address of the solver server (input)
  • port (string) – Network port of the solver service (input)
  • token (string) – The task token (input)
  • resp (rescode) – Is the response code from the remote solver. (output)
  • trm (rescode) – Is either rescode.ok or a termination response code. (output)
  • respavailable (int) – Indicates if a remote response is available. If this is not true, resp and trm should be ignored. (output)
Return:
 

(int) – Indicates if a remote response is available. If this is not true, resp and trm should be ignored.

Task.asyncstop
void asyncstop
  (string server,
   string port,
   string token)

Request that the job identified by the token is terminated.

Parameters:
 
  • server (string) – Name or IP address of the solver server (input)
  • port (string) – Network port of the solver service (input)
  • token (string) – The task token (input)
Task.basiscond
void basiscond
  (out double nrmbasis,
   out double nrminvbasis)

If a basic solution is available and it defines a nonsingular basis, then this function computes the 1-norm estimate of the basis matrix and a 1-norm estimate for the inverse of the basis matrix. The 1-norm estimates are computed using the method outlined in [Ste98], pp. 388-391.

By definition the 1-norm condition number of a matrix \(B\) is defined as

\[\kappa_1(B) := \|B\|_1 \|B^{-1}\|_1.\]

Moreover, the larger the condition number is the harder it is to solve linear equation systems involving \(B\). Given estimates for \(\|B\|_1\) and \(\|B^{-1}\|_1\) it is also possible to estimate \(\kappa_1(B)\).

Parameters:
 
  • nrmbasis (double) – An estimate for the 1-norm of the basis. (output)
  • nrminvbasis (double) – An estimate for the 1-norm of the inverse of the basis. (output)
Groups:
 

Basis matrix

Task.checkconvexity
void checkconvexity ()

This function checks if a quadratic optimization problem is convex. The amount of checking is controlled by iparam.check_convexity.

The function reports an error if the problem is not convex.

Groups:
 Task diagnostics
Task.checkmem
void checkmem
  (string file,
   int line)

Checks the memory allocated by the task.

Parameters:
 
  • file (string) – File from which the function is called. (input)
  • line (int) – Line in the file from which the function is called. (input)
Groups:
 

Memory

Task.chgbound Deprecated
void chgbound
  (accmode accmode,
   int i,
   int lower,
   int finite,
   double value)

Changes a bound for one constraint or variable. If accmode equals accmode.con, a constraint bound is changed, otherwise a variable bound is changed.

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 bound, in particular, if the lower and upper bounds are identical, the bound key is changed to fixed.

Parameters:
 
  • accmode (accmode) – Defines if operations are performed row-wise (constraint-oriented) or column-wise (variable-oriented). (input)
  • i (int) – Index of the constraint or variable for which the bounds should be changed. (input)
  • lower (int) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)
  • finite (int) – If non-zero, then value is assumed to be finite. (input)
  • value (double) – New value for the bound. (input)
Groups:
 

Bound data

Task.chgconbound
void chgconbound
  (int i,
   int lower,
   int finite,
   double value)

Changes a bound for one constraint.

If lower is non-zero, then the lower bound is changed as follows:

\[\begin{split}\mbox{new lower bound} = \left\{ \begin{array}{ll} - \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]

Otherwise if lower is zero, then

\[\begin{split}\mbox{new upper bound} = \left\{ \begin{array}{ll} \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]

Please note that this function automatically updates the bound key for the bound, in particular, if the lower and upper bounds are identical, the bound key is changed to fixed.

Parameters:
 
  • i (int) – Index of the constraint for which the bounds should be changed. (input)
  • lower (int) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)
  • finite (int) – If non-zero, then value is assumed to be finite. (input)
  • value (double) – New value for the bound. (input)
Groups:
 

Bound data

Task.chgvarbound
void chgvarbound
  (int j,
   int lower,
   int finite,
   double value)

Changes a bound for one variable.

If lower is non-zero, then the lower bound is changed as follows:

\[\begin{split}\mbox{new lower bound} = \left\{ \begin{array}{ll} - \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]

Otherwise if lower is zero, then

\[\begin{split}\mbox{new upper bound} = \left\{ \begin{array}{ll} \infty, & \mathtt{finite}=0, \\ \mathtt{value} & \mbox{otherwise}. \end{array} \right.\end{split}\]

Please note that this function automatically updates the bound key for the bound, in particular, if the lower and upper bounds are identical, the bound key is changed to fixed.

Parameters:
 
  • j (int) – Index of the variable for which the bounds should be changed. (input)
  • lower (int) – If non-zero, then the lower bound is changed, otherwise the upper bound is changed. (input)
  • finite (int) – If non-zero, then value is assumed to be finite. (input)
  • value (double) – New value for the bound. (input)
Groups:
 

Bound data

Task.commitchanges
void commitchanges ()

Commits all cached problem changes to the task. It is usually not necessary to call this function explicitly since changes will be committed automatically when required.

Groups:
 Scalar variable data
Task.deletesolution
void deletesolution (soltype whichsol)

Undefine a solution and free the memory it uses.

Parameters:
 whichsol (soltype) – Selects a solution. (input)
Groups:
 Task management
Task.dualsensitivity
void dualsensitivity
  (int[] subj,
   double[] leftpricej,
   double[] rightpricej,
   double[] leftrangej,
   double[] rightrangej)

Calculates sensitivity information for objective coefficients. The indexes of the coefficients to analyze are

\[\{\mathtt{subj}[i] ~|~ i = 0,\ldots,\mathtt{numj}-1\}\]

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 15.3.1.4.

Parameters:
 
  • subj (int[]) – Indexes of objective coefficients to analyze. (input)
  • leftpricej (double[]) – \(\mathtt{leftpricej}[j]\) is the left shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)
  • rightpricej (double[]) – \(\mathtt{rightpricej}[j]\) is the right shadow price for the coefficient with index \(\mathtt{subj[j]}\). (output)
  • leftrangej (double[]) – \(\mathtt{leftrangej}[j]\) is the left range \(\beta_1\) for the coefficient with index \(\mathtt{subj[j]}\). (output)
  • rightrangej (double[]) – \(\mathtt{rightrangej}[j]\) is the right range \(\beta_2\) for the coefficient with index \(\mathtt{subj[j]}\). (output)
Groups:
 

Sensitivity analysis

Task.getacol
void getacol
  (int j,
   out int nzj,
   int[] subj,
   double[] valj)

Obtains one column of \(A\) in a sparse format.

Parameters:
 
  • j (int) – Index of the column. (input)
  • nzj (int) – Number of non-zeros in the column obtained. (output)
  • subj (int[]) – Row indices of the non-zeros in the column obtained. (output)
  • valj (double[]) – Numerical values in the column obtained. (output)
Groups:
 

Scalar variable data

Task.getacolnumnz
int getacolnumnz (int i)
void getacolnumnz
  (int i,
   out int nzj)

Obtains the number of non-zero elements in one column of \(A\).

Parameters:
 
  • i (int) – Index of the column. (input)
  • nzj (int) – Number of non-zeros in the \(j\)-th column of \(A\). (output)
Return:
 

(int) – Number of non-zeros in the \(j\)-th column of \(A\).

Groups:
 

Scalar variable data

Task.getacolslicetrip
void getacolslicetrip
  (int first,
   int last,
   ref long surp,
   int[] subi,
   int[] subj,
   double[] val)

Obtains a sequence of columns from \(A\) in sparse triplet format. The function returns the content of all columns whose index j satisfies first <= j < last. The triplets corresponding to nonzero entries are stored in the arrays subi, subj and val.

Parameters:
 
  • first (int) – Index of the first column in the sequence. (input)
  • last (int) – Index of the last column in the sequence plus one. (input)
  • surp (long) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in subi, subj and val starting from position surp away from the end of the arrays. On return surp will be decremented by the total number of non-zeros written. (input/output)
  • subi (int[]) – Constraint subscripts. (output)
  • subj (int[]) – Column subscripts. (output)
  • val (double[]) – Values. (output)
Groups:
 

Scalar variable data

Task.getaij
double getaij
  (int i,
   int j)
void getaij
  (int i,
   int j,
   out double aij)

Obtains a single coefficient in \(A\).

Parameters:
 
  • i (int) – Row index of the coefficient to be returned. (input)
  • j (int) – Column index of the coefficient to be returned. (input)
  • aij (double) – The required coefficient \(a_{i,j}\). (output)
Return:
 

(double) – The required coefficient \(a_{i,j}\).

Groups:
 

Scalar variable data

Task.getapiecenumnz
int getapiecenumnz
  (int firsti,
   int lasti,
   int firstj,
   int lastj)
void getapiecenumnz
  (int firsti,
   int lasti,
   int firstj,
   int lastj,
   out int numnz)

Obtains the number non-zeros in a rectangular piece of \(A\), i.e. the number of elements in the set

\[\{ (i,j)~:~ a_{i,j} \neq 0,~ \mathtt{firsti} \leq i \leq \mathtt{lasti}-1, ~\mathtt{firstj} \leq j \leq \mathtt{lastj}-1\}\]

This function is not an efficient way to obtain the number of non-zeros in one row or column. In that case use the function Task.getarownumnz or Task.getacolnumnz.

Parameters:
 
  • firsti (int) – Index of the first row in the rectangular piece. (input)
  • lasti (int) – Index of the last row plus one in the rectangular piece. (input)
  • firstj (int) – Index of the first column in the rectangular piece. (input)
  • lastj (int) – Index of the last column plus one in the rectangular piece. (input)
  • numnz (int) – Number of non-zero \(A\) elements in the rectangular piece. (output)
Return:
 

(int) – Number of non-zero \(A\) elements in the rectangular piece.

Task.getarow
void getarow
  (int i,
   out int nzi,
   int[] subi,
   double[] vali)

Obtains one row of \(A\) in a sparse format.

Parameters:
 
  • i (int) – Index of the row. (input)
  • nzi (int) – Number of non-zeros in the row obtained. (output)
  • subi (int[]) – Column indices of the non-zeros in the row obtained. (output)
  • vali (double[]) – Numerical values of the row obtained. (output)
Groups:
 

Scalar variable data

Task.getarownumnz
int getarownumnz (int i)
void getarownumnz
  (int i,
   out int nzi)

Obtains the number of non-zero elements in one row of \(A\).

Parameters:
 
  • i (int) – Index of the row. (input)
  • nzi (int) – Number of non-zeros in the \(i\)-th row of \(A\). (output)
Return:
 

(int) – Number of non-zeros in the \(i\)-th row of \(A\).

Groups:
 

Scalar variable data

Task.getarowslicetrip
void getarowslicetrip
  (int first,
   int last,
   ref long surp,
   int[] subi,
   int[] subj,
   double[] val)

Obtains a sequence of rows from \(A\) in sparse triplet format. The function returns the content of all rows whose index i satisfies first <= i < last. The triplets corresponding to nonzero entries are stored in the arrays subi, subj and val.

Parameters:
 
  • first (int) – Index of the first row in the sequence. (input)
  • last (int) – Index of the last row in the sequence plus one. (input)
  • surp (long) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in subi, subj and val starting from position surp away from the end of the arrays. On return surp will be decremented by the total number of non-zeros written. (input/output)
  • subi (int[]) – Constraint subscripts. (output)
  • subj (int[]) – Column subscripts. (output)
  • val (double[]) – Values. (output)
Groups:
 

Scalar variable data

Task.getaslice Deprecated
void getaslice
  (accmode accmode,
   int first,
   int last,
   ref int surp,
   int[] ptrb,
   int[] ptre,
   int[] sub,
   double[] val)
void getaslice
  (accmode accmode,
   int first,
   int last,
   ref long surp,
   long[] ptrb,
   long[] ptre,
   int[] sub,
   double[] val)

Obtains a sequence of rows or columns from \(A\) in sparse format.

Parameters:
 
  • accmode (accmode) – Defines whether a column slice or a row slice is requested. (input)
  • first (int) – Index of the first row or column in the sequence. (input)
  • last (int) – Index of the last row or column in the sequence plus one. (input)
  • surp (int) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in sub and val starting from position surp away from the end of the arrays. Upon return surp will be decremented by the total number of non-zeros written. (input/output)
  • surp (long) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in sub and val starting from position surp away from the end of the arrays. Upon return surp will be decremented by the total number of non-zeros written. (input/output)
  • ptrb (int[]) – ptrb[t] is an index pointing to the first element in the \(t\)-th row or column obtained. (output)
  • ptrb (long[]) – ptrb[t] is an index pointing to the first element in the \(t\)-th row or column obtained. (output)
  • ptre (int[]) – ptre[t] is an index pointing to the last element plus one in the \(t\)-th row or column obtained. (output)
  • ptre (long[]) – ptre[t] is an index pointing to the last element plus one in the \(t\)-th row or column obtained. (output)
  • sub (int[]) – Contains the row or column subscripts. (output)
  • val (double[]) – Contains the coefficient values. (output)
Groups:
 

Scalar variable data

Task.getaslicenumnz Deprecated
long getaslicenumnz
  (accmode accmode,
   int first,
   int last)
void getaslicenumnz
  (accmode accmode,
   int first,
   int last,
   out long numnz)

Obtains the number of non-zeros in a slice of rows or columns of \(A\).

Parameters:
 
  • accmode (accmode) – Defines whether non-zeros are counted in a column slice or a row slice. (input)
  • first (int) – Index of the first row or column in the sequence. (input)
  • last (int) – Index of the last row or column plus one in the sequence. (input)
  • numnz (long) – Number of non-zeros in the slice. (output)
Return:
 

(long) – Number of non-zeros in the slice.

Task.getbarablocktriplet
long getbarablocktriplet
  (int[] subi,
   int[] subj,
   int[] subk,
   int[] subl,
   double[] valijkl)
void getbarablocktriplet
  (out long num,
   int[] subi,
   int[] subj,
   int[] subk,
   int[] subl,
   double[] valijkl)

Obtains \(\barA\) in block triplet form.

Parameters:
 
  • subi (int[]) – Constraint index. (output)
  • subj (int[]) – Symmetric matrix variable index. (output)
  • subk (int[]) – Block row index. (output)
  • subl (int[]) – Block column index. (output)
  • valijkl (double[]) – The numerical value associated with each block triplet. (output)
  • num (long) – Number of elements in the block triplet form. (output)
Return:
 

(long) – Number of elements in the block triplet form.

Groups:
 

Symmetric matrix variable data

Task.getbaraidx
long getbaraidx
  (long idx,
   out int i,
   out int j,
   long[] sub,
   double[] weights)
void getbaraidx
  (long idx,
   out int i,
   out int j,
   out long num,
   long[] sub,
   double[] weights)

Obtains information about an element in \(\barA\). Since \(\barA\) is a sparse matrix of symmetric matrices, only the nonzero elements in \(\barA\) are stored in order to save space. Now \(\barA\) is stored vectorized i.e. as one long vector. This function makes it possible to obtain information such as the row index and the column index of a particular element of the vectorized form of \(\barA\).

Please observe if one element of \(\barA\) is inputted multiple times then it may be stored several times in vectorized form. In that case the element with the highest index is the one that is used.

Parameters:
 
  • idx (long) – Position of the element in the vectorized form. (input)
  • i (int) – Row index of the element at position idx. (output)
  • j (int) – Column index of the element at position idx. (output)
  • sub (long[]) – A list indexes of the elements from symmetric matrix storage that appear in the weighted sum. (output)
  • weights (double[]) – The weights associated with each term in the weighted sum. (output)
  • num (long) – Number of terms in weighted sum that forms the element. (output)
Return:
 

(long) – Number of terms in weighted sum that forms the element.

Groups:
 

Symmetric matrix variable data

Task.getbaraidxij
void getbaraidxij
  (long idx,
   out int i,
   out int j)

Obtains information about an element in \(\barA\). Since \(\barA\) is a sparse matrix of symmetric matrices, only the nonzero elements in \(\barA\) are stored in order to save space. Now \(\barA\) is stored vectorized i.e. as one long vector. This function makes it possible to obtain information such as the row index and the column index of a particular element of the vectorized form of \(\barA\).

Please note that if one element of \(\barA\) is inputted multiple times then it may be stored several times in vectorized form. In that case the element with the highest index is the one that is used.

Parameters:
 
  • idx (long) – Position of the element in the vectorized form. (input)
  • i (int) – Row index of the element at position idx. (output)
  • j (int) – Column index of the element at position idx. (output)
Groups:
 

Symmetric matrix variable data

Task.getbaraidxinfo
long getbaraidxinfo (long idx)
void getbaraidxinfo
  (long idx,
   out long num)

Each nonzero element in \(\barA_{ij}\) is formed as a weighted sum of symmetric matrices. Using this function the number of terms in the weighted sum can be obtained. See description of Task.appendsparsesymmat for details about the weighted sum.

Parameters:
 
  • idx (long) – The internal position of the element for which information should be obtained. (input)
  • num (long) – Number of terms in the weighted sum that form the specified element in \(\barA\). (output)
Return:
 

(long) – Number of terms in the weighted sum that form the specified element in \(\barA\).

Groups:
 

Symmetric matrix variable data

Task.getbarasparsity
void getbarasparsity
  (out long numnz,
   long[] idxij)

The matrix \(\barA\) is assumed to be a sparse matrix of symmetric matrices. This implies that many of the elements in \(\barA\) are likely to be zero matrices. Therefore, in order to save space, only nonzero elements in \(\barA\) are stored on vectorized form. This function is used to obtain the sparsity pattern of \(\barA\) and the position of each nonzero element in the vectorized form of \(\barA\). From the index detailed information about each nonzero \(\barA_{i,j}\) can be obtained using Task.getbaraidxinfo and Task.getbaraidx.

Parameters:
 
  • numnz (long) – Number of nonzero elements in \(\barA\). (output)
  • idxij (long[]) – Position of each nonzero element in the vectorized form of \(\barA\). (output)
Groups:
 

Symmetric matrix variable data

Task.getbarcblocktriplet
long getbarcblocktriplet
  (int[] subj,
   int[] subk,
   int[] subl,
   double[] valjkl)
void getbarcblocktriplet
  (out long num,
   int[] subj,
   int[] subk,
   int[] subl,
   double[] valjkl)

Obtains \(\barC\) in block triplet form.

Parameters:
 
  • subj (int[]) – Symmetric matrix variable index. (output)
  • subk (int[]) – Block row index. (output)
  • subl (int[]) – Block column index. (output)
  • valjkl (double[]) – The numerical value associated with each block triplet. (output)
  • num (long) – Number of elements in the block triplet form. (output)
Return:
 

(long) – Number of elements in the block triplet form.

Groups:
 

Symmetric matrix variable data

Task.getbarcidx
void getbarcidx
  (long idx,
   out int j,
   out long num,
   long[] sub,
   double[] weights)

Obtains information about an element in \(\barC\).

Parameters:
 
  • idx (long) – Index of the element for which information should be obtained. (input)
  • j (int) – Row index in \(\barC\). (output)
  • num (long) – Number of terms in the weighted sum. (output)
  • sub (long[]) – Elements appearing the weighted sum. (output)
  • weights (double[]) – Weights of terms in the weighted sum. (output)
Groups:
 

Symmetric matrix variable data

Task.getbarcidxinfo
long getbarcidxinfo (long idx)
void getbarcidxinfo
  (long idx,
   out long num)

Obtains the number of terms in the weighted sum that forms a particular element in \(\barC\).

Parameters:
 
  • idx (long) – Index of the element for which information should be obtained. The value is an index of a symmetric sparse variable. (input)
  • num (long) – Number of terms that appear in the weighted sum that forms the requested element. (output)
Return:
 

(long) – Number of terms that appear in the weighted sum that forms the requested element.

Groups:
 

Symmetric matrix variable data

Task.getbarcidxj
void getbarcidxj
  (long idx,
   out int j)

Obtains the row index of an element in \(\barC\).

Parameters:
 
  • idx (long) – Index of the element for which information should be obtained. (input)
  • j (int) – Row index in \(\barC\). (output)
Groups:
 

Symmetric matrix variable data

Task.getbarcsparsity
void getbarcsparsity
  (out long numnz,
   long[] idxj)

Internally only the nonzero elements of \(\barC\) are stored in a vector. This function is used to obtain the nonzero elements of \(\barC\) and their indexes in the internal vector representation (in idx). From the index detailed information about each nonzero \(\barC_j\) can be obtained using Task.getbarcidxinfo and Task.getbarcidx.

Parameters:
 
  • numnz (long) – Number of nonzero elements in \(\barC\). (output)
  • idxj (long[]) – Internal positions of the nonzeros elements in \(\barC\). (output)
Groups:
 

Symmetric matrix variable data

Task.getbarsj
void getbarsj
  (soltype whichsol,
   int j,
   double[] barsj)

Obtains the dual solution for a semidefinite variable. Only the lower triangular part of \(\barS_j\) is returned because the matrix by construction is symmetric. The format is that the columns are stored sequentially in the natural order.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • j (int) – Index of the semidefinite variable. (input)
  • barsj (double[]) – Value of \(\barS_j\). (output)
Groups:
 

Solution (get)

Task.getbarvarname
string getbarvarname (int i)
void getbarvarname
  (int i,
   StringBuilder name)

Obtains the name of a semidefinite variable.

Parameters:
 
  • i (int) – Index of the variable. (input)
  • name (StringBuilder) – The requested name is copied to this buffer. (output)
Return:
 

(string) – The requested name is copied to this buffer.

Groups:
 

Naming

Task.getbarvarnameindex
int getbarvarnameindex
  (string somename,
   out int asgn)
void getbarvarnameindex
  (string somename,
   out int asgn,
   out int index)

Obtains the index of semidefinite variable from its name.

Parameters:
 
  • somename (string) – The name of the variable. (input)
  • asgn (int) – Non-zero if the name somename is assigned to some semidefinite variable. (output)
  • index (int) – The index of a semidefinite variable with the name somename (if one exists). (output)
Return:
 

(int) – The index of a semidefinite variable with the name somename (if one exists).

Groups:
 

Naming

Task.getbarvarnamelen
int getbarvarnamelen (int i)
void getbarvarnamelen
  (int i,
   out int len)

Obtains the length of the name of a semidefinite variable.

Parameters:
 
  • i (int) – Index of the variable. (input)
  • len (int) – Returns the length of the indicated name. (output)
Return:
 

(int) – Returns the length of the indicated name.

Groups:
 

Naming

Task.getbarxj
void getbarxj
  (soltype whichsol,
   int j,
   double[] barxj)

Obtains the primal solution for a semidefinite variable. Only the lower triangular part of \(\barX_j\) is returned because the matrix by construction is symmetric. The format is that the columns are stored sequentially in the natural order.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • j (int) – Index of the semidefinite variable. (input)
  • barxj (double[]) – Value of \(\barX_j\). (output)
Groups:
 

Solution (get)

Task.getbound Deprecated
void getbound
  (accmode accmode,
   int i,
   out boundkey bk,
   out double bl,
   out double bu)

Obtains bound information for one constraint or variable.

Parameters:
 
  • accmode (accmode) – Defines if operations are performed row-wise (constraint-oriented) or column-wise (variable-oriented). (input)
  • i (int) – Index of the constraint or variable for which the bound information should be obtained. (input)
  • bk (boundkey) – Bound keys. (output)
  • bl (double) – Values for lower bounds. (output)
  • bu (double) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getboundslice Deprecated
void getboundslice
  (accmode accmode,
   int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Obtains bounds information for a slice of variables or constraints.

Parameters:
 
  • accmode (accmode) – Defines if operations are performed row-wise (constraint-oriented) or column-wise (variable-oriented). (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (output)
  • bl (double[]) – Values for lower bounds. (output)
  • bu (double[]) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getc
void getc (double[] c)

Obtains all objective coefficients \(c\).

Parameters:
 c (double[]) – Linear terms of the objective as a dense vector. The length is the number of variables. (output)
Groups:
 Scalar variable data
Task.getcfix
double getcfix ()
void getcfix (out double cfix)

Obtains the fixed term in the objective.

Parameters:
 cfix (double) – Fixed term in the objective. (output)
Return:
  (double) – Fixed term in the objective.
Groups:
 Scalar variable data
Task.getcj
void getcj
  (int j,
   out double cj)

Obtains one coefficient of \(c\).

Parameters:
 
  • j (int) – Index of the variable for which the \(c\) coefficient should be obtained. (input)
  • cj (double) – The value of \(c_j\). (output)
Groups:
 

Scalar variable data

Task.getconbound
void getconbound
  (int i,
   out boundkey bk,
   out double bl,
   out double bu)

Obtains bound information for one constraint.

Parameters:
 
  • i (int) – Index of the constraint for which the bound information should be obtained. (input)
  • bk (boundkey) – Bound keys. (output)
  • bl (double) – Values for lower bounds. (output)
  • bu (double) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getconboundslice
void getconboundslice
  (int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Obtains bounds information for a slice of the constraints.

Parameters:
 
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (output)
  • bl (double[]) – Values for lower bounds. (output)
  • bu (double[]) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getcone
void getcone
  (int k,
   out conetype ct,
   out double conepar,
   out int nummem,
   int[] submem)

Obtains a cone.

Parameters:
 
  • k (int) – Index of the cone. (input)
  • ct (conetype) – Specifies the type of the cone. (output)
  • conepar (double) – This argument is currently not used. It can be set to 0 (output)
  • nummem (int) – Number of member variables in the cone. (output)
  • submem (int[]) – Variable subscripts of the members in the cone. (output)
Groups:
 

Conic constraint data

Task.getconeinfo
void getconeinfo
  (int k,
   out conetype ct,
   out double conepar,
   out int nummem)

Obtains information about a cone.

Parameters:
 
  • k (int) – Index of the cone. (input)
  • ct (conetype) – Specifies the type of the cone. (output)
  • conepar (double) – This argument is currently not used. It can be set to 0 (output)
  • nummem (int) – Number of member variables in the cone. (output)
Groups:
 

Conic constraint data

Task.getconename
string getconename (int i)
void getconename
  (int i,
   StringBuilder name)

Obtains the name of a cone.

Parameters:
 
  • i (int) – Index of the cone. (input)
  • name (StringBuilder) – The required name. (output)
Return:
 

(string) – The required name.

Groups:
 

Naming

Task.getconenameindex
int getconenameindex
  (string somename,
   out int asgn)
void getconenameindex
  (string somename,
   out int asgn,
   out int index)

Checks whether the name somename has been assigned to any cone. If it has been assigned to a cone, then the index of the cone is reported.

Parameters:
 
  • somename (string) – The name which should be checked. (input)
  • asgn (int) – Is non-zero if the name somename is assigned to some cone. (output)
  • index (int) – If the name somename is assigned to some cone, then index is the index of the cone. (output)
Return:
 

(int) – If the name somename is assigned to some cone, then index is the index of the cone.

Groups:
 

Naming

Task.getconenamelen
int getconenamelen (int i)
void getconenamelen
  (int i,
   out int len)

Obtains the length of the name of a cone.

Parameters:
 
  • i (int) – Index of the cone. (input)
  • len (int) – Returns the length of the indicated name. (output)
Return:
 

(int) – Returns the length of the indicated name.

Groups:
 

Naming

Task.getconname
string getconname (int i)
void getconname
  (int i,
   StringBuilder name)

Obtains the name of a constraint.

Parameters:
 
  • i (int) – Index of the constraint. (input)
  • name (StringBuilder) – The required name. (output)
Return:
 

(string) – The required name.

Groups:
 

Naming

Task.getconnameindex
int getconnameindex
  (string somename,
   out int asgn)
void getconnameindex
  (string somename,
   out int asgn,
   out int index)

Checks whether the name somename has been assigned to any constraint. If so, the index of the constraint is reported.

Parameters:
 
  • somename (string) – The name which should be checked. (input)
  • asgn (int) – Is non-zero if the name somename is assigned to some constraint. (output)
  • index (int) – If the name somename is assigned to a constraint, then index is the index of the constraint. (output)
Return:
 

(int) – If the name somename is assigned to a constraint, then index is the index of the constraint.

Groups:
 

Naming

Task.getconnamelen
int getconnamelen (int i)
void getconnamelen
  (int i,
   out int len)

Obtains the length of the name of a constraint.

Parameters:
 
  • i (int) – Index of the constraint. (input)
  • len (int) – Returns the length of the indicated name. (output)
Return:
 

(int) – Returns the length of the indicated name.

Groups:
 

Naming

Task.getcslice
void getcslice
  (int first,
   int last,
   double[] c)

Obtains a sequence of elements in \(c\).

Parameters:
 
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • c (double[]) – Linear terms of the requested slice of the objective as a dense vector. The length is last-first. (output)
Groups:
 

Scalar variable data

Task.getdimbarvarj
int getdimbarvarj (int j)
void getdimbarvarj
  (int j,
   out int dimbarvarj)

Obtains the dimension of a symmetric matrix variable.

Parameters:
 
  • j (int) – Index of the semidefinite variable whose dimension is requested. (input)
  • dimbarvarj (int) – The dimension of the \(j\)-th semidefinite variable. (output)
Return:
 

(int) – The dimension of the \(j\)-th semidefinite variable.

Groups:
 

Symmetric matrix variable data

Task.getdouinf
double getdouinf (dinfitem whichdinf)
void getdouinf
  (dinfitem whichdinf,
   out double dvalue)

Obtains a double information item from the task information database.

Parameters:
 
  • whichdinf (dinfitem) – Specifies a double information item. (input)
  • dvalue (double) – The value of the required double information item. (output)
Return:
 

(double) – The value of the required double information item.

Groups:
 

Optimizer statistics

Task.getdouparam
double getdouparam (dparam param)
void getdouparam
  (dparam param,
   out double parvalue)

Obtains the value of a double parameter.

Parameters:
 
  • param (dparam) – Which parameter. (input)
  • parvalue (double) – Parameter value. (output)
Return:
 

(double) – Parameter value.

Groups:
 

Parameters (get)

Task.getdualobj
void getdualobj
  (soltype whichsol,
   out double dualobj)

Computes the dual objective value associated with the solution. Note that if the solution is a primal infeasibility certificate, then the fixed term in the objective value is not included.

Moreover, since there is no dual solution associated with an integer solution, an error will be reported if the dual objective value is requested for the integer solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • dualobj (double) – Objective value corresponding to the dual solution. (output)
Groups:
 

Solution information

Task.getdualsolutionnorms
void getdualsolutionnorms
  (soltype whichsol,
   out double nrmy,
   out double nrmslc,
   out double nrmsuc,
   out double nrmslx,
   out double nrmsux,
   out double nrmsnx,
   out double nrmbars)

Compute norms of the dual solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • nrmy (double) – The norm of the \(y\) vector. (output)
  • nrmslc (double) – The norm of the \(s_l^c\) vector. (output)
  • nrmsuc (double) – The norm of the \(s_u^c\) vector. (output)
  • nrmslx (double) – The norm of the \(s_l^x\) vector. (output)
  • nrmsux (double) – The norm of the \(s_u^x\) vector. (output)
  • nrmsnx (double) – The norm of the \(s_n^x\) vector. (output)
  • nrmbars (double) – The norm of the \(\barS\) vector. (output)
Groups:
 

Solution information

Task.getdviolbarvar
void getdviolbarvar
  (soltype whichsol,
   int[] sub,
   double[] viol)

Let \((\barS_j)^*\) be the value of variable \(\barS_j\) for the specified solution. Then the dual violation of the solution associated with variable \(\barS_j\) is given by

\[\max(-\lambda_{\min}(\barS_j),\ 0.0).\]

Both when the solution is a certificate of primal infeasibility and when it is dual feasible solution the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of \(\barX\) variables. (input)
  • viol (double[]) – viol[k] is the violation of the solution for the constraint \(\barS_{\mathtt{sub}[k]} \in \PSD\). (output)
Groups:
 

Solution information

Task.getdviolcon
void getdviolcon
  (soltype whichsol,
   int[] sub,
   double[] viol)

The violation of the dual solution associated with the \(i\)-th constraint is computed as follows

\[\max( \rho( (s_l^c)_i^*,(b_l^c)_i ),\ \rho( (s_u^c)_i^*, -(b_u^c)_i ),\ |-y_i+(s_l^c)_i^*-(s_u^c)_i^*| )\]

where

\[\begin{split}\rho(x,l) = \left\{ \begin{array}{ll} -x, & l > -\infty , \\ |x|, & \mbox{otherwise}.\\ \end{array} \right.\end{split}\]

Both when the solution is a certificate of primal infeasibility or it is a dual feasible solution the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of constraints. (input)
  • viol (double[]) – viol[k] is the violation of dual solution associated with the constraint sub[k]. (output)
Groups:
 

Solution information

Task.getdviolcones
void getdviolcones
  (soltype whichsol,
   int[] sub,
   double[] viol)

Let \((s_n^x)^*\) be the value of variable \((s_n^x)\) for the specified solution. For simplicity let us assume that \(s_n^x\) is a member of a quadratic cone, then the violation is computed as follows

\[\begin{split}\left\{ \begin{array}{ll} \max(0,(\|s_n^x\|_{2:n}^*-(s_n^x)_1^*) / \sqrt{2}, & (s_n^x)^* \geq -\|(s_n^x)_{2:n}^*\|, \\ \|(s_n^x)^*\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]

Both when the solution is a certificate of primal infeasibility or when it is a dual feasible solution the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of conic constraints. (input)
  • viol (double[]) – viol[k] is the violation of the dual solution associated with the conic constraint sub[k]. (output)
Groups:
 

Solution information

Task.getdviolvar
void getdviolvar
  (soltype whichsol,
   int[] sub,
   double[] viol)

The violation of the dual solution associated with the \(j\)-th variable is computed as follows

\[\max \left(\rho((s_l^x)_j^*,(b_l^x)_j),\ \rho((s_u^x)_j^*,-(b_u^x)_j),\ |\sum_{i=\idxbeg}^{\idxend{numcon}} a_{ij} y_i+(s_l^x)_j^*-(s_u^x)_j^* - \tau c_j| \right)\]

where

\[\begin{split}\rho(x,l) = \left\{ \begin{array}{ll} -x, & l > -\infty , \\ |x|, & \mbox{otherwise} \end{array} \right.\end{split}\]

and \(\tau=0\) if the solution is a certificate of primal infeasibility and \(\tau=1\) otherwise. The formula for computing the violation is only shown for the linear case but is generalized appropriately for the more general problems. Both when the solution is a certificate of primal infeasibility or when it is a dual feasible solution the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of \(x\) variables. (input)
  • viol (double[]) – viol[k] is the violation of dual solution associated with the variable sub[k]. (output)
Groups:
 

Solution information

Task.getinfeasiblesubproblem
Task getinfeasiblesubproblem (soltype whichsol)
void getinfeasiblesubproblem
  (soltype whichsol,
   out Task inftask)

Given the solution is a certificate of primal or dual infeasibility then a primal or dual infeasible subproblem is obtained respectively. The subproblem tends to be much smaller than the original problem and hence it is easier to locate the infeasibility inspecting the subproblem than the original problem.

For the procedure to be useful it is important to assign meaningful names to constraints, variables etc. in the original task because those names will be duplicated in the subproblem.

The function is only applicable to linear and conic quadratic optimization problems.

For more information see Section 15.2.

Parameters:
 
  • whichsol (soltype) – Which solution to use when determining the infeasible subproblem. (input)
  • inftask (Task) – A new task containing the infeasible subproblem. (output)
Return:
 

(Task) – A new task containing the infeasible subproblem.

Groups:
 

Infeasibility diagnostics

Task.getinfindex
void getinfindex
  (inftype inftype,
   string infname,
   out int infindex)

Obtains the index of a named information item.

Parameters:
 
  • inftype (inftype) – Type of the information item. (input)
  • infname (string) – Name of the information item. (input)
  • infindex (int) – The item index. (output)
Groups:
 

Optimizer statistics

Task.getintinf
int getintinf (iinfitem whichiinf)
void getintinf
  (iinfitem whichiinf,
   out int ivalue)

Obtains an integer information item from the task information database.

Parameters:
 
  • whichiinf (iinfitem) – Specifies an integer information item. (input)
  • ivalue (int) – The value of the required integer information item. (output)
Return:
 

(int) – The value of the required integer information item.

Groups:
 

Optimizer statistics

Task.getintparam
int getintparam (iparam param)
void getintparam
  (iparam param,
   out int parvalue)

Obtains the value of an integer parameter.

Parameters:
 
  • param (iparam) – Which parameter. (input)
  • parvalue (int) – Parameter value. (output)
Return:
 

(int) – Parameter value.

Groups:
 

Parameters (get)

Task.getlenbarvarj
long getlenbarvarj (int j)
void getlenbarvarj
  (int j,
   out long lenbarvarj)

Obtains the length of the \(j\)-th semidefinite variable i.e. the number of elements in the lower triangular part.

Parameters:
 
  • j (int) – Index of the semidefinite variable whose length if requested. (input)
  • lenbarvarj (long) – Number of scalar elements in the lower triangular part of the semidefinite variable. (output)
Return:
 

(long) – Number of scalar elements in the lower triangular part of the semidefinite variable.

Groups:
 

Scalar variable data

Task.getlintinf
long getlintinf (liinfitem whichliinf)
void getlintinf
  (liinfitem whichliinf,
   out long ivalue)

Obtains a long integer information item from the task information database.

Parameters:
 
  • whichliinf (liinfitem) – Specifies a long information item. (input)
  • ivalue (long) – The value of the required long integer information item. (output)
Return:
 

(long) – The value of the required long integer information item.

Groups:
 

Optimizer statistics

Task.getmaxnumanz
long getmaxnumanz ()
void getmaxnumanz (out long maxnumanz)

Obtains number of preallocated non-zeros in \(A\). When this number of non-zeros is reached MOSEK will automatically allocate more space for \(A\).

Parameters:
 maxnumanz (long) – Number of preallocated non-zero linear matrix elements. (output)
Return:
  (long) – Number of preallocated non-zero linear matrix elements.
Groups:
 Scalar variable data
Task.getmaxnumbarvar
int getmaxnumbarvar ()
void getmaxnumbarvar (out int maxnumbarvar)

Obtains maximum number of symmetric matrix variables for which space is currently preallocated.

Parameters:
 maxnumbarvar (int) – Maximum number of symmetric matrix variables for which space is currently preallocated. (output)
Return:
  (int) – Maximum number of symmetric matrix variables for which space is currently preallocated.
Groups:
 Symmetric matrix variable data
Task.getmaxnumcon
void getmaxnumcon (out int maxnumcon)

Obtains the number of preallocated constraints in the optimization task. When this number of constraints is reached MOSEK will automatically allocate more space for constraints.

Parameters:
 maxnumcon (int) – Number of preallocated constraints in the optimization task. (output)
Groups:
 Linear constraint data
Task.getmaxnumcone
void getmaxnumcone (out int maxnumcone)

Obtains the number of preallocated cones in the optimization task. When this number of cones is reached MOSEK will automatically allocate space for more cones.

Parameters:
 maxnumcone (int) – Number of preallocated conic constraints in the optimization task. (output)
Groups:
 Task management
Task.getmaxnumqnz
void getmaxnumqnz (out long maxnumqnz)

Obtains the number of preallocated non-zeros for \(Q\) (both objective and constraints). When this number of non-zeros is reached MOSEK will automatically allocate more space for \(Q\).

Parameters:
 maxnumqnz (long) – Number of non-zero elements preallocated in quadratic coefficient matrices. (output)
Groups:
 Scalar variable data
Task.getmaxnumvar
void getmaxnumvar (out int maxnumvar)

Obtains the number of preallocated variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.

Parameters:
 maxnumvar (int) – Number of preallocated variables in the optimization task. (output)
Groups:
 Scalar variable data
Task.getmemusage
void getmemusage
  (out long meminuse,
   out long maxmemuse)

Obtains information about the amount of memory used by a task.

Parameters:
 
  • meminuse (long) – Amount of memory currently used by the task. (output)
  • maxmemuse (long) – Maximum amount of memory used by the task until now. (output)
Groups:
 

Memory

Task.getnumanz
int getnumanz ()
void getnumanz (out int numanz)

Obtains the number of non-zeros in \(A\).

Parameters:
 numanz (int) – Number of non-zero elements in the linear constraint matrix. (output)
Return:
  (int) – Number of non-zero elements in the linear constraint matrix.
Groups:
 Scalar variable data
Task.getnumanz64
long getnumanz64 ()
void getnumanz64 (out long numanz)

Obtains the number of non-zeros in \(A\).

Parameters:
 numanz (long) – Number of non-zero elements in the linear constraint matrix. (output)
Return:
  (long) – Number of non-zero elements in the linear constraint matrix.
Groups:
 Scalar variable data
Task.getnumbarablocktriplets
long getnumbarablocktriplets ()
void getnumbarablocktriplets (out long num)

Obtains an upper bound on the number of elements in the block triplet form of \(\barA\).

Parameters:
 num (long) – An upper bound on the number of elements in the block triplet form of \(\barA.\) (output)
Return:
  (long) – An upper bound on the number of elements in the block triplet form of \(\barA.\)
Groups:
 Symmetric matrix variable data
Task.getnumbaranz
long getnumbaranz ()
void getnumbaranz (out long nz)

Get the number of nonzero elements in \(\barA\).

Parameters:
 nz (long) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero. (output)
Return:
  (long) – The number of nonzero block elements in \(\barA\) i.e. the number of \(\barA_{ij}\) elements that are nonzero.
Groups:
 Symmetric matrix variable data
Task.getnumbarcblocktriplets
long getnumbarcblocktriplets ()
void getnumbarcblocktriplets (out long num)

Obtains an upper bound on the number of elements in the block triplet form of \(\barC\).

Parameters:
 num (long) – An upper bound on the number of elements in the block triplet form of \(\barC.\) (output)
Return:
  (long) – An upper bound on the number of elements in the block triplet form of \(\barC.\)
Groups:
 Symmetric matrix variable data
Task.getnumbarcnz
long getnumbarcnz ()
void getnumbarcnz (out long nz)

Obtains the number of nonzero elements in \(\barC\).

Parameters:
 nz (long) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero. (output)
Return:
  (long) – The number of nonzeros in \(\barC\) i.e. the number of elements \(\barC_j\) that are nonzero.
Groups:
 Symmetric matrix variable data
Task.getnumbarvar
int getnumbarvar ()
void getnumbarvar (out int numbarvar)

Obtains the number of semidefinite variables.

Parameters:
 numbarvar (int) – Number of semidefinite variables in the problem. (output)
Return:
  (int) – Number of semidefinite variables in the problem.
Groups:
 Symmetric matrix variable data
Task.getnumcon
int getnumcon ()
void getnumcon (out int numcon)

Obtains the number of constraints.

Parameters:
 numcon (int) – Number of constraints. (output)
Return:
  (int) – Number of constraints.
Groups:
 Linear constraint data
Task.getnumcone
int getnumcone ()
void getnumcone (out int numcone)

Obtains the number of cones.

Parameters:
 numcone (int) – Number of conic constraints. (output)
Return:
  (int) – Number of conic constraints.
Groups:
 Conic constraint data
Task.getnumconemem
void getnumconemem
  (int k,
   out int nummem)

Obtains the number of members in a cone.

Parameters:
 
  • k (int) – Index of the cone. (input)
  • nummem (int) – Number of member variables in the cone. (output)
Groups:
 

Conic constraint data

Task.getnumintvar
void getnumintvar (out int numintvar)

Obtains the number of integer-constrained variables.

Parameters:
 numintvar (int) – Number of integer variables. (output)
Groups:
 Scalar variable data
Task.getnumparam
void getnumparam
  (parametertype partype,
   out int numparam)

Obtains the number of parameters of a given type.

Parameters:
 
  • partype (parametertype) – Parameter type. (input)
  • numparam (int) – The number of parameters of type partype. (output)
Groups:
 

Parameter management

Task.getnumqconknz
long getnumqconknz (int k)
void getnumqconknz
  (int k,
   out long numqcnz)

Obtains the number of non-zero quadratic terms in a constraint.

Parameters:
 
  • k (int) – Index of the constraint for which the number quadratic terms should be obtained. (input)
  • numqcnz (long) – Number of quadratic terms. (output)
Return:
 

(long) – Number of quadratic terms.

Groups:
 

Scalar variable data

Task.getnumqobjnz
long getnumqobjnz ()
void getnumqobjnz (out long numqonz)

Obtains the number of non-zero quadratic terms in the objective.

Parameters:
 numqonz (long) – Number of non-zero elements in the quadratic objective terms. (output)
Return:
  (long) – Number of non-zero elements in the quadratic objective terms.
Groups:
 Scalar variable data
Task.getnumsymmat
void getnumsymmat (out long num)

Obtains the number of symmetric matrices stored in the vector \(E\).

Parameters:
 num (long) – The number of symmetric sparse matrices. (output)
Groups:
 Scalar variable data
Task.getnumvar
int getnumvar ()
void getnumvar (out int numvar)

Obtains the number of variables.

Parameters:
 numvar (int) – Number of variables. (output)
Return:
  (int) – Number of variables.
Groups:
 Scalar variable data
Task.getobjname
string getobjname ()
void getobjname (StringBuilder objname)

Obtains the name assigned to the objective function.

Parameters:
 objname (StringBuilder) – Assigned the objective name. (output)
Return:
  (string) – Assigned the objective name.
Groups:
 Naming
Task.getobjnamelen
int getobjnamelen ()
void getobjnamelen (out int len)

Obtains the length of the name assigned to the objective function.

Parameters:
 len (int) – Assigned the length of the objective name. (output)
Return:
  (int) – Assigned the length of the objective name.
Groups:
 Naming
Task.getobjsense
objsense getobjsense ()
void getobjsense (out objsense sense)

Gets the objective sense of the task.

Parameters:
 sense (objsense) – The returned objective sense. (output)
Return:
  (objsense) – The returned objective sense.
Groups:
 Objective data
Task.getprimalobj
double getprimalobj (soltype whichsol)
void getprimalobj
  (soltype whichsol,
   out double primalobj)

Computes the primal objective value for the desired solution. Note that if the solution is an infeasibility certificate, then the fixed term in the objective is not included.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • primalobj (double) – Objective value corresponding to the primal solution. (output)
Return:
 

(double) – Objective value corresponding to the primal solution.

Groups:
 

Solution information

Task.getprimalsolutionnorms
void getprimalsolutionnorms
  (soltype whichsol,
   out double nrmxc,
   out double nrmxx,
   out double nrmbarx)

Compute norms of the primal solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • nrmxc (double) – The norm of the \(x^c\) vector. (output)
  • nrmxx (double) – The norm of the \(x\) vector. (output)
  • nrmbarx (double) – The norm of the \(\barX\) vector. (output)
Groups:
 

Solution information

Task.getprobtype
problemtype getprobtype ()
void getprobtype (out problemtype probtype)

Obtains the problem type.

Parameters:
 probtype (problemtype) – The problem type. (output)
Return:
  (problemtype) – The problem type.
Groups:
 Task diagnostics
Task.getprosta
prosta getprosta (soltype whichsol)
void getprosta
  (soltype whichsol,
   out prosta prosta)

Obtains the problem status.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • prosta (prosta) – Problem status. (output)
Return:
 

(prosta) – Problem status.

Groups:
 

Solution information

Task.getpviolbarvar
void getpviolbarvar
  (soltype whichsol,
   int[] sub,
   double[] viol)

Computes the primal solution violation for a set of semidefinite variables. Let \((\barX_j)^*\) be the value of the variable \(\barX_j\) for the specified solution. Then the primal violation of the solution associated with variable \(\barX_j\) is given by

\[\max(-\lambda_{\min}(\barX_j),\ 0.0).\]

Both when the solution is a certificate of dual infeasibility or when it is primal feasible the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of \(\barX\) variables. (input)
  • viol (double[]) – viol[k] is how much the solution violates the constraint \(\barX_{\mathtt{sub}[k]} \in \PSD\). (output)
Groups:
 

Solution information

Task.getpviolcon
void getpviolcon
  (soltype whichsol,
   int[] sub,
   double[] viol)

Computes the primal solution violation for a set of constraints. The primal violation of the solution associated with the \(i\)-th constraint is given by

\[\max(\tau l_i^c - (x_i^c)^*,\ (x_i^c)^* - \tau u_i^c),\ |\sum_{j=\idxbeg}^{\idxend{numvar}} a_{ij} x_j^* - x_i^c|)\]

where \(\tau=0\) if the solution is a certificate of dual infeasibility and \(\tau=1\) otherwise. Both when the solution is a certificate of dual infeasibility and when it is primal feasible the violation should be small. The above formula applies for the linear case but is appropriately generalized in other cases.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of constraints. (input)
  • viol (double[]) – viol[k] is the violation associated with the solution for the constraint sub[k]. (output)
Groups:
 

Solution information

Task.getpviolcones
void getpviolcones
  (soltype whichsol,
   int[] sub,
   double[] viol)

Computes the primal solution violation for a set of conic constraints. Let \(x^*\) be the value of the variable \(x\) for the specified solution. For simplicity let us assume that \(x\) is a member of a quadratic cone, then the violation is computed as follows

\[\begin{split}\left\{ \begin{array}{ll} \max(0,\|x_{2:n}\|-x_1) / \sqrt{2}, & x_1 \geq -\|x_{2:n}\|, \\ \|x\|, & \mbox{otherwise.} \end{array} \right.\end{split}\]

Both when the solution is a certificate of dual infeasibility or when it is primal feasible the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of conic constraints. (input)
  • viol (double[]) – viol[k] is the violation of the solution associated with the conic constraint number sub[k]. (output)
Groups:
 

Solution information

Task.getpviolvar
void getpviolvar
  (soltype whichsol,
   int[] sub,
   double[] viol)

Computes the primal solution violation associated to a set of variables. Let \(x_j^*\) be the value of \(x_j\) for the specified solution. Then the primal violation of the solution associated with variable \(x_j\) is given by

\[\max( \tau l_j^x - x_j^*,\ x_j^* - \tau u_j^x,\ 0).\]

where \(\tau=0\) if the solution is a certificate of dual infeasibility and \(\tau=1\) otherwise. Both when the solution is a certificate of dual infeasibility and when it is primal feasible the violation should be small.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sub (int[]) – An array of indexes of \(x\) variables. (input)
  • viol (double[]) – viol[k] is the violation associated with the solution for the variable \(x_\mathtt{sub[k]}\). (output)
Groups:
 

Solution information

Task.getqconk
long getqconk
  (int k,
   ref long qcsurp,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)
void getqconk
  (int k,
   ref long qcsurp,
   out long numqcnz,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)

Obtains all the quadratic terms in a constraint. The quadratic terms are stored sequentially in qcsubi, qcsubj, and qcval.

Parameters:
 
  • k (int) – Which constraint. (input)
  • qcsurp (long) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in qcsubi, qcsubj and qcval starting from position qcsurp away from the end of the arrays. On return qcsurp will be decremented by the total number of non-zeros written. (input/output)
  • qcsubi (int[]) – Row subscripts for quadratic constraint matrix. (output)
  • qcsubj (int[]) – Column subscripts for quadratic constraint matrix. (output)
  • qcval (double[]) – Quadratic constraint coefficient values. (output)
  • numqcnz (long) – Number of quadratic terms. (output)
Return:
 

(long) – Number of quadratic terms.

Groups:
 

Scalar variable data

Task.getqobj
void getqobj
  (ref long qosurp,
   out long numqonz,
   int[] qosubi,
   int[] qosubj,
   double[] qoval)

Obtains the quadratic terms in the objective. The required quadratic terms are stored sequentially in qosubi, qosubj, and qoval.

Parameters:
 
  • qosurp (long) – Surplus of subscript and coefficient arrays. The required entries are stored sequentially in qosubi, qosubj and qoval starting from position qosurp away from the end of the arrays. On return qosurp will be decremented by the total number of non-zeros written. (input/output)
  • numqonz (long) – Number of non-zero elements in the quadratic objective terms. (output)
  • qosubi (int[]) – Row subscripts for quadratic objective coefficients. (output)
  • qosubj (int[]) – Column subscripts for quadratic objective coefficients. (output)
  • qoval (double[]) – Quadratic objective coefficient values. (output)
Groups:
 

Scalar variable data

Task.getqobjij
void getqobjij
  (int i,
   int j,
   out double qoij)

Obtains one coefficient \(q_{ij}^o\) in the quadratic term of the objective.

Parameters:
 
  • i (int) – Row index of the coefficient. (input)
  • j (int) – Column index of coefficient. (input)
  • qoij (double) – The required coefficient. (output)
Groups:
 

Scalar variable data

Task.getreducedcosts
void getreducedcosts
  (soltype whichsol,
   int first,
   int last,
   double[] redcosts)

Computes the reduced costs for a slice of variables and returns them in the array redcosts i.e.

(1)\[\mathtt{redcosts}[j-\mathtt{first}] = (s_l^x)_j-(s_u^x)_j, ~j=\mathtt{first},\ldots,\mathtt{last}-1\]
Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – The index of the first variable in the sequence. (input)
  • last (int) – The index of the last variable in the sequence plus 1. (input)
  • redcosts (double[]) – The reduced costs for the required slice of variables. (output)
Groups:
 

Solution (get)

Task.getskc
void getskc
  (soltype whichsol,
   stakey[] skc)

Obtains the status keys for the constraints.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • skc (stakey[]) – Status keys for the constraints. (output)
Groups:
 

Solution (get)

Task.getskcslice
void getskcslice
  (soltype whichsol,
   int first,
   int last,
   stakey[] skc)

Obtains the status keys for a slice of the constraints.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • skc (stakey[]) – Status keys for the constraints. (output)
Groups:
 

Solution (get)

Task.getskx
void getskx
  (soltype whichsol,
   stakey[] skx)

Obtains the status keys for the scalar variables.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • skx (stakey[]) – Status keys for the variables. (output)
Groups:
 

Solution (get)

Task.getskxslice
void getskxslice
  (soltype whichsol,
   int first,
   int last,
   stakey[] skx)

Obtains the status keys for a slice of the scalar variables.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • skx (stakey[]) – Status keys for the variables. (output)
Groups:
 

Solution (get)

Task.getslc
void getslc
  (soltype whichsol,
   double[] slc)

Obtains the \(s_l^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (output)
Groups:
 

Solution (get)

Task.getslcslice
void getslcslice
  (soltype whichsol,
   int first,
   int last,
   double[] slc)

Obtains a slice of the \(s_l^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (output)
Groups:
 

Solution (get)

Task.getslx
void getslx
  (soltype whichsol,
   double[] slx)

Obtains the \(s_l^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (output)
Groups:
 

Solution (get)

Task.getslxslice
void getslxslice
  (soltype whichsol,
   int first,
   int last,
   double[] slx)

Obtains a slice of the \(s_l^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (output)
Groups:
 

Solution (get)

Task.getsnx
void getsnx
  (soltype whichsol,
   double[] snx)

Obtains the \(s_n^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • snx (double[]) – Dual variables corresponding to the conic constraints on the variables. (output)
Groups:
 

Solution (get)

Task.getsnxslice
void getsnxslice
  (soltype whichsol,
   int first,
   int last,
   double[] snx)

Obtains a slice of the \(s_n^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • snx (double[]) – Dual variables corresponding to the conic constraints on the variables. (output)
Groups:
 

Solution (get)

Task.getsolsta
solsta getsolsta (soltype whichsol)
void getsolsta
  (soltype whichsol,
   out solsta solsta)

Obtains the solution status.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • solsta (solsta) – Solution status. (output)
Return:
 

(solsta) – Solution status.

Groups:
 

Solution information

Task.getsolution
void getsolution
  (soltype whichsol,
   out prosta prosta,
   out solsta solsta,
   stakey[] skc,
   stakey[] skx,
   stakey[] skn,
   double[] xc,
   double[] xx,
   double[] y,
   double[] slc,
   double[] suc,
   double[] slx,
   double[] sux,
   double[] snx)

Obtains the complete solution.

Consider the case of linear programming. The primal problem is given by

\[\begin{split}\begin{array}{lccccl} \mbox{minimize} & & & c^T x+c^f & & \\ \mbox{subject to} & l^c & \leq & A x & \leq & u^c, \\ & l^x & \leq & x & \leq & u^x. \\ \end{array}\end{split}\]

and the corresponding dual problem is

\[\begin{split}\begin{array}{lccl} \mbox{maximize} & (l^c)^T s_l^c - (u^c)^T s_u^c & \\ & + (l^x)^T s_l^x - (u^x)^T s_u^x + c^f & \\ \mbox{subject to} & A^T y + s_l^x - s_u^x & = & c, \\ & -y + s_l^c - s_u^c & = & 0, \\ & s_l^c,s_u^c,s_l^x,s_u^x \geq 0. & & \\ \end{array}\end{split}\]

A conic optimization problem has the same primal variables as in the linear case. Recall that the dual of a conic optimization problem is given by:

\[\begin{split}\begin{array}{lccccc} \mbox{maximize} & (l^c)^T s_l^c - (u^c)^T s_u^c & & \\ & +(l^x)^T s_l^x - (u^x)^T s_u^x + c^f & & \\ \mbox{subject to} & A^T y + s_l^x - s_u^x + s_n^x & = & c, \\ & -y + s_l^c - s_u^c & = & 0, \\ & s_l^c,s_u^c,s_l^x,s_u^x & \geq & 0, \\ & s_n^x \in \K^* & & \\ \end{array}\end{split}\]

The mapping between variables and arguments to the function is as follows:

  • xx : Corresponds to variable \(x\) (also denoted \(x^x\)).
  • xc : Corresponds to \(x^c:=Ax\).
  • y : Corresponds to variable \(y\).
  • slc: Corresponds to variable \(s_l^c\).
  • suc: Corresponds to variable \(s_u^c\).
  • slx: Corresponds to variable \(s_l^x\).
  • sux: Corresponds to variable \(s_u^x\).
  • snx: Corresponds to variable \(s_n^x\).

The meaning of the values returned by this function depend on the solution status returned in the argument solsta. The most important possible values of solsta are:

In order to retrieve the primal and dual values of semidefinite variables see Task.getbarxj and Task.getbarsj.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • prosta (prosta) – Problem status. (output)
  • solsta (solsta) – Solution status. (output)
  • skc (stakey[]) – Status keys for the constraints. (output)
  • skx (stakey[]) – Status keys for the variables. (output)
  • skn (stakey[]) – Status keys for the conic constraints. (output)
  • xc (double[]) – Primal constraint solution. (output)
  • xx (double[]) – Primal variable solution. (output)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (output)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (output)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (output)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (output)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (output)
  • snx (double[]) – Dual variables corresponding to the conic constraints on the variables. (output)
Groups:
 

Solution (get)

Task.getsolutioni Deprecated
void getsolutioni
  (accmode accmode,
   int i,
   soltype whichsol,
   out stakey sk,
   out double x,
   out double sl,
   out double su,
   out double sn)

Obtains the primal and dual solution information for a single constraint or variable.

Parameters:
 
  • accmode (accmode) – Defines whether solution information for a constraint or for a variable is retrieved. (input)
  • i (int) – Index of the constraint or variable. (input)
  • whichsol (soltype) – Selects a solution. (input)
  • sk (stakey) – Status key of the constraint of variable. (output)
  • x (double) – Solution value of the primal variable. (output)
  • sl (double) – Solution value of the dual variable associated with the lower bound. (output)
  • su (double) – Solution value of the dual variable associated with the upper bound. (output)
  • sn (double) – Solution value of the dual variable associated with the cone constraint. (output)
Groups:
 

Solution (get)

Task.getsolutioninfo
void getsolutioninfo
  (soltype whichsol,
   out double pobj,
   out double pviolcon,
   out double pviolvar,
   out double pviolbarvar,
   out double pviolcone,
   out double pviolitg,
   out double dobj,
   out double dviolcon,
   out double dviolvar,
   out double dviolbarvar,
   out double dviolcone)

Obtains information about a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • pobj (double) – The primal objective value as computed by Task.getprimalobj. (output)
  • pviolcon (double) – Maximal primal violation of the solution associated with the \(x^c\) variables where the violations are computed by Task.getpviolcon. (output)
  • pviolvar (double) – Maximal primal violation of the solution for the \(x\) variables where the violations are computed by Task.getpviolvar. (output)
  • pviolbarvar (double) – Maximal primal violation of solution for the \(\barX\) variables where the violations are computed by Task.getpviolbarvar. (output)
  • pviolcone (double) – Maximal primal violation of solution for the conic constraints where the violations are computed by Task.getpviolcones. (output)
  • pviolitg (double) – Maximal violation in the integer constraints. The violation for an integer variable \(x_j\) is given by \(\min(x_j-\lfloor x_j \rfloor,\lceil x_j \rceil - x_j)\). This number is always zero for the interior-point and basic solutions. (output)
  • dobj (double) – Dual objective value as computed by Task.getdualobj. (output)
  • dviolcon (double) – Maximal violation of the dual solution associated with the \(x^c\) variable as computed by Task.getdviolcon. (output)
  • dviolvar (double) – Maximal violation of the dual solution associated with the \(x\) variable as computed by Task.getdviolvar. (output)
  • dviolbarvar (double) – Maximal violation of the dual solution associated with the \(\barS\) variable as computed by Task.getdviolbarvar. (output)
  • dviolcone (double) – Maximal violation of the dual solution associated with the dual conic constraints as computed by Task.getdviolcones. (output)
Groups:
 

Solution information

Task.getsolutionslice
void getsolutionslice
  (soltype whichsol,
   solitem solitem,
   int first,
   int last,
   double[] values)

Obtains a slice of one item from the solution. The format of the solution is exactly as in Task.getsolution. The parameter solitem determines which of the solution vectors should be returned.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • solitem (solitem) – Which part of the solution is required. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • values (double[]) – The values in the required sequence are stored sequentially in values. (output)
Groups:
 

Solution (get)

Task.getsparsesymmat
void getsparsesymmat
  (long idx,
   int[] subi,
   int[] subj,
   double[] valij)

Get a single symmetric matrix from the matrix store.

Parameters:
 
  • idx (long) – Index of the matrix to retrieve. (input)
  • subi (int[]) – Row subscripts of the matrix non-zero elements. (output)
  • subj (int[]) – Column subscripts of the matrix non-zero elements. (output)
  • valij (double[]) – Coefficients of the matrix non-zero elements. (output)
Groups:
 

Scalar variable data

Task.getstrparam
string getstrparam
  (sparam param,
   out int len)
void getstrparam
  (sparam param,
   out int len,
   StringBuilder parvalue)

Obtains the value of a string parameter.

Parameters:
 
  • param (sparam) – Which parameter. (input)
  • len (int) – The length of the parameter value. (output)
  • parvalue (StringBuilder) – Parameter value. (output)
Return:
 

(string) – Parameter value.

Groups:
 

Parameters (get)

Task.getstrparamlen
int getstrparamlen (sparam param)
void getstrparamlen
  (sparam param,
   out int len)

Obtains the length of a string parameter.

Parameters:
 
  • param (sparam) – Which parameter. (input)
  • len (int) – The length of the parameter value. (output)
Return:
 

(int) – The length of the parameter value.

Groups:
 

Parameters (get)

Task.getsuc
void getsuc
  (soltype whichsol,
   double[] suc)

Obtains the \(s_u^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (output)
Groups:
 

Solution (get)

Task.getsucslice
void getsucslice
  (soltype whichsol,
   int first,
   int last,
   double[] suc)

Obtains a slice of the \(s_u^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (output)
Groups:
 

Solution (get)

Task.getsux
void getsux
  (soltype whichsol,
   double[] sux)

Obtains the \(s_u^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (output)
Groups:
 

Solution (get)

Task.getsuxslice
void getsuxslice
  (soltype whichsol,
   int first,
   int last,
   double[] sux)

Obtains a slice of the \(s_u^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (output)
Groups:
 

Solution (get)

Task.getsymmatinfo
void getsymmatinfo
  (long idx,
   out int dim,
   out long nz,
   out symmattype type)

MOSEK maintains a vector denoted by \(E\) of symmetric data matrices. This function makes it possible to obtain important information about a single matrix in \(E\).

Parameters:
 
  • idx (long) – Index of the matrix for which information is requested. (input)
  • dim (int) – Returns the dimension of the requested matrix. (output)
  • nz (long) – Returns the number of non-zeros in the requested matrix. (output)
  • type (symmattype) – Returns the type of the requested matrix. (output)
Groups:
 

Scalar variable data

Task.gettaskname
string gettaskname ()
void gettaskname (StringBuilder taskname)

Obtains the name assigned to the task.

Parameters:
 taskname (StringBuilder) – Returns the task name. (output)
Return:
  (string) – Returns the task name.
Groups:
 Naming
Task.gettasknamelen
int gettasknamelen ()
void gettasknamelen (out int len)

Obtains the length the task name.

Parameters:
 len (int) – Returns the length of the task name. (output)
Return:
  (int) – Returns the length of the task name.
Groups:
 Naming
Task.getvarbound
void getvarbound
  (int i,
   out boundkey bk,
   out double bl,
   out double bu)

Obtains bound information for one variable.

Parameters:
 
  • i (int) – Index of the variable for which the bound information should be obtained. (input)
  • bk (boundkey) – Bound keys. (output)
  • bl (double) – Values for lower bounds. (output)
  • bu (double) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getvarboundslice
void getvarboundslice
  (int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Obtains bounds information for a slice of the variables.

Parameters:
 
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (output)
  • bl (double[]) – Values for lower bounds. (output)
  • bu (double[]) – Values for upper bounds. (output)
Groups:
 

Bound data

Task.getvarname
string getvarname (int j)
void getvarname
  (int j,
   StringBuilder name)

Obtains the name of a variable.

Parameters:
 
  • j (int) – Index of a variable. (input)
  • name (StringBuilder) – Returns the required name. (output)
Return:
 

(string) – Returns the required name.

Groups:
 

Naming

Task.getvarnameindex
int getvarnameindex
  (string somename,
   out int asgn)
void getvarnameindex
  (string somename,
   out int asgn,
   out int index)

Checks whether the name somename has been assigned to any variable. If so, the index of the variable is reported.

Parameters:
 
  • somename (string) – The name which should be checked. (input)
  • asgn (int) – Is non-zero if the name somename is assigned to a variable. (output)
  • index (int) – If the name somename is assigned to a variable, then index is the index of the variable. (output)
Return:
 

(int) – If the name somename is assigned to a variable, then index is the index of the variable.

Groups:
 

Naming

Task.getvarnamelen
int getvarnamelen (int i)
void getvarnamelen
  (int i,
   out int len)

Obtains the length of the name of a variable.

Parameters:
 
  • i (int) – Index of a variable. (input)
  • len (int) – Returns the length of the indicated name. (output)
Return:
 

(int) – Returns the length of the indicated name.

Groups:
 

Naming

Task.getvartype
variabletype getvartype (int j)
void getvartype
  (int j,
   out variabletype vartype)

Gets the variable type of one variable.

Parameters:
 
  • j (int) – Index of the variable. (input)
  • vartype (variabletype) – Variable type of the \(j\)-th variable. (output)
Return:
 

(variabletype) – Variable type of the \(j\)-th variable.

Groups:
 

Scalar variable data

Task.getvartypelist
void getvartypelist
  (int[] subj,
   variabletype[] vartype)

Obtains the variable type of one or more variables. Upon return vartype[k] is the variable type of variable subj[k].

Parameters:
 
  • subj (int[]) – A list of variable indexes. (input)
  • vartype (variabletype[]) – The variables types corresponding to the variables specified by subj. (output)
Groups:
 

Scalar variable data

Task.getxc
void getxc
  (soltype whichsol,
   double[] xc)

Obtains the \(x^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • xc (double[]) – Primal constraint solution. (output)
Groups:
 

Solution (get)

Task.getxcslice
void getxcslice
  (soltype whichsol,
   int first,
   int last,
   double[] xc)

Obtains a slice of the \(x^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • xc (double[]) – Primal constraint solution. (output)
Groups:
 

Solution (get)

Task.getxx
void getxx
  (soltype whichsol,
   double[] xx)

Obtains the \(x^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • xx (double[]) – Primal variable solution. (output)
Groups:
 

Solution (get)

Task.getxxslice
void getxxslice
  (soltype whichsol,
   int first,
   int last,
   double[] xx)

Obtains a slice of the \(x^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • xx (double[]) – Primal variable solution. (output)
Groups:
 

Solution (get)

Task.gety
void gety
  (soltype whichsol,
   double[] y)

Obtains the \(y\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (output)
Groups:
 

Solution (get)

Task.getyslice
void getyslice
  (soltype whichsol,
   int first,
   int last,
   double[] y)

Obtains a slice of the \(y\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (output)
Groups:
 

Solution (get)

Task.initbasissolve
void initbasissolve (int[] basis)

Prepare a task for use with the Task.solvewithbasis function.

This function should be called

If the basis is singular i.e. not invertible, then the error rescode.err_basis_singular is reported.

Parameters:
 basis (int[]) – The array of basis indexes to use. The array is interpreted as follows: If \(\mathtt{basis}[i] \leq \idxend{numcon}\), then \(x_{\mathtt{basis}[i]}^c\) is in the basis at position \(i\), otherwise \(x_{\mathtt{basis}[i]-\mathtt{numcon}}\) is in the basis at position \(i\). (output)
Groups:
 Basis matrix
Task.inputdata
void inputdata
  (int maxnumcon,
   int maxnumvar,
   double[] c,
   double cfix,
   int[] aptrb,
   int[] aptre,
   int[] asub,
   double[] aval,
   boundkey[] bkc,
   double[] blc,
   double[] buc,
   boundkey[] bkx,
   double[] blx,
   double[] bux)
void inputdata
  (int maxnumcon,
   int maxnumvar,
   double[] c,
   double cfix,
   long[] aptrb,
   long[] aptre,
   int[] asub,
   double[] aval,
   boundkey[] bkc,
   double[] blc,
   double[] buc,
   boundkey[] bkx,
   double[] blx,
   double[] bux)
void inputdata
  (int maxnumcon,
   int maxnumvar,
   int numcon,
   int numvar,
   double[] c,
   double cfix,
   long[] aptrb,
   long[] aptre,
   int[] asub,
   double[] aval,
   boundkey[] bkc,
   double[] blc,
   double[] buc,
   boundkey[] bkx,
   double[] blx,
   double[] bux)

Input the linear part of an optimization task in one function call.

Parameters:
 
  • maxnumcon (int) – Number of preallocated constraints in the optimization task. (input)
  • maxnumvar (int) – Number of preallocated variables in the optimization task. (input)
  • c (double[]) – Linear terms of the objective as a dense vector. The length is the number of variables. (input)
  • cfix (double) – Fixed term in the objective. (input)
  • aptrb (int[]) – Row or column start pointers. (input)
  • aptrb (long[]) – Row or column start pointers. (input)
  • aptre (int[]) – Row or column end pointers. (input)
  • aptre (long[]) – Row or column end pointers. (input)
  • asub (int[]) – Coefficient subscripts. (input)
  • aval (double[]) – Coefficient values. (input)
  • bkc (boundkey[]) – Bound keys for the constraints. (input)
  • blc (double[]) – Lower bounds for the constraints. (input)
  • buc (double[]) – Upper bounds for the constraints. (input)
  • bkx (boundkey[]) – Bound keys for the variables. (input)
  • blx (double[]) – Lower bounds for the variables. (input)
  • bux (double[]) – Upper bounds for the variables. (input)
  • numcon (int) – Number of constraints. (input)
  • numvar (int) – Number of variables. (input)
Groups:
 

Task management

Task.isdouparname
void isdouparname
  (string parname,
   out dparam param)

Checks whether parname is a valid double parameter name.

Parameters:
 
  • parname (string) – Parameter name. (input)
  • param (dparam) – Returns the parameter corresponding to the name, if one exists. (output)
Groups:
 

Parameter management

Task.isintparname
void isintparname
  (string parname,
   out iparam param)

Checks whether parname is a valid integer parameter name.

Parameters:
 
  • parname (string) – Parameter name. (input)
  • param (iparam) – Returns the parameter corresponding to the name, if one exists. (output)
Groups:
 

Parameter management

Task.isstrparname
void isstrparname
  (string parname,
   out sparam param)

Checks whether parname is a valid string parameter name.

Parameters:
 
  • parname (string) – Parameter name. (input)
  • param (sparam) – Returns the parameter corresponding to the name, if one exists. (output)
Groups:
 

Parameter management

Task.linkfiletostream
void linkfiletostream
  (streamtype whichstream,
   string filename,
   int append)

Directs all output from a task stream whichstream to a file filename.

Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • filename (string) – A valid file name. (input)
  • append (int) – If this argument is 0 the output file will be overwritten, otherwise it will be appended to. (input)
Groups:
 

Logging

Task.onesolutionsummary
void onesolutionsummary
  (streamtype whichstream,
   soltype whichsol)

Prints a short summary of a specified solution.

Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • whichsol (soltype) – Selects a solution. (input)
Groups:
 

Task diagnostics

Task.optimize
rescode optimize ()
void optimize (out rescode trmcode)

Calls the optimizer. Depending on the problem type and the selected optimizer this will call one of the optimizers in MOSEK. By default the interior point optimizer will be selected for continuous problems. The optimizer may be selected manually by setting the parameter iparam.optimizer.

Parameters:
 trmcode (rescode) – Is either rescode.ok or a termination response code. (output)
Return:
  (rescode) – Is either rescode.ok or a termination response code.
Groups:
 Optimization
Task.optimizermt
void optimizermt
  (string server,
   string port,
   out rescode trmcode)

Offload the optimization task to a solver server defined by server:port. The call will block until a result is available or the connection closes.

If the string parameter sparam.remote_access_token is not blank, it will be passed to the server as authentication.

Parameters:
 
  • server (string) – Name or IP address of the solver server. (input)
  • port (string) – Network port of the solver server. (input)
  • trmcode (rescode) – Is either rescode.ok or a termination response code. (output)
Task.optimizersummary
void optimizersummary (streamtype whichstream)

Prints a short summary with optimizer statistics from last optimization.

Parameters:
 whichstream (streamtype) – Index of the stream. (input)
Groups:
 Task diagnostics
Task.primalrepair
void primalrepair
  (double[] wlc,
   double[] wuc,
   double[] wlx,
   double[] wux)

The function repairs a primal infeasible optimization problem by adjusting the bounds on the constraints and variables where the adjustment is computed as the minimal weighted sum of relaxations to the bounds on the constraints and variables. Observe the function only repairs the problem but does not solve it. If an optimal solution is required the problem should be optimized after the repair.

The function is applicable to linear and conic problems possibly with integer variables.

Observe that when computing the minimal weighted relaxation the termination tolerance specified by the parameters of the task is employed. For instance the parameter iparam.mio_mode can be used to make MOSEK ignore the integer constraints during the repair which usually leads to a much faster repair. However, the drawback is of course that the repaired problem may not have an integer feasible solution.

Note the function modifies the task in place. If this is not desired, then apply the function to a cloned task.

Parameters:
 
  • wlc (double[]) – \((w_l^c)_i\) is the weight associated with relaxing the lower bound on constraint \(i\). If the weight is negative, then the lower bound is not relaxed. Moreover, if the argument is NULL, then all the weights are assumed to be \(1\). (input)
  • wuc (double[]) – \((w_u^c)_i\) is the weight associated with relaxing the upper bound on constraint \(i\). If the weight is negative, then the upper bound is not relaxed. Moreover, if the argument is NULL, then all the weights are assumed to be \(1\). (input)
  • wlx (double[]) – \((w_l^x)_j\) is the weight associated with relaxing the lower bound on variable \(j\). If the weight is negative, then the lower bound is not relaxed. Moreover, if the argument is NULL, then all the weights are assumed to be \(1\). (input)
  • wux (double[]) – \((w_l^x)_i\) is the weight associated with relaxing the upper bound on variable \(j\). If the weight is negative, then the upper bound is not relaxed. Moreover, if the argument is NULL, then all the weights are assumed to be \(1\). (input)
Groups:
 

Infeasibility diagnostics

Task.primalsensitivity
void primalsensitivity
  (int[] subi,
   mark[] marki,
   int[] subj,
   mark[] markj,
   double[] leftpricei,
   double[] rightpricei,
   double[] leftrangei,
   double[] rightrangei,
   double[] leftpricej,
   double[] rightpricej,
   double[] leftrangej,
   double[] rightrangej)
void primalsensitivity
  (int numi,
   int[] subi,
   mark[] marki,
   int numj,
   int[] subj,
   mark[] markj,
   double[] leftpricei,
   double[] rightpricei,
   double[] leftrangei,
   double[] rightrangei,
   double[] leftpricej,
   double[] rightpricej,
   double[] leftrangej,
   double[] rightrangej)

Calculates sensitivity information for bounds on variables and constraints. For details on sensitivity analysis, the definitions of shadow price and linearity interval and an example see Section 15.3.

The type of sensitivity analysis to be performed (basis or optimal partition) is controlled by the parameter iparam.sensitivity_type.

Parameters:
 
  • subi (int[]) – Indexes of constraints to analyze. (input)
  • marki (mark[]) – The value of marki[i] indicates for which bound of constraint subi[i] sensitivity analysis is performed. If marki[i] = mark.up the upper bound of constraint subi[i] is analyzed, and if marki[i] = mark.lo the lower bound is analyzed. If subi[i] is an equality constraint, either mark.lo or mark.up can be used to select the constraint for sensitivity analysis. (input)
  • subj (int[]) – Indexes of variables to analyze. (input)
  • markj (mark[]) – The value of markj[j] indicates for which bound of variable subj[j] sensitivity analysis is performed. If markj[j] = mark.up the upper bound of variable subj[j] is analyzed, and if markj[j] = mark.lo the lower bound is analyzed. If subj[j] is a fixed variable, either mark.lo or mark.up can be used to select the bound for sensitivity analysis. (input)
  • leftpricei (double[]) – leftpricei[i] is the left shadow price for the bound marki[i] of constraint subi[i]. (output)
  • rightpricei (double[]) – rightpricei[i] is the right shadow price for the bound marki[i] of constraint subi[i]. (output)
  • leftrangei (double[]) – leftrangei[i] is the left range \(\beta_1\) for the bound marki[i] of constraint subi[i]. (output)
  • rightrangei (double[]) – rightrangei[i] is the right range \(\beta_2\) for the bound marki[i] of constraint subi[i]. (output)
  • leftpricej (double[]) – leftpricej[j] is the left shadow price for the bound markj[j] of variable subj[j]. (output)
  • rightpricej (double[]) – rightpricej[j] is the right shadow price for the bound markj[j] of variable subj[j]. (output)
  • leftrangej (double[]) – leftrangej[j] is the left range \(\beta_1\) for the bound markj[j] of variable subj[j]. (output)
  • rightrangej (double[]) – rightrangej[j] is the right range \(\beta_2\) for the bound markj[j] of variable subj[j]. (output)
  • numi (int) – Number of bounds on constraints to be analyzed. Length of subi and marki. (input)
  • numj (int) – Number of bounds on variables to be analyzed. Length of subj and markj. (input)
Groups:
 

Sensitivity analysis

Task.printdata
void printdata
  (streamtype whichstream,
   int firsti,
   int lasti,
   int firstj,
   int lastj,
   int firstk,
   int lastk,
   int c,
   int qo,
   int a,
   int qc,
   int bc,
   int bx,
   int vartype,
   int cones)

Prints a part of the problem data to a stream. This function is normally used for debugging purposes only, e.g. to verify that the correct data has been inputted.

Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • firsti (int) – Index of first constraint for which data should be printed. (input)
  • lasti (int) – Index of last constraint plus 1 for which data should be printed. (input)
  • firstj (int) – Index of first variable for which data should be printed. (input)
  • lastj (int) – Index of last variable plus 1 for which data should be printed. (input)
  • firstk (int) – Index of first cone for which data should be printed. (input)
  • lastk (int) – Index of last cone plus 1 for which data should be printed. (input)
  • c (int) – If non-zero \(c\) is printed. (input)
  • qo (int) – If non-zero \(Q^o\) is printed. (input)
  • a (int) – If non-zero \(A\) is printed. (input)
  • qc (int) – If non-zero \(Q^k\) is printed for the relevant constraints. (input)
  • bc (int) – If non-zero the constraint bounds are printed. (input)
  • bx (int) – If non-zero the variable bounds are printed. (input)
  • vartype (int) – If non-zero the variable types are printed. (input)
  • cones (int) – If non-zero the conic data is printed. (input)
Groups:
 

Task diagnostics

Task.putacol
void putacol
  (int j,
   int[] subj,
   double[] valj)
void putacol
  (int j,
   int nzj,
   int[] subj,
   double[] valj)

Change one column of the linear constraint matrix \(A\). Resets all the elements in column \(j\) to zero and then sets

\[a_{\mathtt{subj}[k],\mathtt{j}} = \mathtt{valj}[k], \quad k=0,\ldots,\mathtt{nzj}-1.\]
Parameters:
 
  • j (int) – Index of a column in \(A\). (input)
  • subj (int[]) – Row indexes of non-zero values in column \(j\) of \(A\). (input)
  • valj (double[]) – New non-zero values of column \(j\) in \(A\). (input)
  • nzj (int) – Number of non-zeros in column \(j\) of \(A\). (input)
Groups:
 

Scalar variable data

Task.putacollist
void putacollist
  (int[] sub,
   long[] ptrb,
   long[] ptre,
   int[] asub,
   double[] aval)
void putacollist
  (int num,
   int[] sub,
   long[] ptrb,
   long[] ptre,
   int[] asub,
   double[] aval)

Change a set of columns in the linear constraint matrix \(A\) with data in sparse triplet format. The requested columns are set to zero and then updated with:

\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\idxbeg,\ldots,\idxend{num}\\ & a_{\mathtt{asub}[k],\mathtt{sub}[i]} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i],\ldots,\mathtt{ptre}[i]-1. \end{array}\end{split}\]
Parameters:
 
  • sub (int[]) – Indexes of columns that should be replaced, no duplicates. (input)
  • ptrb (long[]) – Array of pointers to the first element in each column. (input)
  • ptre (long[]) – Array of pointers to the last element plus one in each column. (input)
  • asub (int[]) – Row indexes of new elements. (input)
  • aval (double[]) – Coefficient values. (input)
  • num (int) – Number of columns of \(A\) to replace. (input)
Groups:
 

Scalar variable data

Task.putaij
void putaij
  (int i,
   int j,
   double aij)

Changes a coefficient in the linear coefficient matrix \(A\) using the method

\[a_{i,j} = \mathtt{aij}.\]
Parameters:
 
  • i (int) – Constraint (row) index. (input)
  • j (int) – Variable (column) index. (input)
  • aij (double) – New coefficient for \(a_{i,j}\). (input)
Groups:
 

Scalar variable data

Task.putaijlist
void putaijlist
  (int[] subi,
   int[] subj,
   double[] valij)
void putaijlist
  (long num,
   int[] subi,
   int[] subj,
   double[] valij)

Changes one or more coefficients in \(A\) using the method

\[a_{\mathtt{subi[k]},\mathtt{subj[k]}} = \mathtt{valij[k]}, \quad k=\idxbeg,\ldots,\idxend{num}.\]

Duplicates are not allowed.

Parameters:
 
  • subi (int[]) – Constraint (row) indices. (input)
  • subj (int[]) – Variable (column) indices. (input)
  • valij (double[]) – New coefficient values for \(a_{i,j}\). (input)
  • num (long) – Number of coefficients that should be changed. (input)
Groups:
 

Scalar variable data

Task.putarow
void putarow
  (int i,
   int[] subi,
   double[] vali)
void putarow
  (int i,
   int nzi,
   int[] subi,
   double[] vali)

Change one row of the linear constraint matrix \(A\). Resets all the elements in row \(i\) to zero and then sets

\[a_{\mathtt{i},\mathtt{subi}[k]} = \mathtt{vali}[k], \quad k=0,\ldots,\mathtt{nzi}-1.\]
Parameters:
 
  • i (int) – Index of a row in \(A\). (input)
  • subi (int[]) – Column indexes of non-zero values in row \(i\) of \(A\). (input)
  • vali (double[]) – New non-zero values of row \(i\) in \(A\). (input)
  • nzi (int) – Number of non-zeros in row \(i\) of \(A\). (input)
Groups:
 

Scalar variable data

Task.putarowlist
void putarowlist
  (int[] sub,
   long[] ptrb,
   long[] ptre,
   int[] asub,
   double[] aval)
void putarowlist
  (int num,
   int[] sub,
   long[] ptrb,
   long[] ptre,
   int[] asub,
   double[] aval)

Change a set of rows in the linear constraint matrix \(A\) with data in sparse triplet format. The requested rows are set to zero and then updated with:

\[\begin{split}\begin{array}{rl} \mathtt{for} & i=\idxbeg,\ldots,\idxend{num} \\ & a_{\mathtt{sub}[i],\mathtt{asub}[k]} = \mathtt{aval}[k],\quad k=\mathtt{ptrb}[i],\ldots,\mathtt{ptre}[i]-1. \end{array}\end{split}\]
Parameters:
 
  • sub (int[]) – Indexes of rows that should be replaced, no duplicates. (input)
  • ptrb (long[]) – Array of pointers to the first element in each row. (input)
  • ptre (long[]) – Array of pointers to the last element plus one in each row. (input)
  • asub (int[]) – Column indexes of new elements. (input)
  • aval (double[]) – Coefficient values. (input)
  • num (int) – Number of rows of \(A\) to replace. (input)
Groups:
 

Scalar variable data

Task.putbarablocktriplet
void putbarablocktriplet
  (long num,
   int[] subi,
   int[] subj,
   int[] subk,
   int[] subl,
   double[] valijkl)

Inputs the \(\barA\) matrix in block triplet form.

Parameters:
 
  • num (long) – Number of elements in the block triplet form. (input)
  • subi (int[]) – Constraint index. (input)
  • subj (int[]) – Symmetric matrix variable index. (input)
  • subk (int[]) – Block row index. (input)
  • subl (int[]) – Block column index. (input)
  • valijkl (double[]) – The numerical value associated with each block triplet. (input)
Groups:
 

Symmetric matrix variable data

Task.putbaraij
void putbaraij
  (int i,
   int j,
   long[] sub,
   double[] weights)

This function sets one element in the \(\barA\) matrix.

Each element in the \(\barA\) matrix is a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barA_{ij}\) is a symmetric matrix. By default all elements in \(\barA\) are 0, so only non-zero elements need be added. Setting the same element again will overwrite the earlier entry.

The symmetric matrices from \(E\) are defined separately using the function Task.appendsparsesymmat.

Parameters:
 
  • i (int) – Row index of \(\barA\). (input)
  • j (int) – Column index of \(\barA\). (input)
  • sub (long[]) – Indices in \(E\) of the matrices appearing in the weighted sum for \(\barA_{ij}\). (input)
  • weights (double[]) – weights[k] is the coefficient of the sub[k]-th element of \(E\) in the weighted sum forming \(\barA_{ij}\). (input)
Groups:
 

Symmetric matrix variable data

Task.putbarcblocktriplet
void putbarcblocktriplet
  (long num,
   int[] subj,
   int[] subk,
   int[] subl,
   double[] valjkl)

Inputs the \(\barC\) matrix in block triplet form.

Parameters:
 
  • num (long) – Number of elements in the block triplet form. (input)
  • subj (int[]) – Symmetric matrix variable index. (input)
  • subk (int[]) – Block row index. (input)
  • subl (int[]) – Block column index. (input)
  • valjkl (double[]) – The numerical value associated with each block triplet. (input)
Groups:
 

Symmetric matrix variable data

Task.putbarcj
void putbarcj
  (int j,
   long[] sub,
   double[] weights)

This function sets one entry in the \(\barC\) vector.

Each element in the \(\barC\) vector is a weighted sum of symmetric matrices from the symmetric matrix storage \(E\), so \(\barC_{j}\) is a symmetric matrix. By default all elements in \(\barC\) are 0, so only non-zero elements need be added. Setting the same element again will overwrite the earlier entry.

The symmetric matrices from \(E\) are defined separately using the function Task.appendsparsesymmat.

Parameters:
 
  • j (int) – Index of the element in \(\barC\) that should be changed. (input)
  • sub (long[]) – Indices in \(E\) of matrices appearing in the weighted sum for \(\barC_j\) (input)
  • weights (double[]) – weights[k] is the coefficient of the sub[k]-th element of \(E\) in the weighted sum forming \(\barC_j\). (input)
Groups:
 

Symmetric matrix variable data

Task.putbarsj
void putbarsj
  (soltype whichsol,
   int j,
   double[] barsj)

Sets the dual solution for a semidefinite variable.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • j (int) – Index of the semidefinite variable. (input)
  • barsj (double[]) – Value of \(\barS_j\). Format as in Task.getbarsj. (input)
Groups:
 

Solution (put)

Task.putbarvarname
void putbarvarname
  (int j,
   string name)

Sets the name of a semidefinite variable.

Parameters:
 
  • j (int) – Index of the variable. (input)
  • name (string) – The variable name. (input)
Groups:
 

Naming

Task.putbarxj
void putbarxj
  (soltype whichsol,
   int j,
   double[] barxj)

Sets the primal solution for a semidefinite variable.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • j (int) – Index of the semidefinite variable. (input)
  • barxj (double[]) – Value of \(\barX_j\). Format as in Task.getbarxj. (input)
Groups:
 

Solution (put)

Task.putbound Deprecated
void putbound
  (accmode accmode,
   int i,
   boundkey bk,
   double bl,
   double bu)

Changes the bound for either one constraint or one variable.

Parameters:
 
  • accmode (accmode) – Defines whether the bound for a constraint (accmode.con) or variable (accmode.var) is changed. (input)
  • i (int) – Index of the constraint or variable. (input)
  • bk (boundkey) – New bound key. (input)
  • bl (double) – New lower bound. (input)
  • bu (double) – New upper bound. (input)
Groups:
 

Bound data

Task.putboundlist Deprecated
void putboundlist
  (accmode accmode,
   int[] sub,
   boundkey[] bk,
   double[] bl,
   double[] bu)
void putboundlist
  (accmode accmode,
   int num,
   int[] sub,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Changes the bounds of constraints or variables.

Parameters:
 
  • accmode (accmode) – Defines whether bounds for constraints (accmode.con) or variables (accmode.var) are changed. (input)
  • sub (int[]) – Subscripts of the constraints or variables that should be changed. (input)
  • bk (boundkey[]) – Bound keys. (input)
  • bl (double[]) – Values for lower bounds. (input)
  • bu (double[]) – Values for upper bounds. (input)
  • num (int) – Number of bounds that should be changed. (input)
Groups:
 

Bound data

Task.putboundslice Deprecated
void putboundslice
  (accmode con,
   int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Changes the bounds for a slice of constraints or variables.

Parameters:
 
  • con (accmode) – Defines whether bounds for constraints (accmode.con) or variables (accmode.var) are changed. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (input)
  • bl (double[]) – Values for lower bounds. (input)
  • bu (double[]) – Values for upper bounds. (input)
Groups:
 

Bound data

Task.putcfix
void putcfix (double cfix)

Replaces the fixed term in the objective by a new one.

Parameters:
 cfix (double) – Fixed term in the objective. (input)
Groups:
 Objective data
Task.putcj
void putcj
  (int j,
   double cj)

Modifies one coefficient in the linear objective vector \(c\), i.e.

\[c_{\mathtt{j}} = \mathtt{cj}.\]

If the absolute value exceeds dparam.data_tol_c_huge an error is generated. If the absolute value exceeds dparam.data_tol_cj_large, a warning is generated, but the coefficient is inputted as specified.

Parameters:
 
  • j (int) – Index of the variable for which \(c\) should be changed. (input)
  • cj (double) – New value of \(c_j\). (input)
Groups:
 

Scalar variable data

Task.putclist
void putclist
  (int[] subj,
   double[] val)
void putclist
  (int num,
   int[] subj,
   double[] val)

Modifies the coefficients in the linear term \(c\) in the objective using the principle

\[c_{\mathtt{subj[t]}} = \mathtt{val[t]}, \quad t=\idxbeg,\ldots,\idxend{num}.\]

If a variable index is specified multiple times in subj only the last entry is used. Data checks are performed as in Task.putcj.

Parameters:
 
  • subj (int[]) – Indices of variables for which the coefficient in \(c\) should be changed. (input)
  • val (double[]) – New numerical values for coefficients in \(c\) that should be modified. (input)
  • num (int) – Number of coefficients that should be changed. (input)
Groups:
 

Scalar variable data

Task.putconbound
void putconbound
  (int i,
   boundkey bk,
   double bl,
   double bu)

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 than dparam.data_tol_bound_wrn, a warning will be displayed, but the bound is inputted as specified.

Parameters:
 
  • i (int) – Index of the constraint. (input)
  • bk (boundkey) – New bound key. (input)
  • bl (double) – New lower bound. (input)
  • bu (double) – New upper bound. (input)
Groups:
 

Bound data

Task.putconboundlist
void putconboundlist
  (int[] sub,
   boundkey[] bk,
   double[] bl,
   double[] bu)
void putconboundlist
  (int num,
   int[] sub,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Changes the bounds for a list of constraints. If multiple bound changes are specified for a constraint, then only the last change takes effect. Data checks are performed as in Task.putconbound.

Parameters:
 
  • sub (int[]) – List of constraint indexes. (input)
  • bk (boundkey[]) – Bound keys. (input)
  • bl (double[]) – Values for lower bounds. (input)
  • bu (double[]) – Values for upper bounds. (input)
  • num (int) – Number of bounds that should be changed. (input)
Groups:
 

Bound data

Task.putconboundslice
void putconboundslice
  (int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Changes the bounds for a slice of the constraints. Data checks are performed as in Task.putconbound.

Parameters:
 
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (input)
  • bl (double[]) – Values for lower bounds. (input)
  • bu (double[]) – Values for upper bounds. (input)
Groups:
 

Linear constraint data, Bound data

Task.putcone
void putcone
  (int k,
   conetype ct,
   double conepar,
   int[] submem)
void putcone
  (int k,
   conetype ct,
   double conepar,
   int nummem,
   int[] submem)

Replaces a conic constraint.

Parameters:
 
  • k (int) – Index of the cone. (input)
  • ct (conetype) – Specifies the type of the cone. (input)
  • conepar (double) – This argument is currently not used. It can be set to 0 (input)
  • submem (int[]) – Variable subscripts of the members in the cone. (input)
  • nummem (int) – Number of member variables in the cone. (input)
Groups:
 

Conic constraint data

Task.putconename
void putconename
  (int j,
   string name)

Sets the name of a cone.

Parameters:
 
  • j (int) – Index of the cone. (input)
  • name (string) – The name of the cone. (input)
Groups:
 

Naming

Task.putconname
void putconname
  (int i,
   string name)

Sets the name of a constraint.

Parameters:
 
  • i (int) – Index of the constraint. (input)
  • name (string) – The name of the constraint. (input)
Groups:
 

Naming

Task.putcslice
void putcslice
  (int first,
   int last,
   double[] slice)

Modifies a slice in the linear term \(c\) in the objective using the principle

\[c_{\mathtt{j}} = \mathtt{slice[j-first]}, \quad j=first,..,\idxend{last}\]

Data checks are performed as in Task.putcj.

Parameters:
 
  • first (int) – First element in the slice of \(c\). (input)
  • last (int) – Last element plus 1 of the slice in \(c\) to be changed. (input)
  • slice (double[]) – New numerical values for coefficients in \(c\) that should be modified. (input)
Groups:
 

Scalar variable data

Task.putdouparam
void putdouparam
  (dparam param,
   double parvalue)

Sets the value of a double parameter.

Parameters:
 
  • param (dparam) – Which parameter. (input)
  • parvalue (double) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putintparam
void putintparam
  (iparam param,
   int parvalue)

Sets the value of an integer parameter.

Parameters:
 
  • param (iparam) – Which parameter. (input)
  • parvalue (int) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putmaxnumanz
void putmaxnumanz (long maxnumanz)

Sets the number of preallocated non-zero entries in \(A\).

MOSEK stores only the non-zero elements in the linear coefficient matrix \(A\) and it cannot predict how much storage is required to store \(A\). Using this function it is possible to specify the number of non-zeros to preallocate for storing \(A\).

If the number of non-zeros in the problem is known, it is a good idea to set maxnumanz slightly larger than this number, otherwise a rough estimate can be used. In general, if \(A\) is inputted in many small chunks, setting this value may speed up the data input phase.

It is not mandatory to call this function, since MOSEK will reallocate internal structures whenever it is necessary.

The function call has no effect if both maxnumcon and maxnumvar are zero.

Parameters:
 maxnumanz (long) – Number of preallocated non-zeros in \(A\). (input)
Groups:
 Scalar variable data
Task.putmaxnumbarvar
void putmaxnumbarvar (int maxnumbarvar)

Sets the number of preallocated symmetric matrix variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.

It is not mandatory to call this function. It only gives a hint about the amount of data to preallocate for efficiency reasons.

Please note that maxnumbarvar must be larger than the current number of symmetric matrix variables in the task.

Parameters:
 maxnumbarvar (int) – Number of preallocated symmetric matrix variables. (input)
Groups:
 Symmetric matrix variable data
Task.putmaxnumcon
void putmaxnumcon (int maxnumcon)

Sets the number of preallocated constraints in the optimization task. When this number of constraints is reached MOSEK will automatically allocate more space for constraints.

It is never mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.

Please note that maxnumcon must be larger than the current number of constraints in the task.

Parameters:
 maxnumcon (int) – Number of preallocated constraints in the optimization task. (input)
Groups:
 Task management
Task.putmaxnumcone
void putmaxnumcone (int maxnumcone)

Sets the number of preallocated conic constraints in the optimization task. When this number of conic constraints is reached MOSEK will automatically allocate more space for conic constraints.

It is not mandatory to call this function, since MOSEK will reallocate any internal structures whenever it is required.

Please note that maxnumcon must be larger than the current number of conic constraints in the task.

Parameters:
 maxnumcone (int) – Number of preallocated conic constraints in the optimization task. (input)
Groups:
 Task management
Task.putmaxnumqnz
void putmaxnumqnz (long maxnumqnz)

Sets the number of preallocated non-zero entries in quadratic terms.

MOSEK stores only the non-zero elements in \(Q\). Therefore, MOSEK cannot predict how much storage is required to store \(Q\). Using this function it is possible to specify the number non-zeros to preallocate for storing \(Q\) (both objective and constraints).

It may be advantageous to reserve more non-zeros for \(Q\) than actually needed since it may improve the internal efficiency of MOSEK, however, it is never worthwhile to specify more than the double of the anticipated number of non-zeros in \(Q\).

It is not mandatory to call this function, since MOSEK will reallocate internal structures whenever it is necessary.

Parameters:
 maxnumqnz (long) – Number of non-zero elements preallocated in quadratic coefficient matrices. (input)
Groups:
 Scalar variable data
Task.putmaxnumvar
void putmaxnumvar (int maxnumvar)

Sets the number of preallocated variables in the optimization task. When this number of variables is reached MOSEK will automatically allocate more space for variables.

It is not mandatory to call this function. It only gives a hint about the amount of data to preallocate for efficiency reasons.

Please note that maxnumvar must be larger than the current number of variables in the task.

Parameters:
 maxnumvar (int) – Number of preallocated variables in the optimization task. (input)
Groups:
 Scalar variable data
Task.putnadouparam
void putnadouparam
  (string paramname,
   double parvalue)

Sets the value of a named double parameter.

Parameters:
 
  • paramname (string) – Name of a parameter. (input)
  • parvalue (double) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putnaintparam
void putnaintparam
  (string paramname,
   int parvalue)

Sets the value of a named integer parameter.

Parameters:
 
  • paramname (string) – Name of a parameter. (input)
  • parvalue (int) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putnastrparam
void putnastrparam
  (string paramname,
   string parvalue)

Sets the value of a named string parameter.

Parameters:
 
  • paramname (string) – Name of a parameter. (input)
  • parvalue (string) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putobjname
void putobjname (string objname)

Assigns a new name to the objective.

Parameters:
 objname (string) – Name of the objective. (input)
Groups:
 Naming
Task.putobjsense
void putobjsense (objsense sense)

Sets the objective sense of the task.

Parameters:
 sense (objsense) – The objective sense of the task. The values objsense.maximize and objsense.minimize mean that the problem is maximized or minimized respectively. (input)
Groups:
 Objective data
Task.putparam
void putparam
  (string parname,
   string parvalue)

Checks if parname is valid parameter name. If it is, the parameter is assigned the value specified by parvalue.

Parameters:
 
  • parname (string) – Parameter name. (input)
  • parvalue (string) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putqcon
void putqcon
  (int[] qcsubk,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)
void putqcon
  (int numqcnz,
   int[] qcsubk,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)

Replace all quadratic entries in the constraints. The list of constraints has the form

\[l_k^c \leq \half \sum_{i=0}^{\idxend{numvar}} \sum_{j=0}^{\idxend{numvar}} q_{ij}^k x_i x_j + \sum_{j=0}^{\idxend{numvar}} a_{kj} x_j \leq u_k^c, ~\ k=0,\ldots,m-1.\]

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{numqcnz}\).

Please note that:

  • For large problems it is essential for the efficiency that the function Task.putmaxnumqnz is employed to pre-allocate space.
  • Only the lower triangular parts should be specified because the \(Q\) matrices are symmetric. Specifying entries where \(i < j\) will result in an error.
  • Only non-zero elements should be specified.
  • The order in which the non-zero elements are specified is insignificant.
  • Duplicate elements are added together as shown above. Hence, it is usually not recommended to specify the same entry multiple times.

For a code example see Section 6.2

Parameters:
 
  • qcsubk (int[]) – Constraint subscripts for quadratic coefficients. (input)
  • qcsubi (int[]) – Row subscripts for quadratic constraint matrix. (input)
  • qcsubj (int[]) – Column subscripts for quadratic constraint matrix. (input)
  • qcval (double[]) – Quadratic constraint coefficient values. (input)
  • numqcnz (int) – Number of quadratic terms. (input)
Groups:
 

Scalar variable data

Task.putqconk
void putqconk
  (int k,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)
void putqconk
  (int k,
   int numqcnz,
   int[] qcsubi,
   int[] qcsubj,
   double[] qcval)

Replaces all the quadratic entries in one constraint. This function performs the same operations as Task.putqcon but only with respect to constraint number k and it does not modify the other constraints. See the description of Task.putqcon for definitions and important remarks.

Parameters:
 
  • k (int) – The constraint in which the new \(Q\) elements are inserted. (input)
  • qcsubi (int[]) – Row subscripts for quadratic constraint matrix. (input)
  • qcsubj (int[]) – Column subscripts for quadratic constraint matrix. (input)
  • qcval (double[]) – Quadratic constraint coefficient values. (input)
  • numqcnz (int) – Number of quadratic terms. (input)
Groups:
 

Scalar variable data

Task.putqobj
void putqobj
  (int[] qosubi,
   int[] qosubj,
   double[] qoval)
void putqobj
  (int numqonz,
   int[] qosubi,
   int[] qosubj,
   double[] qoval)

Replace all quadratic terms in the objective. If the objective has the form

\[\half \sum_{i=0}^{\idxend{numvar}} \sum_{j=0}^{\idxend{numvar}} q_{ij}^o x_i x_j + \sum_{j=0}^{\idxend{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{numqonz}\).

See the description of Task.putqcon for important remarks and example.

Parameters:
 
  • qosubi (int[]) – Row subscripts for quadratic objective coefficients. (input)
  • qosubj (int[]) – Column subscripts for quadratic objective coefficients. (input)
  • qoval (double[]) – Quadratic objective coefficient values. (input)
  • numqonz (int) – Number of non-zero elements in the quadratic objective terms. (input)
Groups:
 

Scalar variable data

Task.putqobjij
void putqobjij
  (int i,
   int j,
   double qoij)

Replaces one coefficient in the quadratic term in the objective. The function performs the assignment

\[q_{ij}^o = q_{ji}^o = \mathtt{qoij}.\]

Only the elements in the lower triangular part are accepted. Setting \(q_{ij}\) with \(j>i\) will cause an error.

Please note that replacing all quadratic elements one by one is more computationally expensive than replacing them all at once. Use Task.putqobj instead whenever possible.

Parameters:
 
  • i (int) – Row index for the coefficient to be replaced. (input)
  • j (int) – Column index for the coefficient to be replaced. (input)
  • qoij (double) – The new value for \(q_{ij}^o\). (input)
Groups:
 

Scalar variable data

Task.putskc
void putskc
  (soltype whichsol,
   stakey[] skc)

Sets the status keys for the constraints.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • skc (stakey[]) – Status keys for the constraints. (input)
Groups:
 

Solution (put)

Task.putskcslice
void putskcslice
  (soltype whichsol,
   int first,
   int last,
   stakey[] skc)

Sets the status keys for a slice of the constraints.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • skc (stakey[]) – Status keys for the constraints. (input)
Groups:
 

Solution (put)

Task.putskx
void putskx
  (soltype whichsol,
   stakey[] skx)

Sets the status keys for the scalar variables.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • skx (stakey[]) – Status keys for the variables. (input)
Groups:
 

Solution (put)

Task.putskxslice
void putskxslice
  (soltype whichsol,
   int first,
   int last,
   stakey[] skx)

Sets the status keys for a slice of the variables.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • skx (stakey[]) – Status keys for the variables. (input)
Groups:
 

Solution (put)

Task.putslc
void putslc
  (soltype whichsol,
   double[] slc)

Sets the \(s_l^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (input)
Groups:
 

Solution (put)

Task.putslcslice
void putslcslice
  (soltype whichsol,
   int first,
   int last,
   double[] slc)

Sets a slice of the \(s_l^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (input)
Groups:
 

Solution (put)

Task.putslx
void putslx
  (soltype whichsol,
   double[] slx)

Sets the \(s_l^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (input)
Groups:
 

Solution (put)

Task.putslxslice
void putslxslice
  (soltype whichsol,
   int first,
   int last,
   double[] slx)

Sets a slice of the \(s_l^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (input)
Groups:
 

Solution (put)

Task.putsnx
void putsnx
  (soltype whichsol,
   double[] sux)

Sets the \(s_n^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (input)
Groups:
 

Solution (put)

Task.putsnxslice
void putsnxslice
  (soltype whichsol,
   int first,
   int last,
   double[] snx)

Sets a slice of the \(s_n^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • snx (double[]) – Dual variables corresponding to the conic constraints on the variables. (input)
Groups:
 

Solution (put)

Task.putsolution
void putsolution
  (soltype whichsol,
   stakey[] skc,
   stakey[] skx,
   stakey[] skn,
   double[] xc,
   double[] xx,
   double[] y,
   double[] slc,
   double[] suc,
   double[] slx,
   double[] sux,
   double[] snx)

Inserts a solution into the task.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • skc (stakey[]) – Status keys for the constraints. (input)
  • skx (stakey[]) – Status keys for the variables. (input)
  • skn (stakey[]) – Status keys for the conic constraints. (input)
  • xc (double[]) – Primal constraint solution. (input)
  • xx (double[]) – Primal variable solution. (input)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (input)
  • slc (double[]) – Dual variables corresponding to the lower bounds on the constraints. (input)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (input)
  • slx (double[]) – Dual variables corresponding to the lower bounds on the variables. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (input)
  • snx (double[]) – Dual variables corresponding to the conic constraints on the variables. (input)
Groups:
 

Solution (put)

Task.putsolutioni Deprecated
void putsolutioni
  (accmode accmode,
   int i,
   soltype whichsol,
   stakey sk,
   double x,
   double sl,
   double su,
   double sn)

Sets the primal and dual solution information for a single constraint or variable.

Parameters:
 
  • accmode (accmode) – Defines whether solution information for a constraint (accmode.con) or for a variable (accmode.var) is modified. (input)
  • i (int) – Index of the constraint or variable. (input)
  • whichsol (soltype) – Selects a solution. (input)
  • sk (stakey) – Status key of the constraint or variable. (input)
  • x (double) – Solution value of the primal constraint or variable. (input)
  • sl (double) – Solution value of the dual variable associated with the lower bound. (input)
  • su (double) – Solution value of the dual variable associated with the upper bound. (input)
  • sn (double) – Solution value of the dual variable associated with the conic constraint. (input)
Groups:
 

Solution (put)

Task.putsolutionyi
void putsolutionyi
  (int i,
   soltype whichsol,
   double y)

Inputs the dual variable of a solution.

Parameters:
 
  • i (int) – Index of the dual variable. (input)
  • whichsol (soltype) – Selects a solution. (input)
  • y (double) – Solution value of the dual variable. (input)
Task.putstrparam
void putstrparam
  (sparam param,
   string parvalue)

Sets the value of a string parameter.

Parameters:
 
  • param (sparam) – Which parameter. (input)
  • parvalue (string) – Parameter value. (input)
Groups:
 

Parameters (put)

Task.putsuc
void putsuc
  (soltype whichsol,
   double[] suc)

Sets the \(s_u^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (input)
Groups:
 

Solution (put)

Task.putsucslice
void putsucslice
  (soltype whichsol,
   int first,
   int last,
   double[] suc)

Sets a slice of the \(s_u^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • suc (double[]) – Dual variables corresponding to the upper bounds on the constraints. (input)
Groups:
 

Solution (put)

Task.putsux
void putsux
  (soltype whichsol,
   double[] sux)

Sets the \(s_u^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (input)
Groups:
 

Solution (put)

Task.putsuxslice
void putsuxslice
  (soltype whichsol,
   int first,
   int last,
   double[] sux)

Sets a slice of the \(s_u^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • sux (double[]) – Dual variables corresponding to the upper bounds on the variables. (input)
Groups:
 

Solution (put)

Task.puttaskname
void puttaskname (string taskname)

Assigns a new name to the task.

Parameters:
 taskname (string) – Name assigned to the task. (input)
Groups:
 Naming
Task.putvarbound
void putvarbound
  (int j,
   boundkey bk,
   double bl,
   double bu)

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 than dparam.data_tol_bound_wrn, a warning will be displayed, but the bound is inputted as specified.

Parameters:
 
  • j (int) – Index of the variable. (input)
  • bk (boundkey) – New bound key. (input)
  • bl (double) – New lower bound. (input)
  • bu (double) – New upper bound. (input)
Groups:
 

Bound data

Task.putvarboundlist
void putvarboundlist
  (int[] sub,
   boundkey[] bkx,
   double[] blx,
   double[] bux)
void putvarboundlist
  (int num,
   int[] sub,
   boundkey[] bkx,
   double[] blx,
   double[] bux)

Changes the bounds for one or more variables. If multiple bound changes are specified for a variable, then only the last change takes effect. Data checks are performed as in Task.putvarbound.

Parameters:
 
  • sub (int[]) – List of variable indexes. (input)
  • bkx (boundkey[]) – Bound keys for the variables. (input)
  • blx (double[]) – Lower bounds for the variables. (input)
  • bux (double[]) – Upper bounds for the variables. (input)
  • num (int) – Number of bounds that should be changed. (input)
Groups:
 

Bound data

Task.putvarboundslice
void putvarboundslice
  (int first,
   int last,
   boundkey[] bk,
   double[] bl,
   double[] bu)

Changes the bounds for a slice of the variables. Data checks are performed as in Task.putvarbound.

Parameters:
 
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • bk (boundkey[]) – Bound keys. (input)
  • bl (double[]) – Values for lower bounds. (input)
  • bu (double[]) – Values for upper bounds. (input)
Groups:
 

Scalar variable data

Task.putvarname
void putvarname
  (int j,
   string name)

Sets the name of a variable.

Parameters:
 
  • j (int) – Index of the variable. (input)
  • name (string) – The variable name. (input)
Groups:
 

Naming

Task.putvartype
void putvartype
  (int j,
   variabletype vartype)

Sets the variable type of one variable.

Parameters:
 
  • j (int) – Index of the variable. (input)
  • vartype (variabletype) – The new variable type. (input)
Groups:
 

Scalar variable data

Task.putvartypelist
void putvartypelist
  (int[] subj,
   variabletype[] vartype)
void putvartypelist
  (int num,
   int[] subj,
   variabletype[] vartype)

Sets the variable type for one or more variables. If the same index is specified multiple times in subj only the last entry takes effect.

Parameters:
 
  • subj (int[]) – A list of variable indexes for which the variable type should be changed. (input)
  • vartype (variabletype[]) – A list of variable types that should be assigned to the variables specified by subj. (input)
  • num (int) – Number of variables for which the variable type should be set. (input)
Groups:
 

Scalar variable data

Task.putxc
void putxc
  (soltype whichsol,
   double[] xc)

Sets the \(x^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • xc (double[]) – Primal constraint solution. (output)
Groups:
 

Solution (put)

Task.putxcslice
void putxcslice
  (soltype whichsol,
   int first,
   int last,
   double[] xc)

Sets a slice of the \(x^c\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • xc (double[]) – Primal constraint solution. (input)
Groups:
 

Solution (put)

Task.putxx
void putxx
  (soltype whichsol,
   double[] xx)

Sets the \(x^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • xx (double[]) – Primal variable solution. (input)
Groups:
 

Solution (put)

Task.putxxslice
void putxxslice
  (soltype whichsol,
   int first,
   int last,
   double[] xx)

Obtains a slice of the \(x^x\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • xx (double[]) – Primal variable solution. (input)
Groups:
 

Solution (put)

Task.puty
void puty
  (soltype whichsol,
   double[] y)

Sets the \(y\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (input)
Groups:
 

Solution (put)

Task.putyslice
void putyslice
  (soltype whichsol,
   int first,
   int last,
   double[] y)

Sets a slice of the \(y\) vector for a solution.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • first (int) – First index in the sequence. (input)
  • last (int) – Last index plus 1 in the sequence. (input)
  • y (double[]) – Vector of dual variables corresponding to the constraints. (input)
Groups:
 

Solution (put)

Task.readdata
void readdata (string filename)

Reads an optimization problem and associated data from a file.

Parameters:
 filename (string) – A valid file name. (input)
Groups:
 Data file
Task.readdataformat
void readdataformat
  (string filename,
   int format,
   int compress)

Reads an optimization problem and associated data from a file.

Parameters:
 
  • filename (string) – A valid file name. (input)
  • format (int) – File data format. (input)
  • compress (int) – File compression type. (input)
Groups:
 

Data file

Task.readparamfile
void readparamfile (string filename)

Reads MOSEK parameters from a file. Data is read from the file filename if it is a nonempty string. Otherwise data is read from the file specified by sparam.param_read_file_name.

Parameters:
 filename (string) – A valid file name. (input)
Groups:
 Data file
Task.readsolution
void readsolution
  (soltype whichsol,
   string filename)

Reads a solution file and inserts it as a specified solution in the task. Data is read from the file filename if it is a nonempty string. Otherwise data is read from one of the files specified by sparam.bas_sol_file_name, sparam.itr_sol_file_name or sparam.int_sol_file_name depending on which solution is chosen.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • filename (string) – A valid file name. (input)
Groups:
 

Data file

Task.readsummary
void readsummary (streamtype whichstream)

Prints a short summary of last file that was read.

Parameters:
 whichstream (streamtype) – Index of the stream. (input)
Groups:
 Task diagnostics
Task.readtask
void readtask (string filename)

Load task data from a file, replacing any data that already exists in the task object. All problem data, parameters and other settings are resorted, but if the file contains solutions, the solution status after loading a file is set to unknown, even if it was optimal or otherwise well-defined when the file was dumped.

See section 17.6 for a description of the Task format.

Parameters:
 filename (string) – A valid file name. (input)
Task.removebarvars
void removebarvars (int[] subset)
void removebarvars
  (int num,
   int[] subset)

The function removes a subset of the symmetric matrices from the optimization task. This implies that the remaining symmetric matrices are renumbered.

Parameters:
 
  • subset (int[]) – Indexes of symmetric matrices which should be removed. (input)
  • num (int) – Number of symmetric matrices which should be removed. (input)
Groups:
 

Symmetric matrix variable data

Task.removecones
void removecones (int[] subset)

Removes a number of conic constraints from the problem. This implies that the remaining conic constraints are renumbered. In general, it is much more efficient to remove a cone with a high index than a low index.

Parameters:
 subset (int[]) – Indexes of cones which should be removed. (input)
Groups:
 Conic constraint data
Task.removecons
void removecons (int[] subset)
void removecons
  (int num,
   int[] subset)

The function removes a subset of the constraints from the optimization task. This implies that the remaining constraints are renumbered.

Parameters:
 
  • subset (int[]) – Indexes of constraints which should be removed. (input)
  • num (int) – Number of constraints which should be removed. (input)
Groups:
 

Linear constraint data

Task.removevars
void removevars (int[] subset)
void removevars
  (int num,
   int[] subset)

The function removes a subset of the variables from the optimization task. This implies that the remaining variables are renumbered.

Parameters:
 
  • subset (int[]) – Indexes of variables which should be removed. (input)
  • num (int) – Number of variables which should be removed. (input)
Groups:
 

Scalar variable data

Task.resizetask
void resizetask
  (int maxnumcon,
   int maxnumvar,
   int maxnumcone,
   long maxnumanz,
   long maxnumqnz)

Sets the amount of preallocated space assigned for each type of data in an optimization task.

It is never mandatory to call this function, since it only gives a hint about the amount of data to preallocate for efficiency reasons.

Please note that the procedure is destructive in the sense that all existing data stored in the task is destroyed.

Parameters:
 
  • maxnumcon (int) – New maximum number of constraints. (input)
  • maxnumvar (int) – New maximum number of variables. (input)
  • maxnumcone (int) – New maximum number of cones. (input)
  • maxnumanz (long) – New maximum number of non-zeros in \(A\). (input)
  • maxnumqnz (long) – New maximum number of non-zeros in all \(Q\) matrices. (input)
Task.sensitivityreport
void sensitivityreport (streamtype whichstream)

Reads a sensitivity format file from a location given by sparam.sensitivity_file_name and writes the result to the stream whichstream. If sparam.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:
 Sensitivity analysis
Task.set_InfoCallback
void set_InfoCallback (DataCallback callback)

Receive callbacks with solver status and information during optimization.

Parameters:
 callback (DataCallback) – The callback object. (input)
Task.set_ItgSolutionCallback
void set_ItgSolutionCallback (ItgSolutionCallback callback)

Receive callbacks with solution updates from the mixed-integer optimizer.

Parameters:
 callback (ItgSolutionCallback) – The callback object. (input)
Task.set_Progress
void set_Progress (Progress callback)

Receive callbacks about current status of the solver during optimization.

Parameters:
 callback (Progress) – The callback object. (input)
Task.set_Stream
void set_Stream
  (streamtype whichstream,
   Stream callback)

Directs all output from a task stream to a callback object.

Parameters:
 
  • whichstream (streamtype) – Index of the stream. (input)
  • callback (Stream) – The callback object. (input)
Task.setdefaults
void setdefaults ()

Resets all the parameters to their default values.

Groups:
 Parameter management
Task.solutiondef
int solutiondef (soltype whichsol)
void solutiondef
  (soltype whichsol,
   out int isdef)

Checks whether a solution is defined.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • isdef (int) – Is non-zero if the requested solution is defined. (output)
Return:
 

(int) – Is non-zero if the requested solution is defined.

Groups:
 

Solution information

Task.solutionsummary
void solutionsummary (streamtype whichstream)

Prints a short summary of the current solutions.

Parameters:
 whichstream (streamtype) – Index of the stream. (input)
Groups:
 Task diagnostics
Task.solvewithbasis
void solvewithbasis
  (int transp,
   ref int numnz,
   int[] sub,
   double[] val)

If a basic solution is available, then exactly \(numcon\) basis variables are defined. These \(numcon\) basis variables are denoted the basis. Associated with the basis is a basis matrix denoted \(B\). This function solves either the linear equation system

(2)\[B \barX = b\]

or the system

(3)\[B^T \barX = b\]

for the unknowns \(\barX\), with \(b\) being a user-defined vector. In order to make sense of the solution \(\barX\) it is important to know the ordering of the variables in the basis because the ordering specifies how \(B\) is constructed. When calling Task.initbasissolve an ordering of the basis variables is obtained, which can be used to deduce how MOSEK has constructed \(B\). Indeed if the \(k\)-th basis variable is variable \(x_j\) it implies that

\[B_{i,k} = A_{i,j}, ~i=\idxbeg,\ldots,\idxend{numcon}.\]

Otherwise if the \(k\)-th basis variable is variable \(x_j^c\) it implies that

\[\begin{split}B_{i,k} = \left\{ \begin{array}{ll} -1, & i = j, \\ 0 , & i \neq j. \\ \end{array} \right.\end{split}\]

The function Task.initbasissolve must be called before a call to this function. Please note that this function exploits the sparsity in the vector \(b\) to speed up the computations.

Parameters:
 
  • transp (int) – If this argument is zero, then (2) is solved, if non-zero then (3) is solved. (input)
  • numnz (int) – As input it is the number of non-zeros in \(b\). As output it is the number of non-zeros in \(\barX\). (input/output)
  • sub (int[]) – As input it contains the positions of non-zeros in \(b\). As output it contains the positions of the non-zeros in \(\barX\). It must have room for \(numcon\) elements. (input/output)
  • val (double[]) – As input it is the vector \(b\) as a dense vector (although the positions of non-zeros are specified in sub it is required that \(\mathtt{val}[i] = 0\) when \(b[i] = 0\)). As output val is the vector \(\barX\) as a dense vector. It must have length \(numcon\). (input/output)
Groups:
 

Basis matrix

Task.strtoconetype
void strtoconetype
  (string str,
   out conetype conetype)

Obtains cone type code corresponding to a cone type string.

Parameters:
 
  • str (string) – String corresponding to the cone type code conetype. (input)
  • conetype (conetype) – The cone type corresponding to the string str. (output)
Task.strtosk
void strtosk
  (string str,
   out int sk)

Obtains the status key corresponding to an explanatory string.

Parameters:
 
  • str (string) – Status key string. (input)
  • sk (int) – Status key corresponding to the string. (output)
Task.toconic
void toconic ()

This function tries to reformulate a given Quadratically Constrained Quadratic Optimization problem (QCQP) 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.updatesolutioninfo
void updatesolutioninfo (soltype whichsol)

Update the information items related to the solution.

Parameters:
 whichsol (soltype) – Selects a solution. (input)
Groups:
 Task diagnostics
Task.writedata
void writedata (string filename)

Writes problem data associated with the optimization task to a file in one of the supported formats. See Section 17 for the complete list.

By default the data file format is determined by the file name extension. This behaviour can be overridden by setting the iparam.write_data_format parameter. To write in compressed format append the extension .gz. E.g to write a gzip compressed MPS file use the extension mps.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 to onoffkey.on.

Data is written to the file filename if it is a nonempty string. Otherwise data is written to the file specified by sparam.data_file_name.

Please note that if a general nonlinear function appears in the problem then such function cannot be written to file and MOSEK will issue a warning.

Parameters:
 filename (string) – A valid file name. (input)
Groups:
 Data file
Task.writejsonsol
void writejsonsol (string filename)

Saves the current solutions and solver information items in a JSON file.

Parameters:
 filename (string) – A valid file name. (input)
Groups:
 Data file
Task.writeparamfile
void writeparamfile (string filename)

Writes all the parameters to a parameter file.

Parameters:
 filename (string) – A valid file name. (input)
Groups:
 Data file
Task.writesolution
void writesolution
  (soltype whichsol,
   string filename)

Saves the current basic, interior-point, or integer solution to a file.

Parameters:
 
  • whichsol (soltype) – Selects a solution. (input)
  • filename (string) – A valid file name. (input)
Groups:
 

Data file

Task.writetask
void writetask (string filename)

Write a binary dump of the task data. This format saves all problem data, coefficients and parameter settings but does not save callback functions and general non-linear terms.

See section 17.6 for a description of the Task format.

Parameters:
 filename (string) – A valid file name. (input)