diff --git a/R/sysBiolAlg_mtfClass.R b/R/sysBiolAlg_mtfClass.R index 362d339b29d28b707257636feafe35d732b1b8fb..cacd177b6dbc224ab8d04507c1f3e504149e2424 100644 --- a/R/sysBiolAlg_mtfClass.R +++ b/R/sysBiolAlg_mtfClass.R @@ -47,6 +47,7 @@ setMethod(f = "initialize", react = NULL, lb = NULL, ub = NULL, costcoefbw = NULL, costcoeffw = NULL, + lpdir = "min", absMAX = SYBIL_SETTINGS("MAXIMUM"), useNames = SYBIL_SETTINGS("USE_NAMES"), cnames = NULL, @@ -65,6 +66,7 @@ setMethod(f = "initialize", stopifnot(is(model, "modelorg"), is(wtobj, "numeric"), is(absMAX, "numeric")) + stopifnot(lpdir %in% c("min", "max")) # If wtobj is longer than 1, mtf algorithm has to run several # times. In that case, wtobj is not written in the problem @@ -102,6 +104,8 @@ setMethod(f = "initialize", # | | | # obj 0 | 1 | 1 | + # NOTE: if lpdir == "max" the 2nd and 3rd block + # will be <= instead of >= and signs change. # --------------------------------------------- # problem dimensions @@ -131,10 +135,18 @@ setMethod(f = "initialize", fi <- c(1:nc) # rows for the delta match matrix - diag(LHS[(nr+1) :(nr+nc) ,1 :nc ]) <- 1 - diag(LHS[(nr+1) :(nr+nc) ,(nc+1) :(2*nc)]) <- 1 - diag(LHS[(nr+nc+1):(nr+2*nc),1 :nc ]) <- -1 - diag(LHS[(nr+nc+1):(nr+2*nc),(2*nc+1):(3*nc)]) <- 1 + if(lpdir=="min"){ + diag(LHS[(nr+1) :(nr+nc) ,1 :nc ]) <- 1 + diag(LHS[(nr+1) :(nr+nc) ,(nc+1) :(2*nc)]) <- 1 + diag(LHS[(nr+nc+1):(nr+2*nc),1 :nc ]) <- -1 + diag(LHS[(nr+nc+1):(nr+2*nc),(2*nc+1):(3*nc)]) <- 1 + }else{ + diag(LHS[(nr+1) :(nr+nc) ,1 :nc ]) <- 1 + diag(LHS[(nr+1) :(nr+nc) ,(nc+1) :(2*nc)]) <- -1 + diag(LHS[(nr+nc+1):(nr+2*nc),1 :nc ]) <- -1 + diag(LHS[(nr+nc+1):(nr+2*nc),(2*nc+1):(3*nc)]) <- 1 + } + # fix the value of the objective function LHS[(nr+2*nc+1),1:nc] <- obj_coef(model) @@ -156,7 +168,11 @@ setMethod(f = "initialize", #rupper <- c(rhs(model), rep(absMAX, 2*nc + 1)) rlower <- c(rep(0, nr), rep(0, 2*nc), currmo) rupper <- c(rep(0, nr), rep(absMAX, 2*nc + 1)) - rtype <- c(rep("E", nr), rep("L", 2*nc + 1)) + if(lpdir == "min"){ + rtype <- c(rep("E", nr), rep("L", 2*nc), "L") + }else{ + rtype <- c(rep("E", nr), rep("U", 2*nc), "L") + } # --------------------------------------------- # objective function @@ -252,7 +268,7 @@ setMethod(f = "initialize", rlb = rlower, rub = rupper, rtype = rtype, - lpdir = "min", + lpdir = lpdir, ctype = NULL, cnames = colNames, rnames = rowNames, diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 2875c437eeb4e21e56ff3852c94e77b73c3e79ca..8c6c3338378210007c059d420fbe7ee1203d70d8 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -6,6 +6,13 @@ \newcommand{\CRANpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}} +\section{Changes in version 1.3.4 2016-01-27}{ + \itemize{ + \item \code{sysBiolAlg_mtfClass} got option to be used as maximum total + flux, too. + } +} +% ---------------------------------------------------------------------------- % \section{Changes in version 1.3.3 2015-11-25}{ \itemize{ \item \code{addReact} crashed for irreversible models. diff --git a/man/sysBiolAlg_mtf-class.Rd b/man/sysBiolAlg_mtf-class.Rd index baf906d90d79a1ee0707a55717f5bae83dfaff09..397adb566d6aea340a153b4660193225454c7929 100644 --- a/man/sysBiolAlg_mtf-class.Rd +++ b/man/sysBiolAlg_mtf-class.Rd @@ -111,6 +111,11 @@ values given in \code{costcoeffw}.\cr Default: \code{NULL}. } + \item{\code{lpdir}:}{Object of class \code{"character"} + giving the direction of optimization. with \code{max} this class can be + used to optimize maximum total flux. Cavetas: Because of changes in the + linear problem, this cannot be changed later. Default: \code{min}. + } \item{absMAX}{ A single numerical value used as a maximum value for upper variable and contraint bounds.\cr