Lars Relund NielsenLars Relund Nielsen
Department of Economics and Business Economics
Fuglesangs Allé 4
DK-8210 Aarhus V
Office M330
Phone: +45 871 65145/+45 61 300 299 (mobile)

Cand.scient.oecon. (M.Sc.), Ph.D. 2004 in Mathematics and Economics at the University of Aarhus. Professor at Department of Economics and Business Economics, Business and Social Sciences, Aarhus University.

Multi-Objective Optimization Repository (MOrepo)

R, Research 7. July 2017

The past weeks we have created Multi-Objective Optimization Repository (MOrepo) which is a response to the needs of researchers from the MCDM society to access multi-objective (MO) optimization instances. The repository contains instances, results, generators etc. for different MO problems and is continuously updated. The repository can be used as a test set for testing new algorithms, validating existing results and for reproducibility. All researchers within MO optimization are welcome to contribute. For more information see

Using LocalSolver to solve VRP problems

R, Teaching 17. May 2017

The last days I have been playing a bit with LocalSolver and tried to model various vehicle routing problems (VRP). LocalSolver is a heuristic solver based on a heuristic search approach combining different optimization techniques. It includes a math modeling language (LSP) and there is a package so that it can be used from R. You need to download and install LocalSolver (I used v7.0) and get an academic license from their webpage. Læs mere »

Plotting IP and MO-IP models in R

LaTeX, R, Teaching 20. February 2017

I recent released a small package gMOIP which can make 2D plots of linear and integer programming models (LP/IP). With the package you can make plots of the feasible region (or solution space) of an LP, visualize the integer points inside the region and the iso profit curve. Moreover, can also make a plot of a bi-objective criterion space and the non-dominated (Pareto) set. Figures are prepared for LaTeX and can automatically be transformed to TikZ using tikzDevice. Læs mere »

Animation of wind using Shiny

R 19. November 2015

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 Læs mere »

Distance matrix calculations in R

R 7. July 2015

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: Læs mere »

Publishing R markdown to WordPress

R 31. March 2015

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')
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 plugins you may have to change the code a bit.

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

R 19. March 2015

I recent migrated my R package mdp from my R-forge svn repo to GitHub. Do the following:

  1. 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)
  2. 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 the main repo. That is, add files, make changes to the master branch and commit to the master branch and GitHub as usual. At some point in time you want to commit the current revision to the remote svn repo at R-forge (so that the package can be checked at different OS etc.):

git svn info               # show svn details (also URL)
git svn dcommit –-dry-run  # show which svn branch you will commit into:
git svn rebase             # pull changes from svn repository
git svn dcommit            # push your local git commits to svn repository


Using RStudio together with Git and GitHub on Windows

R 11. March 2015

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. Læs mere »

Converting a multidimensional index to a single unique id

R, Research 17. May 2010

I have written a small note about mapping a multidimensional index into a unique id. An unique id might be useful e.g. when having multiple state variables in an
Markov decision process. Here each state at a stage may be identified using the id.

R package testcpp now at R-Forge

R 29. September 2009

I recent wrote a post about testing external pointers with finalization in R using C++. The test package is now available at R-Forge for inspiration.

© Lars Relund Nielsen
Entries RSS Comments RSS Log in