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:
 
  • prob [in] (problem) – a struct describing the optimization problem.
  • opts [in] (options) – the solver options
Return:
 

r (result) – a struct that contains the result of the optimization

ver = mosek_version()

Retrieves a string containing the version number of the utilized MOSEK optimization library.

Return:
 ver (int) – The version number.
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 R-function 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 to mosek 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:
 
  • filepath [in] (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.
  • opts [in] (io_options) – The options could have any name, and are, in fact, often input directly as an anonymous list.
Return:
 

out (result) – The resulting function output variable , returned by the interface, holds the response of the function call.

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:
 
  • prob [in] (problem) – The input variable could have any name, but should be a list object describing the optimization problem using the same fields as for the mosek function.
  • filepath [in] (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.
  • opts [in] (io_options) – The options could have any name, and are, in fact, often specified directly as an anonymous list.
Return:
 

r (result) – Function return information.

12.1.2 Structures and Data Types

rescode

The return code type. See Section 12.4.

problem

A list object describing the optimization problem using the following fields.

Fields:
 
  • sense (string) – Objective sense, e.g. "max" or "min"
  • c (numeric_vector) – Objective coefficient array.
  • c0 (numeric) – Objective constant.
  • A (matrix_sparse) – Constraint sparse matrix.
  • bc (matrix) – Lower and upper constraint bounds
  • bx (matrix) – Lower and upper variable bounds
  • cones (matrix_list) – Conic constraints
  • bardim (numeric_vector) – Semidefinite variable dimensions
  • barc (list) – Semidefinite objective coefficients
  • barA (list) – Semidefinite constraint coefficients
  • intsub (numeric_vector) – Integer variable indexes
  • qobj (list) – [optional] Quadratic convex optimization
  • scopt (list) – [optional] Separable convex optimization
  • iparam (list) – Integer parameter list
  • dparam (list) – Double parameter list
  • sparam (list) – String parameter list
  • sol (solver_solutions) – Initial solution struct
options

The options could have any name, and are, in fact, often input directly as an anonymous list.

Fields:
 
  • verbose (numeric) – Output logging verbosity
  • usesol (bool) – Whether to use the initial solution
  • useparam (bool) – Whether to use the specified parameter settings
  • soldetail (numeric) – Level of detail used to describe solutions
  • getinfo (bool) – Whether to extract MOSEK information items
  • writebefore (string) – Filepath used to export model
  • writeafter (string) – Filepath used to export model and solution
solver_solutions

It contains informations about initial/final solutions.

Warning

Fields availability depends on the type of problem/algorithm.

Fields:
 
  • itr (solution_info) – Interior solution
  • bas (solution_info) – Basic solution
  • int (solution_info) – Integer solution
solution_info
Fields:
 
  • solsta (string) – Solution status
  • prosta (string) – Problem status
  • skc (string_vector) – Linear constraint status keys
  • skx (string_vector) – Variable bound status keys
  • skn (string_vector) – Conic constraint status keys (not in basic solution)
  • xc (numeric_vector) – Constraint activities
  • xx (numeric_vector) – Variable activities
  • barx (numeric_vector) – Semidefinite variable activities (not in basic solution)
  • slc (numeric_vector) – Dual variable for constraint lower bounds (not in integer solution)
  • suc (numeric_vector) – Dual variable for constraint upper bounds (not in integer solution)
  • slx (numeric_vector) – Dual variable for variable lower bounds (not in integer solution)
  • sux (numeric_vector) – Dual variable for variable lower bounds (not in integer solution)
  • snx (numeric_vector) – Dual variable of conic constraints (not in basic or integer solution)
  • bars (numeric_vector) – Dual variable of semidefinite domains (not in basic or integer solution)
  • pobjval (numeric) – Primal objective value (Only available if requested by option soldetail)
  • dobjval (numeric) – Dual objective value (not fo integer solution)
  • pobjbound (numeric) – Best primal objective bound from relaxations (only for integer solution)
  • maxinfeas (infeas_info) – Maximal solution infeasibilities
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:
 
  • pbound (numeric) – In primal inequality constraints
  • peq (numeric) – In primal equality constraints
  • pcone (numeric) – In primal cone constraints
  • dbound (numeric) – In dual inequality constraints
  • deq (numeric) – In dual equality constraints
  • dcone (numeric) – In dual cone constraints
  • int (numeric) – In integer variables
io_options

It is used to specify options for input/output operations.

Fields:
 
  • verbose (numeric) – Output logging verbosity
  • usesol (bool) – Whether to write an initial solution
  • useparam (bool) – Whether to write all parameter settings
  • getinfo (bool) – Whether to extract MOSEK information items
  • scofile (string) – Source of operators read to scopt
  • matrixformat (matrix_sparse) – The sparse format of the constraint matrix (only used by mosek_read).
result

It contains results for most of the Rmosek functions.

Note

Some fields are available only for specific functions.

Fields:
 
  • response (rescode) – Response from the MOSEK optimization library.
  • code (numeric) – ID-code of response
  • msg (string) – Human-readable message
  • prob (problem) – Problem description (only available in mosek_read)
  • sol (solution_info) – Available solutions (algorithm/problem dependent) (only available in mosek)
  • iinfo (numeric_list) – Integer information list (Only available if requested by option getinfo).
  • dinfo (numeric_list) – Double information list (Only available if requested by option getinfo).