This repository has been archived by the owner on Nov 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLittleNode.h
151 lines (118 loc) · 3.22 KB
/
LittleNode.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#ifndef TBP_LITTLE_LITTLENODE_H
#define TBP_LITTLE_LITTLENODE_H
#include <vector>
#include <exception>
#include <limits>
#include <iostream>
#include "Eigen/Core"
#include "Segment.h"
#include "Regret.h"
#include "Loop.h"
using namespace Eigen;
using namespace std;
class LittleNode {
private:
MatrixXd *matrix;
double value;
double parentValue;
vector<Segment> segments;
public:
LittleNode();
LittleNode(MatrixXd *matrix);
LittleNode(MatrixXd *matrix, double parentValue, const vector<Segment> &segments);
LittleNode(MatrixXd *matrix, double value, double parentValue, const vector<Segment> &segments);
virtual ~LittleNode();
MatrixXd *getMatrix() const;
void setMatrix(MatrixXd *matrix);
double getValue() const;
void setValue(double value);
const vector<Segment> & getSegments() const;
void setSegments(const vector<Segment> &segments);
double getParentValue() const;
void setParentValue(double parentValue);
/**
* Reduce a matrix row according to Little's algorithm
* @param matrix the matrix to reduce
* @param row the matrix's row index
* @return the value reduced
*/
double reduceMatrixRow(long row);
/**
* Reduce a matrix column according to Little's algorithm
* @param matrix the matrix to reduce
* @param col the matrix's column index
* @return the value reduced
*/
double reduceMatrixCol(long col);
/**
* Reduce all the matrix's row
* @param matrix the matrix
* @return the total amount reduced
*/
double reduceMatrixRows();
/**
* Reduce all the matrix's columns
* @param matrix the matrix
* @return the total amount reduced
*/
double reduceMatrixCols();
/**
* Reduce the matrix rows and columns
* @param matrix the matrix
* @return the total amount reduced
*/
double reduceMatrix();
/**
* Remove a row from the matrix
* @param row the row index
*/
void removeMatrixRow(long row);
/**
* Remove a column from the matrix
* @param col the column index
*/
void removeMatrixCol(long col);
/**
* Return the maximal regret
* @return the maximal regret
*/
Regret getMaxRegret();
/**
* Return a list of regrets
* @return a list of regrets
*/
vector<Regret> getRegrets();
/**
* Return a list of segment containing 0
* @return a list of segments containing 0
*/
vector<Segment> getRegretsSegments();
/**
* Compute a regret at the given segment
* @param segment
* @return a regret
*/
Regret computeRegret(Segment segment);
/**
* Check and disable segments which result in a loop
*/
void disableLoops();
/**
* Get the row minimal coefficient
* @param row row index
* @return the row min value
*/
double getRowMin(long row);
/**
* Get the column minimal coefficient
* @param col column index
* @return the column min value
*/
double getColMin(long col);
/**
* Disable a segment by attributing it the exclude value
* @param segment
*/
void disableSegment(Segment segment);
};
#endif //TBP_LITTLE_LITTLENODE_H