Learn R Programming

Rmosek (version 0.9.5)

mosek_read: Read problem from a model file

Description

Interprets a model from any standard modelling 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. lll{ modelfile STRING (filepath) }
opts
The interface options. lll{ opts LIST (OPTIONAL) ..$verbose NUMERIC (OPTIONAL) ..$usesol BOOLEAN (OPTIONAL) ..$useparam BOOLEAN (OPTIONAL) }

Value

  • rThe returned result. lll{ r LIST ..$response LIST ....$code NUMERIC ....$msg STRING ..$prob LIST }
  • The result is a named list containing the response of the MOSEK Optimization Library when reading the model file. Note that the result can be NULL if interfacing errors are encountered.

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

    lll{ r Result .$response Response from the MOSEK Optimization Library ..$code ID-code of response ..$msg Human-readable message .$prob Problem desciption }

Details

The modelfile should be an absolute 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 changed by the model file, is indicated by useparam which by default is FALSE.

ll{ 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 }

See Also

mosek mosek_write

Examples

Run this code
modelfile <- system.file(package="Rmosek", "extdata", "lo1.opf")
 rr <- mosek_read(modelfile)
 if (is.null(rr) || !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 (is.null(rr) || !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 (is.null(rr) || !identical(rr$response$code, 0))
   stop("Failed to read model file")
 rcqo1 <- mosek(rr$prob)

Run the code above in your browser using DataLab