-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathprpl-transition.h
108 lines (86 loc) · 3.52 KB
/
prpl-transition.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
#ifndef PRPL_TRANSITION_H
#define PRPL_TRANSITION_H
#include "prpl-basicTypes.h"
#include "prpl-cellspace.h"
#include "prpl-neighborhood.h"
#include "prpl-subCellspace.h"
namespace pRPL {
class Transition {
public:
/* Constructor and destructor */
Transition(bool onlyUpdtCtrCell = true,
bool needExchange = false,
bool edgesFirst = false);
virtual ~Transition() {}
/* Layers */
void addInputLyr(const char *aInLyrName,
bool isPrimeLyr = false);
void addOutputLyr(const char *aOutLyrName,
bool isPrimeLyr = true);
bool setLyrsByNames(vector<string> *pvInLyrNames,
vector<string> *pvOutLyrNames,
string &primeLyrName);
const vector<string>& getInLyrNames() const;
const vector<string>& getOutLyrNames() const;
const string& getPrimeLyrName() const;
bool isInLyr(const string &lyrName) const;
bool isOutLyr(const string &lyrName) const;
bool isPrimeLyr(const string &lyrName) const;
void clearLyrSettings();
bool setCellspace(const string &lyrName,
pRPL::Cellspace *pCellspc);
void clearCellspaces();
pRPL::Cellspace* getCellspaceByLyrName(const string &lyrName);
const pRPL::Cellspace* getCellspaceByLyrName(const string &lyrName) const;
void setUpdateTracking(bool toTrack);
void clearUpdateTracks();
/* Neighborhood */
void setNbrhdByName(const char *aNbrhdName);
const string& getNbrhdName() const;
void clearNbrhdSetting();
void setNbrhd(Neighborhood *pNbrhd = NULL);
pRPL::Neighborhood* getNbrhd();
const pRPL::Neighborhood* getNbrhd() const;
void clearDataSettings();
/* Option information */
bool onlyUpdtCtrCell() const;
bool needExchange() const;
bool edgesFirst() const;
/* Collective Evaluation */
pRPL::EvaluateReturn evalBR(const pRPL::CoordBR &br);
pRPL::EvaluateReturn evalRandomly(const pRPL::CoordBR &br);
pRPL::EvaluateReturn evalSelected(const pRPL::CoordBR &br,
const pRPL::LongVect &vlclIdxs);
/* ------------------------------------------------- *
* User-defined Processing *
* ------------------------------------------------- */
/* After setting the Cellspaces for the Transition,
* if the Cellspaces are SubCellspaces, the global ID of the SubCellspaces
* will be given to this function.
* The Transition may use this information to set other user-defined options
* before running.
* */
virtual bool afterSetCellspaces(int subCellspcGlbIdx = pRPL::ERROR_ID);
/* After setting the Neighborhood for the Transition,
* the Transition may set other user-defined options before running
* */
virtual bool afterSetNbrhd();
/* Final check before running */
virtual bool check() const;
/* Evaluate a specific Cell */
virtual pRPL::EvaluateReturn evaluate(const pRPL::CellCoord &coord);
/* Calculate the workload */
virtual double workload(const pRPL::CoordBR &workBR) const;
protected:
string _primeLyrName;
vector<string> _vInLyrNames;
vector<string> _vOutLyrNames;
map<string, pRPL::Cellspace*> _mpCellspcs;
string _nbrhdName;
pRPL::Neighborhood *_pNbrhd;
bool _onlyUpdtCtrCell;
bool _needExchange;
bool _edgesFirst;
};
};
#endif