rules <- validator(x > 1)
data <- list(x = 0)
weight <- c(x = 1)
mip <- inspect_mip(data, rules)
print(mip)
# inspect the lp problem (prior to solving it with lpsolveAPI)
lp <- mip$to_lp()
print(lp)
# for large problems write the lp problem to disk for inspection
# lpSolveAPI::write.lp(lp, "my_problem.lp")
# solve the mip system / find a solution
res <- mip$execute()
names(res)
# lpSolveAPI status of finding a solution
res$s
# lp problem after solving (often simplified version of first lp)
res$lp
# records that are deemed "faulty"
res$errors
# values of variables used in the mip formulation. Also contains a valid solution
# for "faulty" variables
res$values
# see the derived mip rules and objective function, used in the construction of
# lp problem
mip$mip_rules()
mip$objective
Run the code above in your browser using DataLab