Revision 1141 trunk/src/linad99/posfunc.cpp
posfunc.cpp (revision 1141)  

4  4 
* Author: David Fournier 
5  5 
* Copyright (c) 20082012 Regents of the University of California 
6  6 
*/ 
7 
/** 

8 
* \file 

9 
* Description not yet available. 

10 
*/ 

7  
8 
/** \file posfunc.cpp 

9 
posfun(...) source code for constant arguments. 

10 
*/ 

11  
12  
11  13 
#include <fvar.hpp> 
12  14  
13  15 
/** 
14 
* Description not yet available. 

15 
* \param 

16 
Adjoint code for posfun; possibly not used. 

16  17 
*/ 
17  18 
double dfposfun(const double &x, const double eps) 
18  19 
{ 
...  ...  
31  32 
} 
32  33  
33  34 
/** 
34 
* Description not yet available. 

35 
* \param 

35 
Adjoint code for posfun; possibly not used. 

36  36 
*/ 
37  37 
double dfposfun1(const double &x, const double eps) 
38  38 
{ 
...  ...  
48  48 
} 
49  49  
50  50 
/** 
51 
* Description not yet available. 

52 
* \param 

51 
Retuns a positive function of the argument \f$x\f$ and sets a penalty for 

52 
\f$x<0\f$. The penalty should be added to the objective function. 

53 
\param x Argument, \f$x\f$. 

54 
\param eps Threshold, \f$\epsilon\f$, 

55 
a double constant containing the minimum allowed value of \f$x\f$. 

56 
\param _pen The penalty value \b incremented by \f$ 0.01(x\epsilon)^2 \f$ 

57 
if \f$x<\epsilon\f$. 

58 
\return \f$\left\{\begin{array} {r@{\quad:\quad}l} 

59 
x\ge\epsilon & x\\ 

60 
x<\epsilon & \frac{\epsilon}{2x/\epsilon} 

61 
\end{array}\right.\f$ 

62 
\ingroup misc 

53  63 
*/ 
54  64 
double posfun(const double &x, const double eps, const double& _pen) 
55  65 
{ 
...  ...  
67  77 
} 
68  78  
69  79 
/** 
70 
* Description not yet available. 

71 
* \param 

80 
Retuns a positive function of the argument \f$x\f$ and sets a penalty for 

81 
\f$x<0\f$. The penalty should be added to the objective function. 

82 
A more coersive version. 

83 
\param x Argument, \f$x\f$. 

84 
\param eps Threshold, \f$\epsilon\f$, 

85 
a double constant containing the minimum allowed value of \f$x\f$. 

86 
\param _pen The penalty value \b incremented by \f$ 0.01(x\epsilon)^3 \f$ 

87 
if \f$x<\epsilon\f$. 

88 
\return \f$\left\{\begin{array} {r@{\quad:\quad}l} 

89 
x\ge\epsilon & x\\ 

90 
x<\epsilon & \frac{\epsilon}{1+x/\epsilon 

91 
+(x/\epsilon)^2 

92 
+(x/\epsilon)^3} 

93 
\end{array}\right.\f$ 

94 
\ingroup misc 

72  95 
*/ 
73  96 
double posfun2(const double &x, const double eps, const double& _pen) 
74  97 
{ 
Also available in: Unified diff