Created
July 2, 2013 23:57
-
-
Save Ram-N/5914345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# actual problem definition | |
lpff <- make.lp(nrow=n.row, ncol=n.col) | |
defineIP() | |
lpff | |
solve(lpff) | |
sol <- get.variables(lpff) | |
defineIP <- function() { | |
set.objfn(lpff, rep(1, n.col)) | |
set.constr.type(lpff, const.type.vec, 1:n.row) #horiz, vert, corners | |
set.rhs(lpff, b=rhs.vector, constraints=1:n.row) # assign rhs values | |
#Set all the columns at once | |
for (col in 1:n.col) { | |
set.column(lpff, col, df[ ,col]) | |
set.type(lpff, col, "binary") | |
} | |
#assemble it all | |
dimnames(lpff) <- setRowAndColNames() | |
write.lp(lpff, "flowfreeIP.lp", "lp")#write it out | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment