[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 | |
---|
| 17 | /* This header exports the declaration for the Cognitive Engine component type. |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #ifndef COGNITIVE_ENGINE_H |
---|
| 21 | #define COGNITIVE_ENGINE_H |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | #include "components.h" |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | /* Cognitive Engine class declaration. All public functions are inherited from |
---|
| 28 | * parent classes. |
---|
| 29 | */ |
---|
| 30 | class CognitiveEngine : public Engine |
---|
| 31 | { |
---|
| 32 | public: |
---|
| 33 | CognitiveEngine(); |
---|
| 34 | ~CognitiveEngine(); |
---|
| 35 | |
---|
| 36 | /* Overloaded constructor that creates a cognitive engine object and |
---|
| 37 | * connects it to either the shell or an SML, depening on the SML bool. |
---|
| 38 | */ |
---|
| 39 | CognitiveEngine(const char* serverName, const char* serverPort, \ |
---|
| 40 | const bool SML); |
---|
| 41 | |
---|
| 42 | void SendComponentType(); |
---|
| 43 | void ConnectToRemoteComponent(const char* serverName, \ |
---|
| 44 | const char* serverPort, const bool SML); |
---|
| 45 | void WaitForSignal(); |
---|
| 46 | void Shutdown(); |
---|
| 47 | void Reset(); |
---|
| 48 | void RegisterComponent(); |
---|
| 49 | void DeregisterComponent(); |
---|
| 50 | |
---|
| 51 | void RegisterServices(); |
---|
| 52 | void DeregisterServices(); |
---|
| 53 | |
---|
| 54 | private: |
---|
| 55 | /* Receive the transmitted radio configuration from the radio itself |
---|
| 56 | * (the CE will not always be local to the radio). |
---|
| 57 | */ |
---|
| 58 | void ReceiveRadioConfiguration(); |
---|
| 59 | |
---|
| 60 | /* Receive an 'experience' report from the radio. |
---|
| 61 | */ |
---|
| 62 | void ReceiveExperience(); |
---|
| 63 | |
---|
| 64 | /* Find the most optimal set of transmission parameters given certain |
---|
| 65 | * observables and possibly a service if the SML component is present |
---|
| 66 | * and active. |
---|
| 67 | */ |
---|
| 68 | Parameter *GetSolution(Observable *observables, Parameter *currentParameters); |
---|
| 69 | Parameter *GetSolution(Observable *observables, Parameter *currentParameters, \ |
---|
| 70 | std::string service); |
---|
| 71 | |
---|
| 72 | /* Receive a feedback from the radio regarding the performance of a |
---|
| 73 | * certain set of parameters, possibly associated with a service. |
---|
| 74 | * |
---|
| 75 | * Feedback is a single set of performance statistics that is achieved |
---|
| 76 | * corresponding to a specific set of transmission parameters. Feedback |
---|
| 77 | * helps a Cognitive Engine make better future decisions based upon |
---|
| 78 | * more accurate performance statistics. |
---|
| 79 | */ |
---|
| 80 | void ReceiveFeedback(Observable *observables,\ |
---|
| 81 | Parameter *parameters); |
---|
| 82 | void ReceiveFeedback(Observable *observables, \ |
---|
| 83 | Parameter *parameters, std::string service); |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | /* BuildCognitiveEngine performs the CE implementation specific work |
---|
| 87 | * that defines the internals of a CE. For example, a CBR CE engine |
---|
| 88 | * would build the case-base reasoner or create the database, a neural |
---|
| 89 | * network based CE may perform the initial training, a GA based CE |
---|
| 90 | * may build the chromosome structure. |
---|
| 91 | */ |
---|
| 92 | void BuildCognitiveEngine(); |
---|
| 93 | |
---|
| 94 | /* The SML_present bool reflects whether or not the remote component |
---|
| 95 | * this object is connected to is an SML. If it isn't, then it must be |
---|
| 96 | * a shell. The socketFD stores the socket file descriptor for this |
---|
| 97 | * connection. |
---|
| 98 | */ |
---|
| 99 | bool SML_present; |
---|
| 100 | int32_t commandSocketFD; |
---|
| 101 | |
---|
| 102 | // TODO Need a description for these fields. Are these radio utilites, |
---|
| 103 | // parameters, and observables global to the whole system? |
---|
| 104 | Utility *uList; |
---|
| 105 | Parameter *pList; |
---|
| 106 | Observable *oList; |
---|
| 107 | struct Radio_Info *radioInfo; |
---|
| 108 | }; |
---|
| 109 | |
---|
| 110 | #endif |
---|