[R] Minimizing two non-linear functions with genoud - Trying to minimize or converge near zero

Guillaume Théroux Rancourt Guillaume.Theroux-Rancourt at fsaa.ulaval.ca
Thu Feb 4 21:00:18 CET 2010

Hello R users,

I am trying to minimize two functions with genoud. It is actually one function with two sets of data, each of them having two unknown variables (called Vcmax and gi) which have the same value in each of the function. They are called f.1 and f.2 in the code below.

My objective to minimize the functions in order to get the two variables equal in each of the functions. Furthermore, I have a measured comparison value for each of the function expression, and the results of f.1 and f.2 should be very close or equal to their measured value, so that  measured.1 - f.1 = 0.

I have been able to run genoud with the code below. However, I haven't been able to restrain the values of the difference between the measured and estimated value to 0. I am fairly new at writing R functions and I think there might be something I haven't written that makes the output parameters of genoud not replicable.

I have made several runs of this function and when comparing with the measured value, I got answers between 1 and 12, where it should have been very close to 7.47.

This example has already been solved with the solver Excel add-in and theh result are:
Vcmax = 104.32, gi = 0.11

The values were also estimated using another approach and they are:
Vcmax = 64.48, gi = 0.28

Here is my code. 


f=function(x) { 

x = c(0.16,80)
Vcmax = x[2]
gi = x[1]

# First dataset

# Second data set

# Values here are the measured values. f.1 and f.2 should be equal or close to the value on their left.
y.1 = (7.478327 - f.1(x))
y.2 = (12.73134 - f.2(x))

# This should be close to 0.
y = y.1 - y.2


dom = matrix(c(0,0,200,1.5), 2, 2)

res = genoud(f, nvars=2, max=FALSE,Domains=dom,pop.size=5000,print.level=0)

# In order to test the results to see I the estimated variables make the "test" function = 7.478327 or near.
# This is the same as f.1

test=function(Vcmax, gi){


## End 

Thank you for your help!

Guillaume Théroux Rancourt
Ph.D. candidate --- Plant Biology
Université Laval, Québec, QC, Canada
guillaume.theroux-rancourt.1 at ulaval.ca

More information about the R-help mailing list