Bullet-proofing

Writing your objective function so that it cannot return NaN or otherwise crash can save a lot of grief. Insert something like if (((abs(obj_value) == Inf)) || (isnan(obj_value)))

obj_value = realmax;

endif

at the end of the objective function, and then return obj_value. This way, parameter values that lead to crashes are penalized, and will be avoided automatically.



Søren Hauberg 2008-04-29