R/set.row.R

Defines functions set.row

Documented in set.row

set.row <- function(lprec, row, xt, indices)
{
  if(missing(indices)) {
    if(length(xt) != dim(lprec)[2])
      stop("the length of ", sQuote("xt"), " is not equal to the number of ", 
           "decision variables in the model")

    epsel <- .Call(RlpSolve_get_epsel, lprec)
    indices <- which(abs(xt) > epsel)
    xt <- xt[indices]
  }

  if(length(xt) != length(indices))
    stop(sQuote("xt"), " and ", sQuote("indices"), " are not the same length")

  .Call(RlpSolve_set_rowex, lprec, as.integer(row), as.double(xt),
        as.integer(indices))

  invisible()
}

Try the lpSolveAPI package in your browser

Any scripts or data that you put into this service are public.

lpSolveAPI documentation built on Sept. 3, 2023, 5:07 p.m.