Learn R Programming

Rmosek (version 1.2.5.1)

mosek_read: Read problem from a model file

Description

Interprets a model from any standard modeling fileformat (e.g. lp, opf, mps, mbt, etc.), controlled by a set of options. The result contains an optimization problem which is compliant with the input specifications of function mosek.

Usage

mosek_read(modelfile, opts = list())

Arguments

modelfile

The file containing an optimization model.

modelfile STRING (filepath)
opts

The interface options.

opts LIST (OPTIONAL)
..$verbose NUMERIC (OPTIONAL)
..$usesol BOOLEAN (OPTIONAL)
..$useparam BOOLEAN (OPTIONAL)
..$getinfo BOOLEAN (OPTIONAL)
..$scofile STRING (filepath) (OPTIONAL)
..$matrixformat STRING (OPTIONAL)

Value

r

The returned result.

r LIST
..$response LIST
....$code NUMERIC
....$msg STRING
..$prob LIST
..$iinfo/$dinfo LIST *
....$<MSK_INFO> NUMERIC *
*Starred items must be requested using an option.

The result is a named list containing the response of the MOSEK Optimization Library when reading the model file. A response code of zero is the signal of success.

On success, the result contains the problem specification with all problem data. This problem specification is compliant with the input specifications of function mosek.

Setting option getinfo to TRUE extracts iinfo and dinfo. lll r Result .$response Response from the MOSEK Optimization Library ..$code ID-code of response ..$msg Human-readable message .$prob Problem description .$iinfo/$dinfo MOSEK information list ..$<MSK_INFO> Value of any <MSK_INFO>

Details

The modelfile should be an absolute or relative path to a model file.

The amount of information printed by the interface can be limited by verbose (default=10). Whether to read the initial solution, if one such exists in the model file, is indicated by usesol which by default is FALSE. Whether to read the full list of parameter settings, some of which may have been defined by the model file, is indicated by useparam which by default is FALSE.

The option scofile is used in separable convex optimization to specify the absolute or relative path to the operator file.

The format of the imported constraint matrix is controlled by matrixformat and can be either sparse coordinate COO, compressed sparse column CSC, or a list-based alternative simple:COO. The matrix formats CSC and COO are based on the package 'Matrix' superclasses CsparseMatrix and TsparseMatrix.

modelfile Filepath to the model
opts Options
.$verbose Output logging verbosity
.$usesol Whether to read an initial solution
.$useparam Whether to read all parameter settings
.$getinfo Whether to extract MOSEK information items
.$scofile Source of operators read to scopt
.$matrixformat The sparse format of the constraint matrix

See Also

mosek mosek_write

Examples

Run this code
# NOT RUN {
 modelfile <- system.file(package="Rmosek", "extdata", "lo1.opf")
 rr <- mosek_read(modelfile)
 if (!identical(rr$response$code, 0))
   stop("Failed to read model file")
 rlo1 <- mosek(rr$prob)

 modelfile <- system.file(package="Rmosek", "extdata", "milo1.opf")
 rr <- mosek_read(modelfile)
 if (!identical(rr$response$code, 0))
   stop("Failed to read model file")
 rmilo1 <- mosek(rr$prob)

 modelfile <- system.file(package="Rmosek", "extdata", "cqo1.opf")
 rr <- mosek_read(modelfile)
 if (!identical(rr$response$code, 0))
   stop("Failed to read model file")
 rcqo1 <- mosek(rr$prob)

 modelfile <- system.file(package="Rmosek", "extdata", "qo1.opf")
 rr <- mosek_read(modelfile)
 if (!identical(rr$response$code, 0))
   stop("Failed to read model file")
 rqo1 <- mosek(rr$prob)

 modelfile <- system.file(package="Rmosek", "extdata", "sco1.opf")
 modelscofile <- system.file(package="Rmosek", "extdata", "sco1.sco")
 rr <- mosek_read(modelfile, list(scofile=modelscofile))
 if (!identical(rr$response$code, 0))
   stop("Failed to read model file")
 rsco1 <- mosek(rr$prob)
# }

Run the code above in your browser using DataLab