# Yearly Archives: 2009

12 posts

## New position

From the first of November 2009 I will be working as a Associate Professor at CORAL, Aarhus School of Business, University of Aarhus. I will be doing both research and teaching.

## Koens økonomiske værdi

I oktober nummeret af Ny Kvægforskning er der på side 8 en artikel om vores udskiftningsmodel baseret på daglige ydelsesmålinger.

## How to replace cows optimally

The 16th of October I gave a presentation to a group of students at KU Life about optimal replacement policies for dairy cows based on daily yield measurements. A hierarchical Markov decision process is used to solve the problem. The following downloads are available: presentation – handouts (2×2) – animation 1 2 3

## R package testcpp now at R-Forge

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.

## Erratum

Erratum to “An algorithm for ranking assignments using reoptimization” [Computers and Operations Research 35 (2008) 3714-3726] is now available on-line. As pointed out by Dr. A. Volgenant, we unfortunately missed one available implementation written by Miller et al. in IEEE Transactions on Aerospace and Electronic Systems.

## New article published

The paper “Time-adaptive versus history-adaptive strategies for multicriterion routing in stochastic time-dependent networks” have been published in OR letters.

## Accessing an array created in R from C++

Assume that you have created a 3-dim array in R containing vectors of various size: > a<-array(list(),c(2,2,2))   # array where each element contain a numeric vector > a[[1,1,1]]<-rnorm(1) > a[[1,1,2]]<-rnorm(3) > a[[2,1,1]]<-rnorm(2) > a[[2,1,2]]<-rnorm(3) > a[[1,2,1]]<-rnorm(4) > a[[1,2,2]]<-rnorm(3) > a[[2,2,1]]<-rnorm(5) > a[[2,2,2]]<-rnorm(1) > d = dim(a) > d [1] 2 2 2 > i<-1; j<-1; k<-2 > q<-i + j*d[1] + k*(d[1]*d[2]) – (d[1] + d[1]*d[2]) > a[[i,j,k]]      # access an element [1] -0.2370040 -0.6009635  3.0550405 > a[[q]]          # access the same element using a single index [1] -0.2370040 -0.6009635  3.0550405 Note you can access the array in two ways. Next you want to copy the array to a vector on the C++ side. For instance in a package you may need to do some operations in C++ to speed up time. On the C++ side you can create a function:

## EURO Summer Institute 2009 (ESI 2009)

Aim of ESI 2009 is to bring together young scientists with academic experts on OR methods besides the development of applications for Agriculture, Forestry and related industries of the primary sector. Anders Ringgaard Kristensen and I will the first day talk about Markov decision processes (MDPs) for sequential decision problems in agriculture and forestry. First the theory of MDPs will be presented and next I will give an introduction to my new MDP package in R. The files needed for the exercises can be found here.

## Optimering af foderplanlægning med NorFor Plan

NorFor Plan, der er et system til rationsoptimering, inddrager ikke de økonomiske sammenhænge på den enkelte bedrift og dermed optimering af fodringsøkonomien i den enkelte besætning. Økonomisk optimering er vigtig i en tid, hvor der er stigende fokusering på effektivisering i malkekvægsbesætninger og større udsving i priser på foder og mælk. I 2008 har jeg været involveret i et udredningsarbejde, som skulle opstille en anbefaling for udvikling af et beslutningsstøtteværktøj til økonomisk foderoptimering i den enkelte besætning baseret på NorFor Plan. Resultatet af arbejdet er en intern rapport.

## Testing external pointers with finalization in R using C++

I the past days I have been experimenting with how to use R as an interface to an C++ library. I have made a small test package in R that show how it can be done. The idea is to be able to create a C++ object from R and call methods of the C++ class from R before freeing the object from memory in R. The package/function description goes as follows: