Author Archives: Henry

Quadratic Programming with R

Optimization of a quadratic function

Quadratic programming problems can be solved with “quadprog” package in R and the key point is to find the matrix notation of quadratic programming problems:

Example

Let’s figure out how to do it with an example of “Applying Nonlinear Programming to Portfolio Selection”:

Please note that, this example involves three variables (x1, x2, and x3). If you want an example of two variables (x1 and x2), please check my another post: Another Quadratic Programming Example with R.

Continue reading

Maximum Flow Problem with R

Maximum flow is one of the Network Optimization problems in Operations Research and can be solved in R by “igraph“, which is a network analysis package.

6.2 A CASE STUDY: THE BMZ CO. MAXIMUM FLOW PROBLEM

The BMZ Co. distribution network from its main factory in Stuttgart, Germany, to a distribution center in Los Angeles.

The function to solve maximum flow problem in igraph package is called max_flow.

Usage:

max_flow(graph, source, target, capacity = NULL)
Continue reading

Linear Programming with R

Linear Programming in Matrix Notation, Stefan Feuerriegel (2015)

After finished the Business Statistics course in my Pre-Master at Nyenrode, I felt myself comfortable to deal with data analysis, and I did not have big plans for the six-week winter holiday, so I was wondering maybe I could try some different things about data analytics. However, since I am not a fan of drag-and-drop tools such as Excel and SPSS, I ended up with R, which many friends have recommended before.

Meanwhile, I realized that there will be a course about Operation Research called “Introduction to Management Science: A Modeling and Cases Studies Approach with Spreadsheets“, which is about how to solve Operation Research questions with excel Modeling, so I began to looking for R packages for Operation Research.

Continue reading