ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
boundfun.cpp File Reference

(Last Changed on February 17, 2022 for git-revision e9b921f3a6f970f4a53398d141831583cf8746df.)

Code to implement placing constraints on parameters. See in Section 10.1 of the AUTODIF manual. The code in thse section of the AUTODIF manual appears to be out of date with respect to some of the code in this file. More...

#include "fvar.hpp"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

Go to the source code of this file.

Macros

#define USE_BARD_PEN
 

Functions

dvariable boundp (const prevariable &x, double fmin, double fmax, const prevariable &_fpen, double s)
 Compute penalty for exceeding bounds on parameter; variable ojbects. More...
 
dvariable boundp (const prevariable &x, double fmin, double fmax, const prevariable &_fpen)
 Compute penalty for exceeding bounds on parameter; variable ojbects. More...
 
double boundp (double x, double fmin, double fmax)
 Return scaled variable to original units; constant objects. More...
 
double boundp (double x, double fmin, double fmax, const double &_fpen)
 Compute penalty for exceeding bounds on parameter; constant ojbects. More...
 
double boundpin (double x, double fmin, double fmax, double s)
 Scale model variable over [-1,1]; constant objects. More...
 
double boundpin (double x, double fmin, double fmax)
 Scale model variable over [-1,1]; constant objects. More...
 
double boundpin (const prevariable &x, double fmin, double fmax, double s)
 Scale model variable over [-1,1]; variable objects. More...
 
double boundpin (const prevariable &xx, double fmin, double fmax)
 Scale model variable over [-1,1]; variable objects. More...
 
dvariable dfatan1 (dvariable x, double fmin, double fmax, const prevariable &_fpen)
 Scale input variable between upper and lower bounds and compute a penalty for exceeding the bounds. More...
 
dvariable dfboundp (const prevariable &x, double fmin, double fmax)
 Computes the derivative of dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen) More...
 
double dftinv (double x, double fmin, double fmax)
 Inverse of dvariable dfatan1(dvariable x, double fmin, double fmax, const prevariable& _fpen) More...
 
double dmax (double x, double y)
 Returns the maximum of two numbers. More...
 
double dmin (double x, double y)
 Returns the minimum of two numbers. More...
 
double nd2fboundp (double x, double fmin, double fmax, const double &fpen)
 Scale input variable between upper and lower bounds and compute a penalty for exceeding the bounds. More...
 
double ndfboundp (double x, double fmin, double fmax, const double &fpen)
 Derivatative code for double nd2fboundp( double x, double fmin, double fmax,const double& fpen) More...
 

Detailed Description

Code to implement placing constraints on parameters. See in Section 10.1 of the AUTODIF manual. The code in thse section of the AUTODIF manual appears to be out of date with respect to some of the code in this file.

Author
David Fournier

Definition in file boundfun.cpp.

Macro Definition Documentation

#define USE_BARD_PEN

Use penalties recomended in Bard, Y. (1974) Nonlinear parameter estimation. Academic Press, New York.

Definition at line 18 of file boundfun.cpp.

Function Documentation

dvariable boundp ( const prevariable x,
double  fmin,
double  fmax,
const prevariable _fpen,
double  s 
)

Compute penalty for exceeding bounds on parameter; variable ojbects.

Parameters
xVariable scaled between [-1,1]
fminLower bound of x
fminUpper bound of x
_fpenOn return, contains penalty if x > 1 or x < -1
sDivide x by s before scaling and setting bounds
Returns
The variable x in original units

Definition at line 89 of file boundfun.cpp.

Referenced by boundp(), nd2fboundp(), funnel_init_df1b2variable::set_value(), funnel_init_bounded_df1b2vector::set_value(), random_effects_bounded_vector_info::set_value(), re_df1b2_init_bounded_vector::set_value(), set_value(), set_value_partial(), and param_init_bounded_matrix::shared_set_value().

dvariable boundp ( const prevariable x,
double  fmin,
double  fmax,
const prevariable _fpen 
)

Compute penalty for exceeding bounds on parameter; variable ojbects.

Parameters
xVariable scaled between [-1,1]
fminLower bound of x
fminUpper bound of x
_fpenOn return, contains penalty if x > 1 or x < -1
Returns
The variable x in original units

Definition at line 102 of file boundfun.cpp.

double boundp ( double  x,
double  fmin,
double  fmax 
)

Return scaled variable to original units; constant objects.

Parameters
xVariable scaled between [-1,1]
fminLower bound of x
fminUpper bound of x
Returns
The variable x in original units

Definition at line 244 of file boundfun.cpp.

double boundp ( double  x,
double  fmin,
double  fmax,
const double &  _fpen 
)

Compute penalty for exceeding bounds on parameter; constant ojbects.

Inverse of double boundp(const double& x, double fmin, double fmax, const double& _fpen).

Parameters
xModel variable
fminLower bound of x
fminUpper bound of x
_fpenOn return, contains penalty if x > fmax or x < fmin
Returns
The variable x in original units

Definition at line 310 of file boundfun.cpp.

double boundpin ( double  x,
double  fmin,
double  fmax,
double  s 
)

Scale model variable over [-1,1]; constant objects.

Inverse of double boundp(double x, double fmin, double fmax)

Parameters
xModel variable
fminLower bound of x
fminUpper bound of x
sDivide x by s before scaling and setting bounds
Returns
The variable x in original units

Definition at line 378 of file boundfun.cpp.

Referenced by boundpin(), param_init_bounded_vector::mc_scale(), param_init_bounded_number::mc_scale(), set_value_inv(), set_value_inv_partial(), param_init_bounded_matrix::shared_set_value_inv(), and funnel_init_df1b2variable::xinit().

double boundpin ( double  x,
double  fmin,
double  fmax 
)

Scale model variable over [-1,1]; constant objects.

Inverse of double boundp(double x, double fmin, double fmax)

Parameters
xModel variable
fminLower bound of x
fminUpper bound of x
Returns
Scaled model variable over [-1,1].

Definition at line 391 of file boundfun.cpp.

double boundpin ( const prevariable x,
double  fmin,
double  fmax,
double  s 
)

Scale model variable over [-1,1]; variable objects.

Inverse of dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen, double s).

Parameters
xModel variable
fminLower bound of x
fminUpper bound of x
sDivide x by s before scaling and setting bounds
Returns
Scaled model variable over [-1,1].

Definition at line 434 of file boundfun.cpp.

double boundpin ( const prevariable xx,
double  fmin,
double  fmax 
)

Scale model variable over [-1,1]; variable objects.

Inverse of dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen).

Parameters
xModel variable
fminLower bound of x
fminUpper bound of x
Returns
Scaled model variable over [-1,1].

Definition at line 447 of file boundfun.cpp.

dvariable dfatan1 ( dvariable  x,
double  fmin,
double  fmax,
const prevariable _fpen 
)

Scale input variable between upper and lower bounds and compute a penalty for exceeding the bounds.

Parameters
xVariable to be scaled
fminLower bound of x
fminUpper bound of x
_fpenOn return, contains penalty if x > fmax or x < fmin
Returns
Scaled value of x between fmin and fmax in the range [-1,1]

Definition at line 37 of file boundfun.cpp.

dvariable dfboundp ( const prevariable x,
double  fmin,
double  fmax 
)

Computes the derivative of dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen)

Parameters
xVariable to be scaled
fminLower bound of x
fminUpper bound of x
Returns
Derivative of scaled variable

Definition at line 170 of file boundfun.cpp.

Referenced by param_init_bounded_vector::sd_vscale(), param_init_bounded_number::sd_vscale(), and param_init_bounded_matrix::sd_vscale().

double dftinv ( double  x,
double  fmin,
double  fmax 
)

Inverse of dvariable dfatan1(dvariable x, double fmin, double fmax, const prevariable& _fpen)

Parameters
xVariable to be scaled
fminLower bound of x
fminUpper bound of x

Definition at line 66 of file boundfun.cpp.

double dmax ( double  x,
double  y 
)

Returns the maximum of two numbers.

Parameters
xFirst number
ySecond number

Definition at line 505 of file boundfun.cpp.

double dmin ( double  x,
double  y 
)

Returns the minimum of two numbers.

Parameters
xFirst number
ySecond number

Definition at line 489 of file boundfun.cpp.

double nd2fboundp ( double  x,
double  fmin,
double  fmax,
const double &  fpen 
)

Scale input variable between upper and lower bounds and compute a penalty for exceeding the bounds.

Intended for use with df1b2 variables.

Parameters
xVariable to be scaled
fminLower bound of x
fminUpper bound of x
_fpenOn return, contains penalty if x > fmax or x < fmin
Returns
Scaled value of x between fmin and fmax in the range [-1,1]

Definition at line 282 of file boundfun.cpp.

Referenced by param_init_bounded_vector::curv_scale(), param_init_bounded_number::curv_scale(), and param_init_bounded_matrix::curv_scale().

double ndfboundp ( double  x,
double  fmin,
double  fmax,
const double &  fpen 
)

Derivatative code for double nd2fboundp( double x, double fmin, double fmax,const double& fpen)

Parameters
xVariable to be scaled
fminLower bound of x
fminUpper bound of x
fpenUnchanged on return.
Returns
Derivative of scaled variable

Definition at line 210 of file boundfun.cpp.

Referenced by param_init_bounded_vector::mc_scale(), param_init_bounded_number::mc_scale(), param_init_bounded_matrix::mc_scale(), param_init_bounded_vector::sd_scale(), param_init_bounded_number::sd_scale(), param_init_bounded_matrix::sd_scale(), df1b2_init_bounded_number::sd_scale(), df1b2_init_bounded_vector::sd_scale(), and df1b2_init_bounded_matrix::sd_scale().