Outputs a model of an optimization problem in any standard modeling fileformat (e.g. lp, opf, mps, mbt, etc.), controlled by a set of options. The modeling fileformat is selected based on the extension of the modelfile.
The optimization problem.
The file to write the optimization model.
The interface options.
problem should be compliant with the input specification of
mosek. Please see this function for more details.
modelfile should be an absolute or relative path to the model
file. If the file extension is
.opf, the model will be written in
the Optimization Problem Format. Other formats include lp, mps and mbt.
The amount of information printed by the interface can be limited by
verbose (default=10). Whether to write the initial solution, if
one such exists in the problem description, is indicated by
which by default is FALSE. Whether to write the full list of parameter
settings, some of which may have been specified by the problem description,
is indicated by
useparam which by default is FALSE.
scofile is used in separable convex optimization to
specify the absolute or relative path to the operator file.
|modelfile||Filepath to the model|
|.$verbose||Output logging verbosity|
|.$usesol||Whether to write an initial solution|
|.$useparam||Whether to write all parameter settings|
|.$getinfo||Whether to extract MOSEK information items|
|.$scofile||Destination of operators from scopt|
The returned result.
The result is a named list containing the response of the MOSEK Optimization Library when writing to the model file. A response code of zero is the signal of success.
|.$response||Response from the MOSEK Optimization Library|
|..$code||ID-code of response|
|.$iinfo/$dinfo||MOSEK information list|
|..$<MSK_INFO>||Value of any <MSK_INFO>|
1 2 3 4 5 6 7 8 9 10 11 12 13
lo1 <- list() lo1$sense <- "max" lo1$c <- c(3,1,5,1) lo1$A <- Matrix(c(3,1,2,0, 2,1,3,1, 0,2,0,3), nrow=3, byrow=TRUE, sparse=TRUE) lo1$bc <- rbind(blc = c(30,15,-Inf), buc = c(30,Inf,25)); lo1$bx <- rbind(blx = c(0,0,0,0), bux = c(Inf,10,Inf,Inf)); rr <- mosek_write(lo1, "lo1.opf") if (!identical(rr$response$code, 0)) stop("Failed to write model file to current working directory")