{"id":13857266,"url":"https://github.com/r-opt/rmpk","last_synced_at":"2025-07-13T21:32:08.803Z","repository":{"id":45650858,"uuid":"206655428","full_name":"r-opt/rmpk","owner":"r-opt","description":"Mixed Integer Linear and Quadratic Programming in R","archived":false,"fork":false,"pushed_at":"2021-12-02T15:53:16.000Z","size":739,"stargazers_count":43,"open_issues_count":13,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-06T03:03:25.728Z","etag":null,"topics":["linear-programming","mixed-integer-programming","modelling","quadratic-programming","r"],"latest_commit_sha":null,"homepage":"https://r-opt.github.io/rmpk/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-opt.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-05T20:52:32.000Z","updated_at":"2024-03-21T08:00:02.000Z","dependencies_parsed_at":"2022-09-03T01:22:12.953Z","dependency_job_id":null,"html_url":"https://github.com/r-opt/rmpk","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-opt%2Frmpk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-opt%2Frmpk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-opt%2Frmpk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-opt%2Frmpk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-opt","download_url":"https://codeload.github.com/r-opt/rmpk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225920235,"owners_count":17545450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linear-programming","mixed-integer-programming","modelling","quadratic-programming","r"],"created_at":"2024-08-05T03:01:31.985Z","updated_at":"2024-11-22T15:30:16.381Z","avatar_url":"https://github.com/r-opt.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n# MIP Modelling in R\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![R-CMD-check](https://github.com/r-opt/rmpk/workflows/R-CMD-check/badge.svg)](https://github.com/r-opt/rmpk/actions)\n[![Codecov test coverage](https://codecov.io/gh/r-opt/rmpk/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-opt/rmpk?branch=master)\n\u003c!-- badges: end --\u003e\n\n`rmpk` is a lightweight package to model mixed integer linear programs. It is based on the API of the [ompr](https://github.com/dirkschumacher/ompr) package and is also inspired by the architecture of [Julia JuMP](https://github.com/JuliaOpt/JuMP.jl).\n\nThe 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](https://CRAN.R-project.org/package=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.\n\nThis is currently work in progress and experimental - but working. I might merge it with [ompr](https://github.com/dirkschumacher/ompr) but it could also become the successor of [ompr](https://github.com/dirkschumacher/ompr) ... not sure yet.\n\nIf you want to see the package in action take a look at the [articles](https://r-opt.github.io/rmpk/) in the docs.\n\nHappy to receive feedback!\n\n_Still under development. Anything can change_\n\n## Installation\n\nYou can install the released version of RMPK from [CRAN](https://CRAN.R-project.org) with:\n\n``` r\nremotes::install_github(\"r-opt/rmpk\")\n```\n\n## Supported types\n\n* Linear Programming (LP)\n* Mixed Integer Linear Programming (MILP)\n* Mixed Integer Quadratic Programming (MIQP)\n* Mixed Integer Quadratically Constrained Programming (MIQCP)\n\n## Features\n\n* ✅ Algebraic modelling of mixed integer programming problems\n* ✅ Integer, binary and continious variables\n* ✅ Linear and quadratic constraints/objective\n* ✅ Bindings to most popular solvers through [ROI](https://CRAN.R-project.org/package=ROI)\n* ✅ Support for character variable indexes\n* ✅ Access row/column duals of Linear Programs\n* ✅ Row generation through solver callbacks (e.g. for models with exponential many constraints)\n\n* 🚧 Variable and constraint names\n* 🚧 Initial feasible solutions\n* 🚧 Almost as fast as matrix code\n* ...\n\n## Low Level ROI Example\n\n```{r}\nlibrary(rmpk)\nlibrary(ROI.plugin.glpk)\nset.seed(42)\nsolver \u003c- ROI_optimizer(\"glpk\")\nv \u003c- rnorm(10)\nw \u003c- rnorm(10)\nmodel \u003c- optimization_model(solver)\nx \u003c- model$add_variable(\"x\", type = \"binary\", i = 1:10)\nmodel$set_objective(sum_expr(v[i] * x[i], i = 1:10), sense = \"max\")\nmodel$add_constraint(sum_expr(w[i] * x[i], i = 1:10) \u003c= 10)\nmodel$optimize()\nmodel$get_variable_value(x[i])\n```\n\n## List of solvers\n\n`rmpk` supports all solvers that implement the [`MOI` interface](https://github.com/r-opt/MOI). It also comes\nwith a `ROI_optimzer` that internally uses [`ROI`](https://roi.r-forge.r-project.org/index.html) and thus gives [access to most\npopular solvers](https://roi.r-forge.r-project.org) out of the box.\nNote that `ROI` has its own plugin system and you need to install these solvers\nseparately in addition to [`ROIoptimizer`](https://github.com/r-opt/ROIoptimizer).\n\n```{r, echo = FALSE}\nroi_solvers \u003c- ROI::ROI_available_solvers()$Package\nroi_solvers \u003c- unique(substr(roi_solvers, 12, nchar(roi_solvers)))\ndf \u003c- data.frame(\n  solver_name = c(roi_solvers, \"glpk\"),\n  r_package = c(rep.int(\"ROIoptimizer\", length(roi_solvers)), \"GLPKoptimizer\"),\n  url = c(rep.int(\"https://github.com/r-opt/ROIoptimizer\", length(roi_solvers)), \"https://github.com/r-opt/GLPKoptimizer\"),\n  stringsAsFactors = FALSE\n)\n\nknitr::kable(df[order(df$solver_name), ],\n  col.names = c(\"Solver Name\", \"R Package\", \"Github URL\"),\n  row.names = FALSE\n)\n```\n\n\n## Contribute\n\nThe best way at the moment to contribute is to test the package, write documentation, propose features. Soon, code contributions are welcome as well.\n\nPlease note that the 'rmpk' project is released with a\n[Contributor Code of Conduct](CODE_OF_CONDUCT.md).\nBy contributing to this project, you agree to abide by its terms.\n\n## License\n\nMIT\n\n## References and Inspiration\n\n* Dunning, Iain, Joey Huchette, and Miles Lubin. \"JuMP: A modeling language for mathematical optimization.\" SIAM Review 59.2 (2017): 295-320.\n* [ompr](https://github.com/dirkschumacher/ompr)\n* [pulp](https://github.com/coin-or/pulp)\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-opt%2Frmpk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-opt%2Frmpk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-opt%2Frmpk/lists"}