Debian Codegraph @

src/Algo/Optima.hpp

raw symbols SCIP
1 #cxx . . $ `<file>/src/Algo/Optima.hpp`/ifndef OPTIMA_HH
2 #define OPTIMA_HHcxx . . $ `src/Algo/Optima.hpp:2:9`!
3
4 #include "NRJ.hpp"cxx . . $ `<file>/src/Algo/NRJ.hpp`/
5 #include <limits.h>
6 #include "defs.hpp"cxx . . $ `<file>/src/Algo/defs.hpp`/
7
8 #define MAX_IT_OPTcxx . . $ `src/Algo/Optima.hpp:8:9`! 1000
9
10 //==================
11 // define the base class for optimization classes
12 // H. Lydia Deng, 03/14/94
13 //======================
14
15 /*
16 This is the base class for general optimization classes.
17 Classes derived from this class inherit features of
18 Optima. This class cannot be instantiated directly.
19 */
20
21 // WARNING :
22 // No copy constructor
23 // No copy operator =
24
25 template< class LS >
26 class Optimacxx . . $ Optima# {
27 typedef typename LS::Real Realcxx . . $ Optima#Real#;
28 typedef typename LS::Param Paramcxx . . $ Optima#Param#;
29 typedef typename LS::Vect Vectcxx . . $ Optima#Vect#;
30 typedef typename LS::VMat VMatcxx . . $ Optima#VMat#;
31 typedef LS LineSearchcxx . . $ Optima#LineSearch#;
32 typedef listcxx . . $ list#< Realcxx . . $ Optima#Real# > mlistcxx . . $ Optima#mlist#;
33
34 protected:
35 // maximum number of iterations
36 int iterMaxcxx . . $ Optima#iterMax.;
37 int iterNumcxx . . $ Optima#iterNum.;
38 // tolerance error
39 // This is a tolerance on the euclidiean norm of the gradient
40 Realcxx . . $ Optima#Real# tolcxx . . $ Optima#tol.;
41 // mlist of residue
42 mlistcxx . . $ Optima#mlist#* residuecxx . . $ Optima#residue.;
43 // pointer to LS
44 LS* lscxx . . $ Optima#ls.;
45 // verbose or quiet
46 int isVerbosecxx . . $ Optima#isVerbose.;
47 // the flag indicating if the search was a success
48 int isSuccesscxx . . $ Optima#isSuccess.;
49 // append the new residue to the mlist
50 void appendResiduecxx . . $ Optima#appendResidue(51e82fb6181a0d1d).(Realcxx . . $ Optima#Real# res);
51
52 public:
53 Optimacxx . . $ Optima#`Optima<LS>`(d4f767463ce0a6b3).(int verb = 0);
54 virtual ~cxx . . $ Optima#`~Optima<LS>`(49f6e7a06ebc5aa8).Optima( );
55
56 virtual Paramcxx . . $ Optima#Param# optimizercxx . . $ Optima#optimizer(e033336ccb1d726c).(Paramcxx . . $ Optima#Param#&) = 0;
57
58 // Output residues
59
60 int ifSuccesscxx . . $ Optima#ifSuccess(b126dc7c1de90089).( );
61 // residue of the last iteration
62 Realcxx . . $ Optima#Real# finalResiduecxx . . $ Optima#finalResidue(fffa23a80432b1b8).( );
63 // residue of the first iteration
64 Realcxx . . $ Optima#Real# firstResiduecxx . . $ Optima#firstResidue(fffa23a80432b1b8).( );
65 // residues of all iterations
66 mlistcxx . . $ Optima#mlist# allResiduecxx . . $ Optima#allResidue(f8c41ee59a648f14).( );
67 // normalized residues of all iterations
68 mlistcxx . . $ Optima#mlist# normResiduecxx . . $ Optima#normResidue(f8c41ee59a648f14).( );
69 };
70
71 template< class LS >
72 Optimacxx . . $ Optima#< LS >::Optimacxx . . $ Optima#`Optima<LS>`(d4f767463ce0a6b3).(int verbose) {
73 residuecxx . . $ Optima#residue. = new mlistcxx . . $ Optima#mlist#;
74 isVerbosecxx . . $ Optima#isVerbose. = verbose;
75 isSuccesscxx . . $ Optima#isSuccess. = 0;
76 lscxx . . $ Optima#ls. = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!;
77 tolcxx . . $ Optima#tol. = 0.;
78 iterMaxcxx . . $ Optima#iterMax. = MAX_IT_OPTcxx . . $ `src/Algo/Optima.hpp:8:9`!;
79 }
80
81 template< class LS >
82 Optimacxx . . $ Optima#< LS >::~cxx . . $ Optima#`~Optima<LS>`(49f6e7a06ebc5aa8).Optima( ) {
83 if (residuecxx . . $ Optima#residue. !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). NULLcxx . . $ `<external>/16391990256953433862/stddef.h:416:9`!) delete residuecxx . . $ Optima#residue.;
84 }
85
86 // Output residues
87 template< class LS >
88 int Optimacxx . . $ Optima#< LS >::ifSuccesscxx . . $ Optima#ifSuccess(b126dc7c1de90089).( ) {
89 return isSuccesscxx . . $ Optima#isSuccess.;
90 }
91
92 template< class LS >
93 typename Optimacxx . . $ Optima#< LS >::Realcxx . . $ Optima#Real# Optimacxx . . $ Optima#< LS >::finalResiduecxx . . $ Optima#finalResidue(fffa23a80432b1b8).( ) {
94 return residuecxx . . $ Optima#residue.->backcxx . . $ std/__cxx11/list#back(ebe81142529c1f9a).( );
95 }
96
97 template< class LS >
98 typename Optimacxx . . $ Optima#< LS >::Realcxx . . $ Optima#Real# Optimacxx . . $ Optima#< LS >::firstResiduecxx . . $ Optima#firstResidue(fffa23a80432b1b8).( ) {
99 return residuecxx . . $ Optima#residue.->frontcxx . . $ std/__cxx11/list#front(ebe81142529c1f9a).( );
100 }
101
102 template< class LS >
103 typename Optimacxx . . $ Optima#< LS >::mlistcxx . . $ Optima#mlist# Optimacxx . . $ Optima#< LS >::allResiduecxx . . $ Optima#allResidue(f8c41ee59a648f14).( ) {
104 return *residuecxx . . $ Optima#residue.;
105 }
106
107 template< class LS >
108 typename Optimacxx . . $ Optima#< LS >::mlistcxx . . $ Optima#mlist# Optimacxx . . $ Optima#< LS >::normResiduecxx . . $ Optima#normResidue(f8c41ee59a648f14).( ) {
109 return normalizecxx . . $ normalize(72faf805eb51adfb).(*residuecxx . . $ Optima#residue.);
110 } // cf. defs.hpp
111
112 template< class LS >
113 void Optimacxx . . $ Optima#< LS >::appendResiduecxx . . $ Optima#appendResidue(51e82fb6181a0d1d).(Realcxx . . $ Optima#Real# res) {
114 (residuecxx . . $ Optima#residue.[0]).push_backcxx . . $ std/__cxx11/list#push_back(77d9f17553126ecb).(res);
115 }
116
117 #endif