-
Notifications
You must be signed in to change notification settings - Fork 1
/
tree.hpp
58 lines (43 loc) · 1.37 KB
/
tree.hpp
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
#ifndef TREE_HPP
#define TREE_HPP
#include <list>
#include <vector>
#include "network.hpp"
#define ROOT_NODE 0
#define ARC_UP 0
#define ARC_DOWN 1
class TreeSolution {
private:
Network *network;
void determine_initial_tree();
void calc_initial_tree_structure();
void update_tree(Arc* entering, Arc* leaving, int join);
void update_thread_parent(int jOut, int iOut, int jNew, int iNew, int join);
void update_arc_dir(int jOut, int iOut, int jNew, int iNew, Arc *entering);
void update_depth_pot(int jOut, int iOut, int jNew, int iNew);
void print_structure();
public:
int *pred;
int *depth;
int *thread;
long *potential;
Arc **basic_arcs;
char *basic_arc_dirs;
inline TreeSolution(Network *network) : network(network) {
pred = new int[network->num_nodes];
depth = new int[network->num_nodes];
thread = new int[network->num_nodes];
potential = new long[network->num_nodes];
basic_arcs = new Arc*[network->num_nodes];
basic_arc_dirs = new char[network->num_nodes];
determine_initial_tree();
calc_initial_tree_structure();
}
void update(const std::vector<Arc*> &F, const std::vector<Arc*> &B,
long theta,
Arc *entering,
Arc* leaving,
int common_predecessor);
long solution_value();
};
#endif