[465] | 1 | /* |
---|
| 2 | Copyright 2009 Virginia Polytechnic Institute and State University |
---|
| 3 | |
---|
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 5 | you may not use this file except in compliance with the License. |
---|
| 6 | You may obtain a copy of the License at |
---|
| 7 | |
---|
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 9 | |
---|
| 10 | Unless required by applicable law or agreed to in writing, software |
---|
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 13 | See the License for the specific language governing permissions and |
---|
| 14 | limitations under the License. |
---|
| 15 | */ |
---|
| 16 | |
---|
[518] | 17 | /*! This header exports the declaration for the Cognitive Engine component type. |
---|
[465] | 18 | */ |
---|
| 19 | |
---|
| 20 | #ifndef COGNITIVE_ENGINE_H |
---|
| 21 | #define COGNITIVE_ENGINE_H |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #include "components.h" |
---|
| 25 | |
---|
| 26 | |
---|
[518] | 27 | /*! \brief Cognitive Engine class declaration. |
---|
| 28 | * |
---|
| 29 | * All public functions are inherited from parent classes. Please see parent |
---|
| 30 | * class definitions for function documentation. |
---|
[465] | 31 | */ |
---|
| 32 | class CognitiveEngine : public Engine |
---|
| 33 | { |
---|
| 34 | public: |
---|
[518] | 35 | /*! Default constructor. */ |
---|
[465] | 36 | CognitiveEngine(); |
---|
[518] | 37 | |
---|
| 38 | /*! Default destructor. */ |
---|
[465] | 39 | ~CognitiveEngine(); |
---|
| 40 | |
---|
[518] | 41 | /*! \brief Preferred constructor. |
---|
| 42 | * |
---|
| 43 | * Overloaded constructor that creates a cognitive engine object and |
---|
[465] | 44 | * connects it to either the shell or an SML, depening on the SML bool. |
---|
| 45 | */ |
---|
| 46 | CognitiveEngine(const char* serverName, const char* serverPort, \ |
---|
| 47 | const bool SML); |
---|
| 48 | |
---|
| 49 | void SendComponentType(); |
---|
| 50 | void ConnectToRemoteComponent(const char* serverName, \ |
---|
| 51 | const char* serverPort, const bool SML); |
---|
| 52 | void WaitForSignal(); |
---|
| 53 | void Shutdown(); |
---|
| 54 | void Reset(); |
---|
| 55 | void RegisterComponent(); |
---|
| 56 | void DeregisterComponent(); |
---|
| 57 | |
---|
| 58 | void RegisterServices(); |
---|
| 59 | void DeregisterServices(); |
---|
| 60 | |
---|
| 61 | private: |
---|
[518] | 62 | /*! \brief Receive radio XML configuration. |
---|
| 63 | * |
---|
| 64 | * Receive the transmitted radio configuration from the radio itself |
---|
| 65 | * (the CE will not always be local to the radio). This gets passed |
---|
| 66 | * through either the Shell or the SML. */ |
---|
[465] | 67 | void ReceiveRadioConfiguration(); |
---|
| 68 | |
---|
[518] | 69 | /*! \brief Receive an 'experience' report from the radio. |
---|
| 70 | * |
---|
| 71 | * An experience report can be used to build the transmission history |
---|
| 72 | * for a CE just starting up so that it has a moving start regarding |
---|
| 73 | * parameter optimization. */ |
---|
[465] | 74 | void ReceiveExperience(); |
---|
| 75 | |
---|
[518] | 76 | /*! \brief Request that the CE optimize a set of parameters. |
---|
| 77 | * |
---|
| 78 | * Find the most optimal set of transmission parameters given certain |
---|
[465] | 79 | * observables and possibly a service if the SML component is present |
---|
[518] | 80 | * and active. */ |
---|
| 81 | Parameter *GetSolution(Observable *observables, \ |
---|
| 82 | Parameter *currentParameters); |
---|
| 83 | Parameter *GetSolution(Observable *observables, \ |
---|
| 84 | Parameter *currentParameters, std::string service); |
---|
[465] | 85 | |
---|
[518] | 86 | /*! \brief Receive feedback from the radio |
---|
| 87 | * |
---|
| 88 | * Receive a feedback from the radio regarding the performance of a |
---|
[465] | 89 | * certain set of parameters, possibly associated with a service. |
---|
| 90 | * |
---|
| 91 | * Feedback is a single set of performance statistics that is achieved |
---|
| 92 | * corresponding to a specific set of transmission parameters. Feedback |
---|
| 93 | * helps a Cognitive Engine make better future decisions based upon |
---|
| 94 | * more accurate performance statistics. |
---|
| 95 | */ |
---|
[518] | 96 | void ReceiveFeedback(Observable *observables,Parameter *parameters); |
---|
| 97 | void ReceiveFeedback(Observable *observables, Parameter *parameters, \ |
---|
| 98 | std::string service); |
---|
[465] | 99 | |
---|
| 100 | |
---|
[518] | 101 | /*! \brief Initialize the CE and prepare it for operation. |
---|
| 102 | * |
---|
| 103 | * BuildCognitiveEngine performs the CE implementation specific work |
---|
[465] | 104 | * that defines the internals of a CE. For example, a CBR CE engine |
---|
| 105 | * would build the case-base reasoner or create the database, a neural |
---|
| 106 | * network based CE may perform the initial training, a GA based CE |
---|
| 107 | * may build the chromosome structure. |
---|
| 108 | */ |
---|
| 109 | void BuildCognitiveEngine(); |
---|
| 110 | |
---|
[518] | 111 | /*! \brief Keept track of what this CE is connected to. |
---|
| 112 | * |
---|
| 113 | * The SML_present bool reflects whether or not the remote component |
---|
[465] | 114 | * this object is connected to is an SML. If it isn't, then it must be |
---|
| 115 | * a shell. The socketFD stores the socket file descriptor for this |
---|
| 116 | * connection. |
---|
| 117 | */ |
---|
| 118 | bool SML_present; |
---|
| 119 | int32_t commandSocketFD; |
---|
| 120 | |
---|
| 121 | // TODO Need a description for these fields. Are these radio utilites, |
---|
| 122 | // parameters, and observables global to the whole system? |
---|
| 123 | Utility *uList; |
---|
| 124 | Parameter *pList; |
---|
| 125 | Observable *oList; |
---|
| 126 | struct Radio_Info *radioInfo; |
---|
| 127 | }; |
---|
| 128 | |
---|
| 129 | #endif |
---|