# Implement the gurobi solver: current progress #25

Open
opened this Issue Jan 16, 2017 · 1 comment

Projects
None yet
1 participant
Owner

### njtierney commented Jan 16, 2017

 else if(solver == "gurobi"){ # In bar.R if (!requireNamespace("gurobi", quietly = TRUE)) { stop("Make sure that you have installed the Gurobi software and accompanying Gurobi R package, more details at https://www.gurobi.com/documentation/7.0/refman/r_api_overview.html") } # model <- list() # model\$A <- matrix(c(1,1,0,0,1,1), nrow=2, byrow=T) # model\$obj <- c(1,1,2) # model\$modelsense <- "max" # model\$rhs <- c(1,1) # model\$sense <- c('<=', '<=') # J <- nrow(A) # I <- ncol(A) model <- list() # set A matrix model\$A <- A Nx <- nrow(A) Ny <- ncol(A) N <- n_added # d <- [ones(1,Ny) zeros(1,Nx)]; d <- c(rep(1, Ny), rep(0,Nx)) # c <- -[zeros(Ny,1); ones(Nx,1)]; # c <- c(rep(0, Ny), rep(1,Nx)) model\$obj <- c(rep(0, Ny), rep(1,Nx)) model\$modelsense <- "max" Aeq <- d beq <- N Ain <- cbind(-A, diag(Nx)) bin <- matrix(rep(0,Nx), ncol = 1) # matrix of numeric constraint coefficients, # one row per constraint # one column per variable # constraint matrix?? # constraint_matrix <- rbind(Ain, Aeq) # rhs_matrix <- rbind(bin, beq) model\$rhs <- rbind(bin, beq) # model\$sense <- c('<=', '<=') model\$sense <- c(rep("<=", Nx), "==") result <- gurobi::gurobi(model) return(result) } # end gurobi

Closed

Owner

### njtierney commented Feb 15, 2017

 Gurobi now works, however there are some remaining issues in #39, but these can be addressed there directly.