Skip to content

Instantly share code, notes, and snippets.

@jyfeather
Last active August 29, 2015 14:19
Show Gist options
  • Save jyfeather/6450c7f0cad4bb16d796 to your computer and use it in GitHub Desktop.
Save jyfeather/6450c7f0cad4bb16d796 to your computer and use it in GitHub Desktop.
library(Rglpk)
# mas74.mps file could be downloaded from http://miplib.zib.de/miplib2003/miplib2003/mas74.php
path <- paste(getwd(), "/example/mas74.mps", sep = "")
model <- Rglpk_read_file(path, type = "MPS_fixed")
# read components from mps file
objective <- model$objective
constraint <- model$constraints
constraint_1 <- constraint[[1]]
constraint_2 <- constraint[[2]]
constraint_3 <- constraint[[3]]
bounds <- model$bounds
types <- model$types
maximum <- model$maximum
nrow <- constraint_1$nrow
ncol <- constraint_1$ncol
# solve the mixed interger programming problem
# Rglpk_solve_LP(objective, constraint_1, constraint_2, constraint_3, bounds, types, maximum)
# Using branch and bounding to solve this problem, and get the structure of this BAB tree.
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment