COPASI API  4.16.103
CPermutation.h
Go to the documentation of this file.
1 // Copyright (C) 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #ifndef COPASI_CPermutation
7 #define COPASI_CPermutation
8 
10 
11 class CRandom;
12 
14 {
15 private:
16  static size_t InvalidIndex;
17 
18  /**
19  * Default constructor
20  */
21  CPermutation();
22 
23 public:
24  /**
25  * Specific constructor
26  * @param CRandom * pRandom
27  * @param const size_t & size
28  */
29  CPermutation(CRandom * pRandom, const size_t & size);
30 
31  /**
32  * Copy constructor
33  * @param const CPermutation & src
34  */
35  CPermutation(const CPermutation & src);
36 
37  /**
38  * Destructor
39  */
40  ~CPermutation();
41 
42  /**
43  * Initialize the permutation
44  */
45  void init();
46 
47  /**
48  * Shuffle the permutation
49  * const size_t & swaps (Default: size of permutation)
50  */
51  void shuffle(const size_t & swaps = C_INVALID_INDEX);
52 
53  /**
54  * Pick a random element
55  */
56  const size_t & pick();
57 
58  /**
59  * Pick the next element
60  */
61  const size_t & next();
62 
63 private:
64  // Attributes
65  /**
66  * A pointer to the random number generator to be used
67  */
69 
70  /**
71  * A vector containing the permutation
72  */
74 
75  /**
76  * A pointer to the next index
77  */
78  size_t * mpNext;
79 
80  /**
81  * A pointer beyond the last index
82  */
83  size_t * mpBeyond;
84 };
85 
86 #endif // COPASI_CPermutation
size_t * mpBeyond
Definition: CPermutation.h:83
CVector< size_t > mVector
Definition: CPermutation.h:73
const size_t & next()
#define C_INVALID_INDEX
Definition: copasi.h:222
const size_t & pick()
void shuffle(const size_t &swaps=C_INVALID_INDEX)
static size_t InvalidIndex
Definition: CPermutation.h:16
size_t * mpNext
Definition: CPermutation.h:78
CRandom * mpRandom
Definition: CPermutation.h:68