Xmipp  v3.23.11-Nereus
KeepBests.h
Go to the documentation of this file.
1 /*
2 
3 CONDOR 1.06 - COnstrained, Non-linear, Direct, parallel Optimization
4  using trust Region method for high-computing load,
5  noisy functions
6 Copyright (C) 2004 Frank Vanden Berghen
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation version 2
11 of the License.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 
22 If you want to include this tools in any commercial product,
23 you can contact the author at fvandenb@iridia.ulb.ac.be
24 
25 */
26 
27 #ifndef __INCLUDE_KEEPBEST__
28 #define __INCLUDE_KEEPBEST__
29 
30 #define INF 1.7E+308
31 
32 #include <iosfwd>
33 
34 typedef struct cell_tag
35  {
36  double K;
37  double value;
38  double *optValue;
39  struct cell_tag *prev;
40  } cell;
41 
42 class KeepBests
43 {
44 public:
45  KeepBests(int n);
46  KeepBests(int n, int optionalN);
47  void setOptionalN(int optinalN);
48  ~KeepBests();
49  void reset();
50  void add(double key, double value);
51  void add(double key, double value, double optionalValue);
52  void add(double key, double value, double *optionalValue);
53  void add(double key, double value, double *optionalValue, int nn);
54  double getKey(int i);
55  double getValue(int i);
56  double getOptValue(int i, int n);
57  double* getOptValue(int i);
58  int sz() {return n;};
59 private:
60  void init();
61  cell *ctable,*end,*_local_getOptValueC;
62  int n,optionalN,_local_getOptValueI;
63 };
64 
65 #endif
double K
Definition: KeepBests.h:36
void reset(Image< double > &op)
#define i
double * optValue
Definition: KeepBests.h:38
struct cell_tag * prev
Definition: KeepBests.h:39
struct cell_tag cell
double value
Definition: KeepBests.h:37
int * n
int sz()
Definition: KeepBests.h:58