Runnable slave of a portfolio master
| 65 | |
| 66 | /// Runnable slave of a portfolio master |
| 67 | class Slave { |
| 68 | protected: |
| 69 | /// The slave engine |
| 70 | Engine* slave; |
| 71 | /// Stop object |
| 72 | Stop* stop; |
| 73 | public: |
| 74 | /// Default constructor |
| 75 | Slave(void); |
| 76 | /// Copy constructor |
| 77 | Slave(const Slave& s) = default; |
| 78 | /// Assignment operator |
| 79 | Slave& operator =(const Slave& s) = default; |
| 80 | /// Initialize with slave \a s and its stop object \a so |
| 81 | void init(Engine* s, Stop* so); |
| 82 | /// Return next solution |
| 83 | Space* next(void); |
| 84 | /// Return statistics of slave |
| 85 | Statistics statistics(void) const; |
| 86 | /// Check whether slave has been stopped |
| 87 | bool stopped(void) const; |
| 88 | /// Constrain with better solution \a b |
| 89 | void constrain(const Space& b); |
| 90 | /// Perform one run |
| 91 | void run(void); |
| 92 | /// Delete slave |
| 93 | ~Slave(void); |
| 94 | }; |
| 95 | |
| 96 | /// Sequential portfolio engine implementation |
| 97 | template<bool best> |