Skip to content
Snippets Groups Projects
Commit 897e307f authored by Claus Jonathan Fritzemeier's avatar Claus Jonathan Fritzemeier
Browse files

first code draft

parent cc4c1330
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ setMethod(f = "initialize", ...@@ -47,6 +47,7 @@ setMethod(f = "initialize",
rnames = NULL, rnames = NULL,
pname = NULL, pname = NULL,
scaling = NULL, scaling = NULL,
easyConstraint = NULL,
writeProbToFileName = NULL, ...) { writeProbToFileName = NULL, ...) {
if ( ! missing(model) ) { if ( ! missing(model) ) {
...@@ -97,6 +98,34 @@ setMethod(f = "initialize", ...@@ -97,6 +98,34 @@ setMethod(f = "initialize",
probName <- NULL probName <- NULL
} }
mat <- S(model)
rtype <- rep("E", nRows)
#add easyConstraints:
if(!is.null(easyConstraint)){
if( length(easyConstraint$nz) == length(easyConstraint$x)
| length(easyConstraint$nz) == length(easyConstraint$rtype)){
stop("easyConstraint elements have to have equal lengths")
}
stopifnot(is.list(easyConstraints$nz))
stopifnot(is.list(easyConstraints$x))
stopifnot(all(easyConstraints$rtype %in% c("F", "L", "U", "D", "E")))
m <- Matrix(0, ncol=nCols, nrow=length(easyConstraint))
for(i in 1:length(easyConstraint)){
m[i, easyConstraint$nz] <- easyConstraint$x
}
mat <- rbind2(mat, m)
rtype <- c(rtype, easyConstraint$rtype)
nRow <- nRow + length(easyConstraint)
if(!is.null(rowNames)){
c(rowNames, paste0("easyConstraint", 1:length(easyConstraint)))
}
}
# generate problem object # generate problem object
.Object <- callNextMethod(.Object, .Object <- callNextMethod(.Object,
sbalg = "fba", sbalg = "fba",
...@@ -105,12 +134,12 @@ setMethod(f = "initialize", ...@@ -105,12 +134,12 @@ setMethod(f = "initialize",
fi = 1:nCols, fi = 1:nCols,
nCols = nCols, nCols = nCols,
nRows = nRows, nRows = nRows,
mat = S(model), mat = mat,
ub = uppbnd(model), ub = uppbnd(model),
lb = lowbnd(model), lb = lowbnd(model),
obj = obj_coef(model), obj = obj_coef(model),
rlb = rep(0, nRows), rlb = rep(0, nRows),
rtype = rep("E", nRows), rtype = rtype,
lpdir = lpdir, lpdir = lpdir,
rub = NULL, rub = NULL,
ctype = NULL, ctype = NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment