20 double dmin(
double,
double);
21 double dmax(
double,
double);
36 const double l4=
log(4.0);
38 double diff=fmax-
fmin;
42 double pen=.00001/diff;
43 fpen=fpen-pen*(
log(ss+1.e-40)+
log((1.0-ss)+1.e-40)+l4);
48 fpen+=(x+0.9999)*(x+0.9999);
53 fpen+=(x-0.9999)*(x-0.9999);
58 fpen+=1000.*(x+1.)*(x+1.);
63 fpen+=1000.*(x-1.)*(x-1.);
73 double boundp(
double xx,
double fmin,
double fmax,
const double& _fpen,
76 double& fpen = (
double&)_fpen;
79 const double l4=
log(4.0);
80 double ss=(
sin(x*1.57079632679489661)+1.)/2.;
81 double diff=fmax-
fmin;
85 double pen=.00001/diff;
86 fpen-=pen*(
log(ss+1.e-40)+
log((1.0-ss)+1.e-40)+l4);
90 fpen+=(x+0.9999)*(x+0.9999);
95 fpen+=(x-0.9999)*(x-0.9999);
100 fpen+=1000*(x+1)*(x+1);
105 fpen+=1000*(x-1)*(x-1);
121 ad_printf(
"variable out of bounds in boundpin: variable = %lg", x);
125 x=
dmin(fmin+.001,fmin+.01*(fmax-fmin));
130 ad_printf(
"variable out of bounds in boundpin: variable = %lg", x);
134 x=
dmax(fmax-.001,fmax-.01*(fmax-fmin));
137 tinv=
::asin(2.*(x-fmin)/(fmax-fmin)-1.)/1.57079632679489661;
Base class for dvariable.
void fmin(double f, const independent_variables &x, const dvector &g, const int &n, const dvector &w, const dvector &h, const fmm_control &fmc)
d3_array sin(const d3_array &arr3)
Returns d3_array results with computed sin from elements in arr3.
double boundpin(double x, double fmin, double fmax, double s)
Scale model variable over [-1,1]; constant objects.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvariable boundp(const prevariable &x, double fmin, double fmax, const prevariable &_fpen, double s)
Compute penalty for exceeding bounds on parameter; variable ojbects.
Fundamental data type for reverse mode automatic differentiation.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int ad_printf(FILE *stream, const char *format, Args...args)
dvector asin(const dvector &vec)
Returns dvector with principal value of the arc sine of vec, expressed in radians.