-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAlgorithm.h
More file actions
46 lines (33 loc) · 1.24 KB
/
Algorithm.h
File metadata and controls
46 lines (33 loc) · 1.24 KB
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
#ifndef ALGORITHM_H_INCLUDED
#define ALGORITHM_H_INCLUDED
#include <vector>
#include "Network.h"
#include "Circle.h"
class Algorithm {
public:
Algorithm (Network& _n, size_t (*_pivot)(const std::vector<Circle>&)) : n(_n), pivot(_pivot) {};
//returns 0 if n cannot be solved
//false for high cost edge initialization
bool solution (bool modus = true);
intmax_t getNoOfIter ();
private:
intmax_t iterations = 0;
Network& n;
size_t (*pivot)(const std::vector<Circle>&);
size_t artificialNode;
//collect circles instead of calculating all the time
std::vector<Circle> circles;
//for all nodes remember which edge leads to the root node
std::map<size_t, size_t> strongFeasibleTree;
//false if no optimization was possible
bool optimize();
//takes tree and creates circles;
void createCircles(std::vector<Node> tree);
//functions used for last-blocking-edge-approach
size_t findApex (Circle& c);
void updateStrongFeasibleTree(Circle& c, size_t i, size_t apex);
//it is assumed that for no edge (i,j) in the tree
//there is an edge (j,i)
Circle findCircle(size_t node0, size_t node1, bool isResidual, const std::vector<Node>& tree);
};
#endif // ALGORITHM_H_INCLUDED