ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
mod_mc4.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00007 #include <admodel.h>
00008 
00009 double better_rand(long int&);
00010 
00011 double function_minimizer::get_monte_carlo_value(int nvar, const dvector& x)
00012 {
00013   //initial_params::xinit(x);
00014   double f=0.0;
00015   {
00016     dvariable vf=0.0;
00017     vf=initial_params::reset(dvar_vector(x));
00018     *objective_function_value::pobjfun=0.0;
00019     userfunction();
00020     vf+=*objective_function_value::pobjfun;
00021     f=value(vf);
00022   }
00023   return f;
00024 }