Revision 1599 trunk/src/linad99/boundfun.cpp
boundfun.cpp (revision 1599)  

5  5 
* Copyright (c) 20082012 Regents of the University of California 
6  6 
*/ 
7  7 
/** 
8 
* \file 

9 
* Description not yet available. 

10 
*/ 

8 
\file boundfun.cpp 

9 
\brief Code to implement placing constraints on parameters. 

10 
See in Section 10.1 of the AUTODIF manual. 

11 
The code in thse section of the AUTODIF manual appears to be 

12 
out of date with respect to some of the code in this file. 

13 
*/ 

11  14 
#include "fvar.hpp" 
12 
//#ifdef __TURBOC__ 

13 
//# pragma hdrstop 

14 
//#endif 

15  15  
16 
/** 

17 
\details Use penalties recomended in Bard, Y. (1974) Nonlinear parameter estimation. 

18 
Academic Press, New York. 

19 
*/ 

16  20 
#define USE_BARD_PEN 
17  21  
18  22 
#include <stdlib.h> 
19  23 
#include <stdio.h> 
20  24 
#include <math.h> 
21  25  
22 
double dmin(double,double); 

23 
double dmax(double, double); 

26 
// function prototypes duplicated in fvar.hpp 

27 
// double dmin(double, double); 

28 
// double dmax(double, double); 

24  29  
25  30 
/** 
26 
* Description not yet available. 

27 
* \param 

31 
Scale input variable between upper and lower bounds 

32 
and compute a penalty for exceeding the bounds. 

33 
\param x Variable to be scaled 

34 
\param fmin Lower bound of x 

35 
\param fmin Upper bound of x 

36 
\param _fpen On return, contains penalty if x > fmax or x < fmin 

37 
\return Scaled value of x between fmin and fmax in the range [1,1] 

28  38 
*/ 
29  39 
dvariable dfatan1(dvariable x, double fmin, double fmax, const prevariable& _fpen) 
30  40 
{ 
...  ...  
49  59 
} 
50  60  
51  61 
/** 
52 
* Description not yet available. 

53 
* \param 

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

63 
\param x Variable to be scaled 

64 
\param fmin Lower bound of x 

65 
\param fmin Upper bound of x 

54  66 
*/ 
55  67 
double dftinv(double x, double fmin, double fmax) 
56  68 
{ 
...  ...  
69  81 
} 
70  82  
71  83 
/** 
72 
* Description not yet available. 

73 
* \param 

74 
*/ 

84 
Scale input variable between upper and lower bounds 

85 
and compute a penalty for exceeding the bounds. 

86 
\param x Variable to be scaled 

87 
\param fmin Lower bound of x 

88 
\param fmin Upper bound of x 

89 
\param _fpen On return, contains penalty if x > fmax or x < fmin 

90 
\param s Divide x by s before scaling and setting bounds 

91 
\return Scaled value of x between fmin and fmax in the range [1,1] 

92 
*/ 

75  93 
dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen,double s) 
76  94 
{ 
77  95 
return boundp(x/s,fmin,fmax,_fpen); 
78  96 
} 
79  97  
80  98 
/** 
81 
* Description not yet available. 

82 
* \param 

83 
*/ 

99 
Scale input variable between upper and lower bounds 

100 
and compute a penalty for exceeding the bounds. 

101 
\param x Variable to be scaled 

102 
\param fmin Lower bound of x 

103 
\param fmin Upper bound of x 

104 
\param _fpen On return, contains penalty if x > fmax or x < fmin 

105 
\return Scaled value of x between fmin and fmax in the range [1,1] 

106 
*/ 

84  107 
dvariable boundp(const prevariable& x, double fmin, double fmax,const prevariable& _fpen) 
85  108 
{ 
86  109 
if (gradient_structure::Hybrid_bounded_flag==0) 
Also available in: Unified diff