Skip to content

Commit 436499b

Browse files
author
Marc Geilen
committed
some fixes
1 parent 21bbd41 commit 436499b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

include/maxplus/algebra/mptype.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ inline CDouble MP_MIN(CDouble a, CDouble b) { return CDouble(MP_MIN(MPTime(a), M
115115
const MPTime MP_MINUSINFINITY = MPTime(-1.0e+30);
116116

117117
inline bool MP_ISMINUSINFINITY(CDouble a) { return a < MPTIME_MIN_INF_VAL; }
118+
inline bool MP_ISMINUSINFINITY(MPTime a) { return a < MP_MINUSINFINITY; }
118119

119120
inline MPTime MP_PLUS(CDouble a, CDouble b) {
120121
return (MP_ISMINUSINFINITY(a) || MP_ISMINUSINFINITY(b)) ? MP_MINUSINFINITY

include/maxplus/base/fsm/fsm.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class FiniteStateMachine {
197197
FiniteStateMachine(FiniteStateMachine &&) = default;
198198
FiniteStateMachine &operator=(FiniteStateMachine &&) = delete;
199199

200-
[[nodiscard]] virtual const State &getInitialState() const = 0;
200+
[[nodiscard]] virtual State &getInitialState() = 0;
201201
};
202202

203203
//
@@ -414,7 +414,7 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
414414
private:
415415
SetOfStates<StateLabelType, EdgeLabelType> states;
416416
Abstract::SetOfEdges edges;
417-
const State<StateLabelType, EdgeLabelType> *initialState;
417+
State<StateLabelType, EdgeLabelType> *initialState;
418418

419419
public:
420420
FiniteStateMachine() : Abstract::FiniteStateMachine(), initialState(nullptr){};
@@ -473,12 +473,12 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
473473
this->initialState = this->states.withLabel(label);
474474
};
475475

476-
void setInitialState(const State<StateLabelType, EdgeLabelType>& s) {
476+
void setInitialState(State<StateLabelType, EdgeLabelType>& s) {
477477
// we are asumming s is one of our states
478478
this->initialState = &s;
479479
};
480480

481-
[[nodiscard]] const State<StateLabelType, EdgeLabelType> &getInitialState() const override {
481+
[[nodiscard]] State<StateLabelType, EdgeLabelType> &getInitialState() override {
482482
return *this->initialState;
483483
};
484484

@@ -854,6 +854,7 @@ using ELSSetOfEdgeRefs = ::FSM::Abstract::SetOfEdgeRefs;
854854

855855
class EdgeLabeledScenarioFSM : public ::FSM::Labeled::FiniteStateMachine<CId, CString> {
856856
public:
857+
EdgeLabeledScenarioFSM() = default;
857858
~EdgeLabeledScenarioFSM() override = default;
858859

859860
EdgeLabeledScenarioFSM(const EdgeLabeledScenarioFSM &) = delete;
@@ -887,8 +888,8 @@ class State : public Labeled::State<CString, char> {
887888

888889
class FiniteStateMachine : public Labeled::FiniteStateMachine<CString, char> {
889890
public:
890-
const State &getInitialState() {
891-
return dynamic_cast<const State &>(
891+
State &getInitialState() {
892+
return dynamic_cast<State &>(
892893
Labeled::FiniteStateMachine<CString, char>::getInitialState());
893894
};
894895

@@ -930,7 +931,7 @@ class FiniteStateMachine : public Abstract::FiniteStateMachine {
930931
const Abstract::FiniteStateMachine &fsm2) :
931932
fsm_a(fsm1), fsm_b(fsm2) {}
932933

933-
std::shared_ptr<State> getInitialState();
934+
State& getInitialState();
934935

935936
[[nodiscard]] virtual bool matchEdges(const Abstract::Edge &e1,
936937
const Abstract::Edge &e2) const = 0;

include/maxplus/graph/mpautomaton.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class MaxPlusAutomaton : public ::FSM::Labeled::FiniteStateMachine<MPAStateLabel
126126
*/
127127
using MPAREdgeLabel = struct MPAREdgeLabel {
128128
MPDelay delay;
129-
const CString& scenario;
129+
const CString scenario;
130130
CDouble reward{0.0};
131131
};
132132

@@ -143,7 +143,7 @@ using MPARState = ::FSM::Labeled::State<MPAStateLabel, MPAREdgeLabel>;
143143
using MPAREdge = ::FSM::Labeled::Edge<MPAStateLabel, MPAREdgeLabel>;
144144
using MPARSetOfStates = ::FSM::Labeled::SetOfStates<MPAStateLabel, MPAREdgeLabel>;
145145
using MPARSetOfEdges = ::FSM::Abstract::SetOfEdges;
146-
using MPARCycle = ::FSM::Abstract::SetOfEdgeRefs;
146+
using MPARCycle = std::list<const ::FSM::Abstract::Edge*>;
147147

148148
/**
149149
* A max-plus automaton with rewards. In addition to the usual max-plus automaton,

0 commit comments

Comments
 (0)