Learn R Programming

sybil (version 2.0.0)

readProb-methods: Read Problem Object From File

Description

Read problem object from file.

Usage

# S4 method for optObj_clpAPI,character
readProb(lp, fname, ff = "mps", ...)

# S4 method for optObj_cplexAPI,character readProb(lp, fname, ff = "lp")

# S4 method for optObj_glpkAPI,character readProb(lp, fname, ff = "lp", ...)

# S4 method for optObj_lpSolveAPI,character readProb(lp, fname, ff = "lp", ...)

Arguments

lp

An object extending class '>optObj.

fname

A single character string giving the file name to read from.

ff

A single character string giving the file format to use, see Details. Default: "lp".

...

Further arguments passed to the corresponding API routine.

Methods

signature(lp = "optObj_clpAPI", fname = "character")

method to use with package optObj_clpAPI. Argument ff is not used here.

signature(lp = "optObj_cplexAPI", fname = "character")

method to use with package optObj_cplexAPI.

signature(lp = "optObj_glpkAPI", fname = "character")

method to use with package optObj_glpkAPI.

signature(lp = "optObj_lpSolveAPI", fname = "character")

method to use with package optObj_lpSolveAPI.

Details

Argument "ff" in conjunction with clpAPI can be mps for MPS file format or "clp" for COIN-OR Clp file mormat. Valid values for cplexAPI and lpSolveAPI are available in their documentations. For glpkAPI, argument "ff" can be "lp" for LP file format, "mps" for MPS file format or "glpk" for GLPK file format.

See Also

Superclass '>optObj and constructor function optObj. Method to write problem objects: writeProb

Examples

Run this code
# NOT RUN {
	
# }
# NOT RUN {
		# In very rare cases it is handy to save a sysBiolAlg-object:

		library(sybil)
		data(Ec_core)
		
		# create a sysBiolAlg object (we use here GLPK (!))
		prob <- sysBiolAlg(Ec_core, algorithm = "fba", solver="glpkAPI")
		
		# write the R-object to disc
		save(file="prob.RData",prob)
		
		# now write the linear program part (managed by the solver) to disc
		writeProb(prob@problem, fname="prob.lp", ff="lp")

		# start new R session

		library(sybil)
		library(glpkAPI)
		load("prob.RData") # restore the R-object
		prob@problem@oobj <- initProbGLPK() # initialize a new linear program
		readProb(problem(prob), fname="prob.lp") # load the previously saved linear program
	
# }

Run the code above in your browser using DataLab