Lars Relund Nielsen

112 posts

New publications

The research paper “A bi-objective approach to discrete cost-bottleneck location problems” have been published in Annals of Operations Research. Abstract: This paper considers a family of bi-objective discrete facility location problems with a cost objective and a bottleneck objective. A special case is, for instance, a bi-objective version of the (vertex) p-centdian problem. We show that bi-objective facility location problems of this type can be solved efficiently by means of an epsilon-constraint method that solves at most (n-1)m minisum problems, where n is the number of customer points and m the number of potential facility sites. Additionally, we compare the approach to a lexicographic epsilon-constrained method that only returns efficient solutions and to a two-phase method relying on the perpendicular search method. We report extensive computational results obtained from several classes of facility location problems. The proposed algorithm compares very favorably to both the lexicographic epsilon-constrained method and to the two […]

PhD thesis: Discrete Location Problems – Theory, Algorithms, and Extensions to Multiple Objectives

Sune one of my PhD students has just finished his defense of his thesis titled “Discrete Location Problems – Theory, Algorithms, and Extensions to Multiple Objectives“. I would like to congratulate Sune with his PhD title and for a good presentation at the defense. I have included the thesis summary below. Summary This PhD–dissertation proposes a number of solution procedures for discrete facility location problems. In the literature of operations research, location problems are mathematical models describing optimization problems where one or more facilities need to be placed in relation to a given set of customers or demand points. An example is the location of hospitals which needs to be performed in such a way as to take into account capacity limits and the sizes of nearby towns and cities.

PhD thesis: Optimization Methods in a Stochastic Production Environment

Reza one of my PhD students has just finished his defense of his thesis titled “Optimization Methods in a Stochastic Production Environment“. I would like to congratulate Reza with his PhD title and for a good presentation at the defense. I have included the thesis summary below. Summary This dissertation with an interdisciplinary approach applies techniques from Operations Research and Statistics in order to develop models that support decisions regarding feeding and marketing of growing/finishing pigs. Stochastic dynamic programming is used as the main optimization tool to model decisions, and state space models are used as the primary statistical technique to describe the stochastic nature of the system. Based on data streams from online farm sensors and market prices, the state space model transforms data into information which is embedded into the decision models using Bayesian updating.

New publication

The research paper “A hierarchical Markov decision process modeling feeding and marketing decisions of growing pigs” have been published in European Journal of Operational Research. Abstract: Feeding is the most important cost in the production of growing pigs and has a direct impact on the marketing decisions, growth and the final quality of the meat. In this paper, we address the sequential decision problem of when to change the feed-mix within a finisher pig pen and when to pick pigs for marketing. We formulate a hierarchical Markov decision process with three levels representing the decision process. The model considers decisions related to feeding and marketing and finds the optimal decision given the current state of the pen. The state of the system is based on information from on-line repeated measurements of pig weights and feeding and is updated using a Bayesian approach. Numerical examples are given to illustrate the features […]

New publication

The research paper “Markov decision processes to model livestock systems” have been published as a chapter in Handbook of Operations Research in Agriculture and the Agri-Food Industry. The paper gives a review of the increasing amount of papers using MDPs to model livestock farming systems and provide an overview over the recent advances within this branch of research. Moreover, theory and algorithms for solving both ordinary and hierarchical MDPs are given and possible software for solving MDPs are considered.

Animation of wind using Shiny

I have played a bit with Shiny the last days. Let us try to create an shiny web application which show a map and add a layer with wind directions and wind speed. First we need weather data for a given latitude and longitude. We will use the API from to retrieve data. Your will need an API key for using the service. We define functions to retrieve the data

Distance matrix calculations in R

Many models in Operations Research needs a distance matrix between nodes in a network. If the distance matrix is based on road distances it can be found using R. Let us try to compute the distances between a set for zip codes in Denmark. First we load all zip codes for Jutland in Denmark:

Publishing R markdown to WordPress

In some cases it may be useful to write a WordPress post in R Markdown and afterwards publish it to my blog. This can be done using the RWordPress package. First we setup a link to my blog: if (!require(‘RWordPress’)) install.packages(‘RWordPress’, repos = ‘’, type = ‘source’) library(RWordPress) options(WordPressLogin = c(<your username> = ‘<your password>’), WordPressURL = ‘’) Next the post is written in a Rmd file and afterwards published to WordPress: id<-knit2wp(‘RWordPress_post.Rmd’, title = ‘Publishing R markdown to WordPress’, categories = c(‘R’), publish=F ) Now the post with id is a draft on my blog and I can have a look at it before publishing it. If I want to update the post I do: knit2wp(‘RWordPress_post.Rmd’, title = ‘Publishing R markdown to WordPress’, postid=id, action=’editPost’, categories = c(‘R’), publish = F ) To highlight the above code I use the WP Code Highlight.js plugin. If you use other syntax highlight […]

Migrating from svn (R-forge) to git (GitHub)

I recent migrated my R package mdp from my R-forge svn repo to GitHub. Do the following: Create an empty folder mdp and open a shell and import the svn to git (I only imported the pkg sub-folder svn+ssh:// git svn clone svn+ssh:// . # import the svn git branch -a # info, should show a git-svn remote branch git svn info # show svn details (also URL) Now add your local repo to GitHub. First, create an empty GitHub repo and next run from the shell: git remote add origin git push -u origin master The first line tells Git that your local repo has a remote version on GitHub, and calls it “origin”. The second line pushes all your current work to that repo. Now you have a local Git repo and 2 remote repos (one at GitHub and one at R-forge). You want to use GitHub as […]

Using RStudio together with Git and GitHub on Windows

I have started to use Git and GitHub together with RStudio. Git is a distributed version control system which is very useful when doing reproducible research. It is a good way to handle programming/coding. Moreover, Git (via GitHub) allows groups of people to work on the same documents (often code) at the same time, and without stepping on each other’s toes. RStudio is an excellent integrated development environment built specifically for R.