00001 00003 /* 00004 FAU Discrete Event Systems Library (libfaudes) 00005 00006 The proposing executor is based on the stochastic executor, which 00007 has been developped by Christoph Doerr as part of his thesis project. 00008 00009 Copyright (C) 2008 Thomas Moor 00010 Copyright (C) 2007 Christoph Doerr 00011 Exclusive copyright is granted to Thomas Moor 00012 00013 todo: 00014 - compile simevent set to one vector per type to speed up iterations 00015 - fix vector pdfs 00016 - test with elementary examples 00017 - use compiled interval time constraints 00018 00019 */ 00020 00021 #ifndef FAUDES_SP_PLPEXECUTOR_H 00022 #define FAUDES_SP_PLPEXECUTOR_H 00023 00024 #include "corefaudes.h" 00025 #include "tp_include.h" 00026 #include "sp_lpexecutor.h" 00027 #include "sp_simeventset.h" 00028 #include "sp_random.h" 00029 00030 00031 namespace faudes { 00032 00139 class ProposingExecutor : public LoggingExecutor { 00140 00141 public: 00142 00143 /***************************************** 00144 ***************************************** 00145 ***************************************** 00146 *****************************************/ 00147 00155 ProposingExecutor(); 00156 00157 00160 /***************************************** 00161 ***************************************** 00162 ***************************************** 00163 *****************************************/ 00164 00177 const SimEventAttribute& EventAttribute(Idx index) const; 00178 00190 void EventAttribute(Idx index, const SimEventAttribute& rAttr); 00191 00192 00202 void Alphabet(const sEventSet& rAlphabet); 00203 00205 const sEventSet& Alphabet(void) const { return mSimEvents; }; 00206 00222 TimedEvent ExecuteNextTransition(); 00223 00233 const TimedEvent& ProposeNextTransition(); 00234 00240 std::string EventStatesToString(void) const; 00241 00242 00245 /***************************************** 00246 ***************************************** 00247 ***************************************** 00248 *****************************************/ 00249 00259 virtual void Reset(long int seed=0); 00260 00264 virtual void Clear(void); 00265 00266 00273 bool ExecuteTime(tpTime::Type duration); 00274 00281 bool ExecuteEvent(Idx event); 00282 00283 00290 bool ExecuteTransition(const TimedEvent& tevent); 00291 00301 bool RevertToStep(Idx step); 00302 00305 /***************************************** 00306 ***************************************** 00307 ***************************************** 00308 *****************************************/ 00309 00310 00311 private: 00312 00316 sEventSet mSimEvents; 00317 00321 bool mPValid; 00322 00326 TimedEvent mProposal; 00327 00331 void ResetProposer(long int seed=0); 00332 00347 tpTime::Type Schedule(Idx event, SimEventAttribute* pattr); 00348 00364 virtual void DoRead(TokenReader& rTr, const std::string& rLabel = "", const Type* pContext=0); 00365 00379 virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const; 00380 00381 }; // end class ProposingExecutor 00382 00383 00384 00385 } // namespace faudes 00386 00387 00388 #endif