Coder Social home page Coder Social logo

rmpk's Introduction

MIP Modelling in R

Lifecycle: experimental R build status

rmpk is a lightweight package to model mixed integer linear programs. It is based on the API of the ompr package and is also inspired by the architecture of Julia JuMP.

The goal is to provide a modelling package that can both be used in packages and also in interactive analyses. It also has a different architecture as the modelling layer modifies a central solver. That solver could be an interface to ROI or a shared pointer to a specific solver. Thus giving the option to directly communicate with the solver while still using an algebraic modelling framework.

This is currently work in progress and experimental - but working. I might merge it with ompr but it could also become the successor of ompr … not sure yet.

If you want to see the package in action take a look at the articles in the docs.

Happy to receive feedback!

Still under development. Anything can change

Installation

You can install the released version of RMPK from CRAN with:

remotes::install_github("r-opt/rmpk")

Supported types

  • Linear Programming (LP)
  • Mixed Integer Linear Programming (MILP)
  • Mixed Integer Quadratic Programming (MIQP)
  • Mixed Integer Quadratically Constrained Programming (MIQCP)

Features

  • ✅ Algebraic modelling of mixed integer programming problems

  • ✅ Integer, binary and continious variables

  • ✅ Linear and quadratic constraints/objective

  • ✅ Bindings to most popular solvers through ROI

  • ✅ Support for character variable indexes

  • ✅ Access row/column duals of Linear Programs

  • ✅ Row generation through solver callbacks (e.g. for models with exponential many constraints)

  • 🚧 Variable and constraint names

  • 🚧 Initial feasible solutions

  • 🚧 Almost as fast as matrix code

Low Level ROI Example

library(rmpk)
library(ROI.plugin.glpk)
set.seed(42)
solver <- ROI_optimizer("glpk")
v <- rnorm(10)
w <- rnorm(10)
model <- optimization_model(solver)
x <- model$add_variable("x", type = "binary", i = 1:10)
model$set_objective(sum_expr(v[i] * x[i], i = 1:10), sense = "max")
model$add_constraint(sum_expr(w[i] * x[i], i = 1:10) <= 10)
model$optimize()
model$get_variable_value(x[i])
#>    name  i value
#> 1     x  1     1
#> 2     x  7     1
#> 3     x  5     1
#> 4     x  8     0
#> 5     x  2     0
#> 6     x 10     0
#> 7     x  9     1
#> 8     x  3     1
#> 9     x  6     0
#> 10    x  4     1

Contribute

The best way at the moment to contribute is to test the package, write documentation, propose features. Soon, code contributions are welcome as well.

Please note that the ‘rmpk’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

MIT

References and Inspiration

  • Dunning, Iain, Joey Huchette, and Miles Lubin. “JuMP: A modeling language for mathematical optimization.” SIAM Review 59.2 (2017): 295-320.
  • ompr
  • pulp

rmpk's People

Contributors

dirkschumacher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.