This repository contains the code I use for various articles published on Medium. The code is primarily written in R, and is meant to be used as a reference for the articles and for learning purposes / inspiration. The code is published under the MIT license, so feel free to use it under the terms of the license.
This article is a short (ish) practical guide to solving optimisation problems in R, using linear programming.
Key concepts in the article:
- Basic concepts of linear programming
- Example: implement the knapsack problem in R
- Working with the 'ompr' package
- Variable naming and model construction
- Step-by-step apporach to building and solving a simple model
The article can be foound here.
The article continues part I, and contains a more advanced example of linear programming in R. Using a real world example, you'll see how to use linear programming to optimisae cutting steel beams. Each section in the article is broken down into two parts; one where I explain the math, and one where I show you how to implement it in R.
Key concepts in the article:
- Mathematical formulation of problems
- Model parameter defintion
- Decision variable creation
- Implementing contraints
- Objective function setup
- Solution extraction and interpretation
The article can be found here.