12.1 Command Reference¶
The Rmosek interface is composed by a small set of functions and structures.
12.1.1 Functions¶

r
=mosek
(prob
,opts
)¶ Solve an optimization problem using the MOSEK optimization library.
Parameters:
(problem) – a struct describing the optimization problem.prob [in]
(options) – the solver optionsopts [in]
Return:
(result) – a struct that contains the result of the optimizationr

ver
=mosek_version
()¶ Retrieves a string containing the version number of the utilized MOSEK optimization library.
Return:
(int) – The version number.ver

void
=mosek_clean
()¶ Forces the early release of any previously acquired MOSEK license. If you do not share a limited number of licenses among multiple users, you do not need to use this function. The acquisition of a new MOSEK license will automatically take place at the next call to the function
mosek
given a valid problem description, using a small amount of extra time.For advanced users: If you utilize the .Call convention directly, i.e. bypassing the mosek Rfunction definition, an
Rf_error
will result in an unclean memory space. For this reason you can also use this function to tidy up uncleaned resources in case an error occurs. Otherwise this cleaning will not happen until the next call tomosek
or until the library is unloaded. This usage have not been documented elsewhere.

out
=mosek_read
(filepath
,opts = list()
)¶ Interprets a model from any standard modeling fileformat (e.g. lp, opf, mps, task, etc.), controlled by a set of options. The result contains an optimization problem which is compliant with the input specifications of function
mosek
.Parameters:
(string) – A string describing the path to file, either absolute or relative to the working directory. The specified location will be the source of the optimization model to be read.filepath [in]
(io_options) – The options could have any name, and are, in fact, often input directly as an anonymous list.opts [in]
Return:
(result) – The resulting function output variable , returned by the interface, holds the response of the function call.out

r
=mosek_write
(prob
,filepath
,opts
)¶ Outputs a model of an optimization problem in a file format (see Section 13), controlled by a set of options. The modeling file format is selected based on the extension of the modelfile.
Parameters:
(problem) – The input variable could have any name, but should be a list object describing the optimization problem using the same fields as for theprob [in]
mosek
function.
(string) – The input variable should be a string describing the path to modelfile. This path can either be absolute or relative to the working directory, and will overwrite any existing data on this location. The specified location will be the destination of the exported model.filepath [in]
(io_options) – The options could have any name, and are, in fact, often specified directly as an anonymous list.opts [in]
Return:
(result) – Function return information.r
12.1.2 Structures and Data Types¶

problem
¶ A list object describing the optimization problem using the following fields.
Fields:
(string) – Objective sense, e.g.sense
"max"
or"min"
(numeric_vector) – Objective coefficient array.c
(numeric) – Objective constant.c0
(matrix_sparse) – Constraint sparse matrix.A
(matrix) – Lower and upper constraint boundsbc
(matrix) – Lower and upper variable boundsbx
(matrix_list) – Conic constraintscones
(numeric_vector) – Semidefinite variable dimensionsbardim
(list) – Semidefinite objective coefficientsbarc
(list) – Semidefinite constraint coefficientsbarA
(numeric_vector) – Integer variable indexesintsub
(list) – [optional] Quadratic convex optimizationqobj
(list) – [optional] Separable convex optimizationscopt
(list) – Integer parameter listiparam
(list) – Double parameter listdparam
(list) – String parameter listsparam
(solver_solutions) – Initial solution structsol

options
¶ The options could have any name, and are, in fact, often input directly as an anonymous list.
Fields:
(numeric) – Output logging verbosityverbose
(bool) – Whether to use the initial solutionusesol
(bool) – Whether to use the specified parameter settingsuseparam
(numeric) – Level of detail used to describe solutionssoldetail
(bool) – Whether to extract MOSEK information itemsgetinfo
(string) – Filepath used to export modelwritebefore
(string) – Filepath used to export model and solutionwriteafter

solver_solutions
¶ It contains informations about initial/final solutions.
Warning
Fields availability depends on the type of problem/algorithm.
Fields:
(solution_info) – Interior solutionitr
(solution_info) – Basic solutionbas
(solution_info) – Integer solutionint

solution_info
¶ Fields:
(string) – Solution statussolsta
(string) – Problem statusprosta
(string_vector) – Linear constraint status keysskc
(string_vector) – Variable bound status keysskx
(string_vector) – Conic constraint status keys (not in basic solution)skn
(numeric_vector) – Constraint activitiesxc
(numeric_vector) – Variable activitiesxx
(numeric_vector) – Semidefinite variable activities (not in basic solution)barx
(numeric_vector) – Dual variable for constraint lower bounds (not in integer solution)slc
(numeric_vector) – Dual variable for constraint upper bounds (not in integer solution)suc
(numeric_vector) – Dual variable for variable lower bounds (not in integer solution)slx
(numeric_vector) – Dual variable for variable lower bounds (not in integer solution)sux
(numeric_vector) – Dual variable of conic constraints (not in basic or integer solution)snx
(numeric_vector) – Dual variable of semidefinite domains (not in basic or integer solution)bars
(numeric) – Primal objective value (Only available if requested by optionpobjval
soldetail
)
(numeric) – Dual objective value (not fo integer solution)dobjval
(numeric) – Best primal objective bound from relaxations (only for integer solution)pobjbound
(infeas_info) – Maximal solution infeasibilitiesmaxinfeas

infeas_info
¶ It contains information about the maximal solution infeasibilty for several problem items.
Note
This struct is only available if the option
soldetail
is specified.Fields:
(numeric) – In primal inequality constraintspbound
(numeric) – In primal equality constraintspeq
(numeric) – In primal cone constraintspcone
(numeric) – In dual inequality constraintsdbound
(numeric) – In dual equality constraintsdeq
(numeric) – In dual cone constraintsdcone
(numeric) – In integer variablesint

io_options
¶ It is used to specify options for input/output operations.
Fields:
(numeric) – Output logging verbosityverbose
(bool) – Whether to write an initial solutionusesol
(bool) – Whether to write all parameter settingsuseparam
(bool) – Whether to extract MOSEK information itemsgetinfo
(string) – Source of operators read to scoptscofile
(matrix_sparse) – The sparse format of the constraint matrix (only used bymatrixformat
mosek_read
).

result
¶ It contains results for most of the Rmosek functions.
Note
Some fields are available only for specific functions.
Fields:
(rescode) – Response from the MOSEK optimization library.response
(numeric) – IDcode of responsecode
(string) – Humanreadable messagemsg
(problem) – Problem description (only available inprob
mosek_read
)
(solution_info) – Available solutions (algorithm/problem dependent) (only available insol
mosek
)
(numeric_list) – Integer information list (Only available if requested by optioniinfo
getinfo
).
(numeric_list) – Double information list (Only available if requested by optiondinfo
getinfo
).