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

Revision 530, 6.1 KB (checked in by bhilburn, 14 years ago)

Redefining the cognitive engine class to reflect new class hierarchy.
From this point forward, the code will not compile until the task is
complete.

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