ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
Defines | Functions
boundfun.cpp File Reference

(* $Id$)

Code to implement placing constraints on parameters. More...

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

Go to the source code of this file.

Defines

#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.
dvariable boundp (const prevariable &x, double fmin, double fmax, const prevariable &_fpen)
 Compute penalty for exceeding bounds on parameter; variable ojbects.
double boundp (double x, double fmin, double fmax)
 Return scaled variable to original units; constant objects.
double boundp (double x, double fmin, double fmax, const double &_fpen)
 Compute penalty for exceeding bounds on parameter; constant ojbects.
double boundpin (double x, double fmin, double fmax, double s)
 Scale model variable over [-1,1]; constant objects.
double boundpin (double x, double fmin, double fmax)
 Scale model variable over [-1,1]; constant objects.
double boundpin (const prevariable &x, double fmin, double fmax, double s)
 Scale model variable over [-1,1]; variable objects.
double boundpin (const prevariable &xx, double fmin, double fmax)
 Scale model variable over [-1,1]; variable objects.
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.
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)
double dftinv (double x, double fmin, double fmax)
 Inverse of dvariable dfatan1(dvariable x, double fmin, double fmax, const prevariable& _fpen)
double dmax (double x, double y)
 Returns the maximum of two numbers.
double dmin (double x, double y)
 Returns the minimum of two numbers.
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.
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)

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.

Definition in file boundfun.cpp.


Define Documentation

#define USE_BARD_PEN

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

Definition at line 21 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 95 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 108 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 250 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 316 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 384 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 397 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 444 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 457 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 40 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 176 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 69 of file boundfun.cpp.

double dmax ( double  x,
double  y 
)

Returns the maximum of two numbers.

Parameters:
xFirst number
ySecond number

Definition at line 519 of file boundfun.cpp.

double dmin ( double  x,
double  y 
)

Returns the minimum of two numbers.

Parameters:
xFirst number
ySecond number

Definition at line 503 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 288 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 216 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().