Revision 1633
trunk/src/nh99/paral3re.cpp (revision 1633)  

1 
/* 

2 
* $Id$ 

3 
* 

4 
* Author: David Fournier 

5 
* Copyright (c) 20082012 Regents of the University of California 

6 
*/ 

7 
#if defined(USE_LAPLACE) 

8 
#include <df1b2fun.h> 

9 
#include <adrndeff.h> 

10 
#include <admodel.h> 

11  
12 
void function_minimizer::quasi_newton_block_pvm_master_random_effects 

13 
(int nvar,int _crit, 

14 
independent_variables& x,const dvector& _g,const double& _f) 

15 
{ 

16 
double & f= (double&)_f; 

17 
dvector& g=(dvector&) _g; 

18 
// ********************************************************* 

19 
// block for quasinewton minimization 

20 
tracing_message(traceflag,"C2"); 

21 
//int itnold=0; 

22 
fmm fmc(nvar); 

23 
int on1; 

24 
if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"nox"))>1) 

25 
{ 

26 
fmc.noprintx=1; 

27 
} 

28 
fmc.maxfn= maxfn; 

29 
int nopt=0; 

30 
if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"dd",nopt))>1) 

31 
{ 

32 
if (!nopt) 

33 
{ 

34 
cerr << "Usage iprint option needs integer  ignored" << endl; 

35 
fmc.iprint=iprint; 

36 
} 

37 
else 

38 
{ 

39 
int jj=atoi(ad_comm::argv[on1+1]); 

40 
fmc.dcheck_flag=jj; 

41 
} 

42 
} 

43 
nopt=0; 

44 
if ( (on1=option_match(ad_comm::argc,ad_comm::argv,"iprint",nopt))>1) 

45 
{ 

46 
if (!nopt) 

47 
{ 

48 
cerr << "Usage iprint option needs integer  ignored" << endl; 

49 
fmc.iprint=iprint; 

50 
} 

51 
else 

52 
{ 

53 
int jj=atoi(ad_comm::argv[on1+1]); 

54 
fmc.iprint=jj; 

55 
} 

56 
} 

57 
else 

58 
{ 

59 
fmc.iprint= iprint; 

60 
} 

61 
fmc.crit = crit; 

62 
fmc.imax = imax; 

63 
fmc.dfn= dfn; 

64 
fmc.scroll_flag= scroll_flag; 

65 
fmc.min_improve=min_improve; 

66 
tracing_message(traceflag,"D2"); 

67 
gradient_structure::set_YES_DERIVATIVES(); 

68 
// set convergence criterion for this phase 

69 
if (_crit) 

70 
{ 

71 
fmc.crit = _crit; 

72 
} 

73 
if (!(!convergence_criteria)) 

74 
{ 

75 
int ind=min(convergence_criteria.indexmax(), 

76 
initial_params::current_phase); 

77 
fmc.crit=convergence_criteria(ind); 

78 
} 

79 
if (!(!maximum_function_evaluations)) 

80 
{ 

81 
int ind=min(maximum_function_evaluations.indexmax(), 

82 
initial_params::current_phase); 

83 
fmc.maxfn= (int) maximum_function_evaluations(ind); 

84 
} 

85  
86  
87  
88 
int unvar=1; 

89 
if (random_effects_flag) 

90 
{ 

91 
initial_params::set_active_only_random_effects(); 

92 
//cout << nvar << endl; 

93 
unvar=initial_params::nvarcalc(); // get the number of active 

94 
initial_params::restore_start_phase(); 

95 
initial_params::set_inactive_random_effects(); 

96 
int nvar1=initial_params::nvarcalc(); // get the number of active 
Also available in: Unified diff