Model calibration with external optimizers

Posted by jarkki on
URL: http://quantlib.414.s1.nabble.com/Model-calibration-with-external-optimizers-tp7186.html

Hi,

I am trying to use the Differential Evolution algorithm and the Levenberg-Marquardt implementation of Manolis Lourakis to calibrate for example the Heston, Bates and Merton's jump diffusion models. What is the 'right' or the fastest way to implement the cost function?

I think it could work this way:
1. Create a vector of pointers to options and set the engine/model/process for each option
2. Pass this vector and other relevant data to the optimization routine/cost function
3. In the cost function, update the model parameters with the ones given by the optimization algorithm.
4. In the cost function, Call the option->NPV() for each of the options

I just don't know how to update the model parameters in the cost function. I suppose I should call the model->setParams(newParams), but how do I do this from the option object? Or should I use the CalibrationHelper object?

Thanks,
Jarkki