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 class State : public Functionality { private: + DynamicHistory SampleHistory; DynamicHistory DAB; DynamicHistory DABHistory; - PartialFunction* ConfidenceSimilarToSample, - ConfidenceDifferentToSample; + std::shared_ptr> ConfidenceSimilarToSample; + std::shared_ptr> 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