-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimplex.hpp
More file actions
63 lines (48 loc) · 1.23 KB
/
Copy pathsimplex.hpp
File metadata and controls
63 lines (48 loc) · 1.23 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef SIMPLEX_HPP
#define SIMPLEX_HPP
#include "network.hpp"
#include "tree.hpp"
#include <vector>
#define SOLUTION_INFEASIBLE 0
#define SOLUTION_UNBOUNDED 1
#define SOLUTION_OPTIMAL 2
#define SOLUTION_UNSOLVED 3
class Cycle {
public:
long theta;
Arc* blocking;
int common_predecessor;
std::vector<Arc*> F;
std::vector<Arc*> B;
};
class NWSimplex {
private:
Network *network;
TreeSolution *tree;
int solution_state;
int current_startnode;
unsigned int max_list_size;
unsigned int max_min_its;
std::vector<Arc*> candidate_list;
Cycle cycle;
bool perform_major_iteration();
void fill_candidate_list();
void compute_cycle(Arc* entering);
void recalc_redcosts();
Arc* get_best_arc();
public:
int num_iterations;
inline NWSimplex(Network *network, int max_list_size, int max_min_its) {
this->network = network;
this->max_list_size = max_list_size;
this->max_min_its = max_min_its;
tree = new TreeSolution(network);
num_iterations = 0;
solution_state = SOLUTION_UNSOLVED;
current_startnode = 0;
}
int compute_solution();
long solution_value();
std::list<Arc*>* sorted_solution_arcs();
};
#endif