Skip to content

Commit c3b0f75

Browse files
committed
some cleanup
1 parent 8312a2c commit c3b0f75

File tree

3 files changed

+8
-44
lines changed

3 files changed

+8
-44
lines changed

include/maxplus/graph/mpstatespace.h

-11
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ using ELSEdgeRef = ::FSM::Labeled::EdgeRef<CId, MPString>;
5555
using ELSSetOfStates = ::FSM::Labeled::SetOfStates<CId, MPString>;
5656
using ELSSetOfEdges = ::FSM::Labeled::SetOfEdges<CId, MPString>;
5757

58-
// /**
59-
// * Edge labeled scenario FSM.
60-
// */
61-
// class EdgeLabeledScenarioFSM : public ::FSM::Labeled::FiniteStateMachine<CId, MPString> {
62-
// public:
63-
// virtual ~EdgeLabeledScenarioFSM() {};
64-
// };
6558

6659
using MLSEdgeLabel = struct MLSEdgeLabel {
6760
Matrix *mat;
@@ -73,10 +66,6 @@ using MLSEdge = ::FSM::Labeled::Edge<CId, MLSEdgeLabel>;
7366
using MLSSetOfStates = ::FSM::Labeled::SetOfStates<CId, MLSEdgeLabel>;
7467
using MLSSetOfEdges = ::FSM::Abstract::SetOfEdges;
7568

76-
/**
77-
* Matrix and reward labeled scenario FSM.
78-
*/
79-
class MatrixLabeledScenarioFSM : public ::FSM::Labeled::FiniteStateMachine<CId, MLSEdgeLabel> {};
8069

8170
} // namespace MaxPlus
8271

include/maxplus/graph/smpls.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SMPLS {
6868
EdgeLabeledModeFSM elsFSM;
6969

7070
// the mode matrices
71-
ModeMatrices sm;
71+
ModeMatrices mm;
7272

7373
[[nodiscard]] std::shared_ptr<MaxPlusAutomaton> convertToMaxPlusAutomaton() const;
7474

src/graph/smpls.cc

+7-32
Original file line numberDiff line numberDiff line change
@@ -122,31 +122,6 @@ MPTime getMaxOfColUntilRow(Matrix &M, uint colNumber, uint rowNumber) {
122122
return largestEl;
123123
}
124124

125-
/*
126-
* Loads an entity from its starting '{' to the corresponding '}'
127-
*/
128-
std::string loadEntity(std::ifstream &stream, std::string line) {
129-
std::string out = line;
130-
size_t openBracketCount = 0;
131-
size_t closeBracketCount = 0;
132-
openBracketCount += std::count(line.begin(), line.end(), '{');
133-
closeBracketCount += std::count(line.begin(), line.end(), '}');
134-
135-
// get the whole activity {} into a string
136-
while (getline(stream, line)) {
137-
138-
openBracketCount += std::count(line.begin(), line.end(), '{');
139-
closeBracketCount += std::count(line.begin(), line.end(), '}');
140-
out += line;
141-
142-
if (openBracketCount == closeBracketCount) {
143-
openBracketCount = 0;
144-
closeBracketCount = 0;
145-
break;
146-
}
147-
}
148-
return out;
149-
}
150125
std::shared_ptr<MaxPlusAutomaton> SMPLS::convertToMaxPlusAutomaton() const {
151126
auto mpa = std::make_shared<MaxPlusAutomaton>();
152127
// transposeMatrices();
@@ -163,14 +138,14 @@ std::shared_ptr<MaxPlusAutomaton> SMPLS::convertToMaxPlusAutomaton() const {
163138
if (!e.empty()) {
164139
MPString label = (dynamic_cast<ELSEdgeRef>(*e.begin()))->getLabel();
165140

166-
for (const auto &smIt : this->sm) {
141+
for (const auto &smIt : this->mm) {
167142
if ((smIt).first == label) {
168143
nrTokens = (smIt).second->getCols();
169144
break;
170145
}
171146
}
172147
} else {
173-
nrTokens = (*this->sm.begin()).second->getCols();
148+
nrTokens = (*this->mm.begin()).second->getCols();
174149
}
175150
// create a state for (q, k)
176151
const CId qId = (dynamic_cast<ELSState &>(qq)).getLabel();
@@ -222,7 +197,7 @@ std::shared_ptr<MaxPlusAutomaton> SMPLS::convertToMaxPlusAutomaton() const {
222197
const auto *tr = dynamic_cast<ELSEdgeRef>(e);
223198
CId q2Id = dynamic_cast<ELSStateRef>(tr->getDestination())->getLabel();
224199
MPString sc = tr->getLabel();
225-
std::shared_ptr<Matrix> Ms = this->sm.at(sc);
200+
std::shared_ptr<Matrix> Ms = this->mm.at(sc);
226201
size_t r = Ms->getRows();
227202
size_t c = Ms->getCols();
228203

@@ -347,7 +322,7 @@ std::shared_ptr<MaxPlusAutomaton> SMPLSwithEvents::convertToMaxPlusAutomaton() {
347322
* all square (to the size of the biggest matrix) by adding rows and cols of -infty
348323
*/
349324
void SMPLSwithEvents::makeMatricesSquare() {
350-
for (const auto &it : this->sm) {
325+
for (const auto &it : this->mm) {
351326
std::shared_ptr<Matrix> m = it.second;
352327
m->addCols(biggestMatrixSize - m->getCols());
353328
m->addRows(biggestMatrixSize - m->getRows());
@@ -356,7 +331,7 @@ void SMPLSwithEvents::makeMatricesSquare() {
356331

357332
// transposes all matrices of the SMPLS
358333
void SMPLS::transposeMatrices() {
359-
for (auto &it : this->sm) {
334+
for (auto &it : this->mm) {
360335
it.second = it.second->getTransposedCopy();
361336
}
362337
}
@@ -548,7 +523,7 @@ void SMPLSwithEvents::prepareMatrices(const IOAState &s,
548523
eList.insert(outputActionEventName);
549524
}
550525

551-
this->sm[modeName] = sMatrix;
526+
this->mm[modeName] = sMatrix;
552527
visitedEdges.insert(e);
553528

554529
// we need this later to make all matrices square
@@ -762,7 +737,7 @@ bool SMPLSwithEvents::compareEventLists(EventList &l1, EventList &l2) {
762737

763738
void SMPLSwithEvents::dissectModeMatrices() {
764739
ModeMatrices::iterator s;
765-
for (const auto &s : this->sm) {
740+
for (const auto &s : this->mm) {
766741
numberOfResources = 0;
767742
std::shared_ptr<DissectedModeMatrix> dis = std::make_shared<DissectedModeMatrix>();
768743
dis->core.insert(s);

0 commit comments

Comments
 (0)