8 using std::istringstream;
19 double fval,
double gmax,
const char * cbuf);
30 long int& option_value);
32 long long int& option_value);
65 # if defined(__MINI_MAX__)
73 cerr <<
"option -mm MINI_MAX not defined " <<
endl;
91 cerr <<
"Usage -maxph option needs integer -- ignored" <<
endl;
98 cerr <<
"Usage -maxph option needs positive integer -- ignored.\n";
123 cerr <<
"Usage -ndv option needs integer -- ignored" <<
endl;
130 cerr <<
"Usage -ndv option needs positive integer -- ignored.\n";
144 cerr <<
"Usage -maxph option needs integer -- ignored" <<
endl;
151 cerr <<
"Usage -maxfn option needs positive integer -- ignored.\n";
165 cerr <<
"Usage -crit option needs number -- ignored" <<
endl;
174 cerr <<
"Usage -crit option needs positive number -- ignored.\n";
183 cerr <<
"Usage -bw option needs number -- ignored" <<
endl;
193 cerr <<
"Usage -bw option needs positive number -- ignored" <<
endl;
207 cerr <<
" Invalid option following command line option -phase -- "
208 <<
endl <<
" phase set equal to 1" <<
endl;
220 output_stream <<
"Set current phase to " << jj <<
endl;
226 auto idx1 = fullpath.rfind(
"\\");
227 auto idx2 = fullpath.rfind(
".");
228 auto total = idx2 - idx1 - 1;
229 std::string model_name = fullpath.substr(idx1 + 1, total);
231 auto idx1 = fullpath.rfind(
"/");
232 if (idx1 > 0) ++idx1;
233 std::string model_name = fullpath.substr(idx1);
235 time_t now = time(0);
236 tm* localtm = localtime(&now);
238 cout <<
"Starting optimization of '";
240 cout <<
"Starting RE optimization of '";
242 cout << model_name <<
"' in phase " <<
265 cerr <<
"Error -- no active parameters. There must be at least 1"
278 ifstream ifs(
"vector");
281 cerr <<
"couldn't open file vector" <<
endl;
290 cerr <<
"couldn't read vector" <<
endl;
300 cout <<
"enter delta" <<
endl;
324 for (
int i=1;i<=nvar+1;i++)
330 cerr <<
"The -simplex option is deprecated. The user should port "
331 <<
"to the -neldmead option." <<
endl;
340 double* pynewlo = &ynewlo;
341 int icount, numres, ifault;
342 int* picount = &icount;
343 int* pnumres = &numres;
344 int* pifault = &ifault;
345 neldmead(nvar,mincords,mincords,pynewlo,ftol,delta,picount,pnumres,
355 cerr <<
"At present you can not use the -lmn option for the outer"
356 <<
endl <<
" optimiation in a random-effects model" <<
endl;
361 cerr <<
"Usage -lmn option needs integer -- set to default 10.\n";
368 cerr <<
"Usage -lmn option needs positive integer"
369 " -- set to default 10.\n";
385 #if defined(USE_ADPVM)
403 cerr <<
"error illega value for pvm_manager->mode" <<
endl;
421 cerr <<
"error illega value for pvm_manager->mode" <<
endl;
450 cerr <<
"Usage -lmn2 option needs integer"
451 " -- set to default 5" <<
endl;
458 cerr <<
"Usage -lmn2 option needs positive integer "
459 " -- set to default 5" <<
endl;
496 #if defined(USE_ADPVM)
509 cerr <<
"Illegal value for ad_comm::pvm_manager->mode" <<
endl;
515 #endif //#if defined(USE_ADPVM)
517 #if defined(USE_ADPVM)
519 #endif //#if defined(USE_ADPVM)
523 (*lapprox)(
x,f,
this);
555 robust_hybrid_flag(0),
581 "-ams option needs positive integer -- ignored",ssz);
582 if (nopt>-1 && ssz>0) {
587 "Warning: Invalid non-positive argument for command line option -mip.", ssz);
597 cerr <<
"Warning: Invalid non-positive argument for command line option -mip.\n"
609 "-cbs option needs positive integer -- ignored",lssz);
610 if (nopt>-1 && lssz>0) {
611 const size_t size = (size_t)lssz;
616 "-gbs option needs positive integer -- ignored",lssz);
617 if (nopt>-1 && lssz>0) {
663 for (i=2;i<=nvar+1;i++)
670 for (i=1;i<=nvar+1;i++)
704 long int& option_value)
706 long long int& option_value)
721 #if defined(__BORLANDC__) || defined(_MSC_VER)
893 ofstream ofs(
"is_diagnostics");
894 ofs <<
"number of importance samples "
896 ofs <<
"importance_sampling_values" <<
endl;
898 ofs <<
"normalized importance_sampling_values" <<
endl;
900 ofs <<
"sorted normalized importance_sampling_values" <<
endl;
901 ofs << setw(9) << tmp << endl<<
endl;;
902 ofs <<
"epsilon(1).indexmax() "
905 dmatrix plotstuff(1,2,mmin,mmax);
908 ofs <<
" weight value " <<
endl;
static int NUM_DEPENDENT_VARIABLES
laplace_approximation_calculator * lapprox
static adpvm_manager * pvm_manager
void set_multinomial_weights(dvector &d)
void trust_region_update(int nvar, int _crit, independent_variables &x, const dvector &_g, const double &_f)
Description not yet available.
dvector * multinomial_weights
Description not yet available.
void begin_funnel_stuff(void)
int separable_calls_counter
void quasi_newton_block_pvm_master(int nvar, int _crit, independent_variables &x, const dvector &g, const double &f)
static void set_NO_DERIVATIVES(void)
Disable accumulation of derivative information.
Description not yet available.
static void set_GRADSTACK_BUFFER_SIZE(const size_t i)
Set the number of entries contained in the buffer that, in turn, contains the information necessary f...
void limited_memory_quasi_newton_block(int nvar, int _crit, independent_variables &x, const dvector &_g, const double &_f, int nsteps)
Description not yet available.
function_minimizer(long int sz=0L)
dmatrix trans(const dmatrix &m1)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Vector of double precision numbers.
static int inner_opt_flag
void quasi_newton_block_pvm_master_random_effects(int nvar, int _crit, independent_variables &x, const dvector &g, const double &f)
int indexmin() const
Get minimum valid index.
void get_function_difference(void)
void neldmead(int n, dvector &_start, dvector &_xmin, double *ynewlo, double reqmin, double delta, int *icount, int *numres, int *ifault)
Nelder-Mead simplex alogrithm.
dvar_matrix * importance_sampling_components
void set_initial_simplex(const dmatrix &p, const dvector &y, int nvar, const dvector &x, double delta)
void other_separable_stuff_begin(void)
static int max_num_initial_params
static int sparse_hessian_flag
Holds derivative information for arithmetic operators and math library functions. ...
static int inner_opt(void)
int importance_sampling_counter
static dvariable reset(const dvar_vector &x)
dvector * importance_sampling_weights
void ad_update_function_minimizer_report(int feval, int iter, int phase, double fval, double gmax, const char *cbuf)
virtual void between_phases_calculations(void)
double mean(const dvector &vec)
Returns computed mean of vec.
dvector * importance_sampling_values
int get_option_number(const char *option_name, const char *error_message, int &option_value)
Description not yet available.
int atoi(adstring &s)
Returns a integer converted from input s.
void adamoeba(const dmatrix &p, const dvector &y, int ndim, double ftol, int maxfn)
Nelder-Mead simplex alogrithm.
int num_importance_samples
void limited_memory_quasi_newton(const independent_variables &, int)
dmatrix sort(const dmatrix &m, int column, int NSTACK)
Description not yet available.
void end_get_importance_sampling_comnponent(void)
prnstream & endl(prnstream &)
Description not yet available.
static dvector maximum_function_evaluations
static int max_number_phases
void pvm_slave_function_evaluation_no_derivatives(void)
void begin_gauss_hermite_stuff(void)
int indexmax() const
Get maximum valid index.
void check_java_flags(int &start_flag, int &quit_flag, int &der_flag, int &next_flag)
void other_separable_stuff_end(void)
int in_gauss_hermite_phase
static objective_function_value * pobjfun
Description not yet available.
static void xinit(const dvector &x)
virtual void report(const dvector &gradients)
void allocate(unsigned int init_size)
Construct array with init_size.
void function_evaluation_block_pvm_slave(void)
static void set_inactive_random_effects(void)
Description not yet available.
double fill_seqadd(double, double)
Description not yet available.
static void set_CMPDIF_BUFFER_SIZE(const size_t i)
Set the size in bytes of the buffer used to contain the information generated by the "precompiled" de...
int option_match(int argc, char *argv[], const char *string)
Checks if the program has been invoked with a particular command line argument ("string").
int no_function_component_flag
std::ostream & get_output_stream()
void set_initial_simplex(const tdmatrix &p, const dvector &y, int nvar, const dvector &x, double delta)
void quasi_newton_block(int nvar, int crit, independent_variables &x, const dvector &g, const double &f)
Description not yet available.
void pvm_master_function_evaluation_no_derivatives(double &f, independent_variables &x, int nvar)
void print_is_diagnostics(laplace_approximation_calculator *lapprox)
void report_function_minimizer_stats(void)
void end_gauss_hermite_stuff(void)
dvar_matrix gauss_hermite_values
static int saddlepointflag
Description not yet available.
virtual ~function_minimizer()
Destructor.
void end_df1b2_funnel_stuff(void)
static int negative_eigenvalue_flag
dvector value(const df1_one_vector &v)
virtual void userfunction(void)=0
class for things related to the gradient structures, including dimension of arrays, size of buffers, etc.
void function_evaluation_block_pvm_slave_random_effects(void)
void tracing_message(int traceflag, const char *s)
Description not yet available.
static dvector convergence_criteria
int ad_printf(FILE *stream, const char *format, Args...args)
static int print_importance_sampling_weights_flag
static void set_inactive_only_random_effects(void)
static int random_effects_flag
static adlist_ptr varsptr
dvector * separable_function_difference
void deallocate(void)
Called by destructor to deallocate memory for a dvector object.
void start_get_importance_sampling_comnponent(void)
virtual void minimize(void)