-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTSimplexDatastructs.h
104 lines (88 loc) · 2.78 KB
/
TSimplexDatastructs.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
///
/// src/algs/TSimplexDatastructs.h
///
/// Written by Roberto Bargetto
/// DIGEP
/// Politecnico di Torino
/// Corso Duca degli Abruzzi, 10129, Torino
/// Italy
///
/// Copyright 2023 by Roberto Bargetto
/// roberto.bargetto@polito.it or roberto.bargetto@gmail.com
///
/// This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)
/// See the license at http://creativecommons.org/licenses/by-nc-sa/4.0/
///
#ifndef TSIMPLEXDATA_H
#define TSIMPLEXDATA_H
#ifdef _WIN32
// windows code goes here
#ifndef NOMINMAX
# define NOMINMAX
#endif
#include <windows.h>
#endif
#include <memory>
#include <vector>
#include <list>
#include <limits>
#include <unordered_map>
#include "SpanningTree.h"
#include "Shielding.h"
#include "TpInstance.h"
#include "util.h"
#define EPSQ ((2.0 - 20.0 * MYEPS) * MYEPS)
namespace TSimplexData
{
struct tplex_alg_data
{
/// var data struct
struct var_data
{
std::vector<double> cs;
std::vector<NodeArcIdType> is;
std::vector<NodeArcIdType> js;
Shielding::THEgrid board;
std::vector<std::vector<NodeArcIdType>> supp;
std::shared_ptr<SpanningTree> spat_sptr;
unsigned long h = 0;
NodeArcIdType next_arc = 0;
bool next_flag = true;
std::vector<double> vs_max;
std::vector<NodeArcIdType> b;
//std::vector<NodeArcIdTypeSGND> uplr;
std::vector<NodeArcIdType> Lrow;
std::vector<NodeArcIdType> Lmax;
std::vector<NodeArcIdType> row_rotors;
std::vector<NodeArcIdType> row_rotors_0;
std::vector<bool> rotor_flags;
std::vector<bool> rcneg_flags;
std::vector<bool> row_flags;
};
/// struct attribute
/// algorithm utility
/// solution
std::vector<CellVar> solution;
size_t partial_basis_size;
/// solution by rows
std::vector<std::vector<CellVar>> rows;
/// solution by cols
std::vector<std::vector<CellVar>> cols;
ts_sol quantities;
std::vector<double> sources;
std::vector<double> destinations;
std::vector<double> us;
std::vector<double> vs;
var_data vdata;
/// struct constructor
tplex_alg_data(const std::shared_ptr<TpInstance::TProblemData>&, bool to_fill = false);
tplex_alg_data(const tplex_alg_data&);
/// struct method
void sort();
void addVar(CellVar& env, double c);
void delVar(CellVar& exv);
void clearSol();
std::string toStringSol();
};
}
#endif // TSIMPLEXDATA_H