-
Notifications
You must be signed in to change notification settings - Fork 16
/
SNESIMTree.h
84 lines (77 loc) · 2.39 KB
/
SNESIMTree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// (c) 2015-2020 I-GIS (www.i-gis.dk) and Thomas Mejer Hansen ([email protected])
//
// This file is part of MPSlib.
//
// MPSlib is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPSlib is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with MPSlib (COPYING.LESSER). If not, see <http://www.gnu.org/licenses/>.
//
#pragma once
#include "mpslib/SNESIM.h"
namespace MPS {
class SNESIMTree;
}
/**
* @brief An implementation of the SNESIM algorithm using a tree structure to store conditional statistics
*/
class MPS::SNESIMTree :
public MPS::SNESIM
{
protected:
/**
* @brief Structure for the tree node
*/
struct TreeNode {
public:
float value;
int counter;
int level;
std::vector<TreeNode> children;
};
/**
* @brief Search tree
*/
std::vector<TreeNode> _searchTree;
/**
* @brief MPS snesim simulation algorithm main function
* @param sgIdxX index X of a node inside the simulation grind
* @param sgIdxY index Y of a node inside the simulation grind
* @param sgIdxZ index Z of a node inside the simulation grind
* @param level level of the current grid
* @return found node's value
*/
virtual float _simulate(const int& sgIdxX, const int& sgIdxY, const int& sgIdxZ, const int& level);
/**
* @brief Abstract function allow acces to the beginning of each simulation of each multiple grid
* @param level the current grid level
*/
virtual void _InitStartSimulationEachMultipleGrid(const int& level);
public:
/**
* @brief Constructors from a configuration file
*/
SNESIMTree(const std::string& configurationFile);
/**
* @brief Initialize the simulation from a configuration file
* @param configurationFile configuration file name
*/
virtual void initialize(const std::string& configurationFile);
/**
* @brief Start the simulation
* Virtual function implemented from MPSAlgorithm
*/
virtual void startSimulation(void);
/**
* @brief Destructors
*/
virtual ~SNESIMTree(void);
};