Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F360892
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/include/rosa/agent/State.hpp b/include/rosa/agent/State.hpp
index fe977bb..b59f09b 100644
--- a/include/rosa/agent/State.hpp
+++ b/include/rosa/agent/State.hpp
@@ -1,109 +1,115 @@
//===-- rosa/agent/State.hpp ----------------------------*- C++ -*-===//
//
// The RoSA Framework
//
//===----------------------------------------------------------------------===//
///
/// \file rosa/agent/State.hpp
///
/// \author Maximilian Götzinger (maximilian.goetzinger@tuwien.ac.at)
///
/// \date 2019
///
/// \brief Definition of *state* *functionality*.
///
//===----------------------------------------------------------------------===//
#ifndef ROSA_AGENT_STATE_HPP
#define ROSA_AGENT_STATE_HPP
#include "rosa/agent/Functionality.h"
#include "rosa/agent/History.hpp"
namespace rosa {
namespace agent {
/// \tparam DIN type of data of input, \tparam DDAB type of data in which DABs are saved,
-/// \tparam DIN type of data of output
+/// \tparam DOUT type of data of abstracted value
template <typename DIN, typename DDAB, typename DOUT> class State : public Functionality {
private:
+
DynamicHistory<DIN, HistoryPolicy::FIFO> SampleHistory;
DynamicHistory<DIN, HistoryPolicy::SRWF> DAB;
DynamicHistory<DDAB, HistoryPolicy::LIFO> DABHistory;
- PartialFunction* ConfidenceSimilarToSample,
- ConfidenceDifferentToSample;
+ std::shared_ptr<PartialFunction<DIN, DOUT>> ConfidenceSimilarToSample;
+ std::shared_ptr<PartialFunction<DIN, DOUT>> ConfidenceDifferentToSample;
+
+ bool StateIsValid;
+ bool StateIsValidAfterReentrance;
public:
State(unsigned int sampleHistorySize, unsigned int DABSize,
unsigned int DABHistorySize, PartialFunction* ConfidenceSimilarToSample,
PartialFunction* ConfidenceDifferentToSample) noexcept :
SampleHistory(sampleHistorySize),
DAB(DABSize),
DABHistory(DABHistorySize) {
this->ConfidenceSimilarToSample = ConfidenceSimilarToSample;
this->ConfidenceDifferentToSample = ConfidenceDifferentToSample;
+ StateIsValid = false;
+ StateIsValidAfterReentrance = false;
}
//TODO: static assert -> check:
// 1) if DIN == arithmetic,
// 2) if DDAB == float, double, ...?
// 3) output could be arithemtic or char/string, right?
~State(void) = default;
void leaveState(void) {
if(!DAB.empty()) {
//TODO: delete all entries in DAB
//@Benedikt:I would need such a method in history
}
+ StateIsValidAfterReentrance = false;
}
bool insertSample(D Sample) {
bool workedForAll;
workedForAll = SampleHistory.addEntry(Sample);
if (workedForAll) {
workedForAll &= DAB.addEntry(Sample);
if (workedForAll) {
if (numberOfEntries >= DAB) {
//TODO: calculate average of DAB
//@Benedikt: should we do this avg calc in the history class or here or somewhere else?
AvgOfDAB = 0; //XXX - Dummy value
workedForAll &= DABHistory.addEntry(AvgOfDAB);
if(workedForAll) {
//TODO: delete all entries in DAB
} //xxx - what should be done if it has not worked?
}
if(workedForAll) {
- //calculate if state is valid
+ //TODO: calculate if state is valid
}
}
}
return workedForAll;
}
+ DOUT sampleIsRelatedToState(DIN sample){
+ //TODO: check with fuzzyFunctions
+ }
+
-
-
-
-
-
};
} // End namespace agent
} // End namespace rosa
#endif // ROSA_AGENT_STATE_HPP
\ No newline at end of file
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, May 17, 9:43 PM (23 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
141599
Default Alt Text
(3 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment