root/vtcross/trunk/src/include/vtcross/cognitive_engine.h @ 531

Revision 531, 6.4 KB (checked in by bhilburn, 14 years ago)

Creating the new CognitiveEngine?.cpp default implementation file,
starting to flesh it out.

Line 
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/*! \brief Cognitive Engine class declaration.
28 *
29 * This is the declaration for the default cognitive engine class.  Note that
30 * most of the below functions are implemented in CognitiveEngine.cpp - however,
31 * the functionality is very non-specific.
32 *
33 * Each of the 'Perform*' functions are left un-implemented, for the most part.
34 *
35 * The purpose of this class is to act as a non-abstract parent class.
36 * Cognitive Engines should be built by publically inherting from this class,
37 * and overloading the 'Perform*' functions - thus creating new and specific
38 * cognitive engine functionality, without the need to rewrite or copy/paste the
39 * rest of the code. Other functions that need to be overloaded include:
40 *  1
41 *  2
42 *  3
43 *
44 * Note, however, that all functions are virtual.  Any function may be
45 * overloaded by the child class, if desired.
46 */
47class CognitiveEngine : public Engine
48{
49    public:
50        /*! Default constructor. */
51        CognitiveEngine();
52
53        /*! Default destructor. */
54        ~CognitiveEngine();
55
56        /*! \brief Preferred constructor.
57         *
58         * Overloaded constructor that creates a cognitive engine object and
59         * connects it to either the shell or an SML, depening on the SML bool.
60         *
61         * The 'numFields' parameter sets how large the parameter, observable,
62         * and utility arrays should be upon instantiation.
63         */
64        CognitiveEngine(const char* serverName, const char* serverPort, \
65                const int32_t numFields, const bool SML);
66       
67        virtual void SendComponentType();
68        virtual void ConnectToRemoteComponent(const char* serverName, \
69                const char* serverPort, const bool SML);
70        virtual void WaitForSignal();
71        virtual void Shutdown();
72        virtual void Reset();
73        virtual void RegisterComponent();
74        virtual void DeregisterComponent();
75
76        virtual void RegisterServices();
77        virtual void DeregisterServices();
78
79        /*! \brief Receive radio XML configuration.
80         *
81         * Receive the transmitted radio configuration from the radio itself
82         * (the CE will not always be local to the radio). This gets passed
83         * through either the Shell or the SML. */
84        virtual void ReceiveRadioConfiguration();
85
86        /*! \brief Receive an 'experience' report from the radio.
87         *
88         * An experience report can be used to build the transmission history
89         * for a CE just starting up so that it has a moving start regarding
90         * parameter optimization. */
91        virtual void ReceiveExperience();
92
93        /*! \brief Request that the CE optimize a set of parameters.
94         *
95         * Find the most optimal set of transmission parameters given certain
96         * observables and possibly a service if the SML component is present
97         * and active. */
98        virtual Parameter *GetSolution(Observable *observables, \
99                Parameter *currentParameters);
100        virtual Parameter *GetSolution(Observable *observables, \
101                Parameter *currentParameters, std::string service);
102
103        /*! \brief Receive feedback from the radio
104         *
105         * Receive a feedback from the radio regarding the performance of a
106         * certain set of parameters, possibly associated with a service.
107         *
108         * Feedback is a single set of performance statistics that is achieved
109         * corresponding to a specific set of transmission parameters.  Feedback
110         * helps a Cognitive Engine make better future decisions based upon
111         * more accurate performance statistics.
112         */
113        virtual void ReceiveFeedback(Observable *observables,Parameter *parameters);
114        virtual void ReceiveFeedback(Observable *observables, Parameter *parameters, \
115                std::string service);
116
117
118        /*! \brief Initialize the CE and prepare it for operation.
119         *
120         * BuildCognitiveEngine performs the CE implementation specific work
121         * that defines the internals of a CE.  For example, a CBR CE engine
122         * would build the case-base reasoner or create the database, a neural
123         * network based CE may perform the initial training, a GA based CE
124         * may build the chromosome structure.
125         */
126        virtual void BuildCognitiveEngine();
127
128        /*! \brief Each of these functions responds to a specific command.
129         *
130         * These functions are left principally un-implemented. It is the duty
131         * of child classes to implement these functions, as they define the
132         * cognitive engine's functionality.
133         */
134        virtual void PerformUpdatePerformance();
135        virtual void PerformRequestOptimizationService();
136        virtual void PerformRequestOptimization();
137        virtual void PerformQueryComponentType();
138        virtual void PerformConnectSML();
139        virtual void PerformDisconnectSML();
140        virtual void PerformResetEngineCognitive();
141        virtual void PerformShutdownEngineCognitive();
142 
143        /*! \brief Keept track of what this CE is connected to.
144         *
145         * The SML_present bool reflects whether or not the remote component
146         * this object is connected to is an SML.  If it isn't, then it must be
147         * a shell.  The socketFD stores the socket file descriptor for this
148         * connection.
149         */
150        bool SML_present;
151        int32_t commandSocketFD;
152       
153        // TODO Need a description for these fields.  Are these radio utilites,
154        // parameters, and observables global to the whole system?
155        Utility *uList;
156        Parameter *pList;
157        Observable *oList;
158        struct Radio_Info *radioInfo;
159};
160
161#endif
Note: See TracBrowser for help on using the browser.