root/vtcross/trunk/src/cognitive_engines/CBR_CE/CBR_CE.h @ 545

Revision 545, 4.1 KB (checked in by bhilburn, 14 years ago)

Updated all cognitive engine examples to use new CBR structure.

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 file provides a default implementation for a case-based-reasoning based
18 * cognitive engine.
19 */
20
21#ifndef CBR_CE_H
22#define CBR_CE_H
23
24#include <cstdlib>
25#include <cstring>
26#include <stdint.h>
27#include <cmath>
28#include <string>
29
30#include "vtcross/cbr.h"
31#include "vtcross/cognitive_engine.h"
32#include "vtcross/common.h"
33#include "vtcross/containers.h"
34#include "vtcross/debug.h"
35#include "vtcross/error.h"
36#include "vtcross/socketcomm.h"
37
38
39class CBR_CE : public CognitiveEngine
40{
41    public:
42        /*! Default constructor. */
43        CBR_CE() : CognitiveEngine(){};
44
45        /*! Default destructor. */
46        ~CBR_CE(){};
47
48        /*! \brief Preferred constructor.
49         *
50         * Overloaded constructor that creates a cognitive engine object and
51         * connects it to either the shell or an SML, depening on the SML bool.
52         *
53         * The 'numFields' parameter sets how large the parameter, observable,
54         * and utility arrays should be upon instantiation.
55         */
56        CBR_CE(const char* serverName, const char* serverPort, \
57                const int32_t numFields, const bool SML);
58
59        void RegisterServices();
60        void DeregisterServices();
61
62        /*! \brief Request that the CE optimize a set of parameters.
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        Parameter *GetSolution(Observable *observables, \
68                Parameter *currentParameters);
69        Parameter *GetSolution(Observable *observables, \
70                Parameter *currentParameters, std::string service);
71
72        /*! \brief Receive feedback from the radio
73         *
74         * Receive a feedback from the radio regarding the performance of a
75         * certain set of parameters, possibly associated with a service.
76         *
77         * Feedback is a single set of performance statistics that is achieved
78         * corresponding to a specific set of transmission parameters.  Feedback
79         * helps a Cognitive Engine make better future decisions based upon
80         * more accurate performance statistics.
81         */
82        void ReceiveFeedback(Observable *observables,Parameter *parameters);
83        void ReceiveFeedback(Observable *observables, Parameter *parameters, \
84                std::string service);
85
86
87        /*! \brief Initialize the CE and prepare it for operation.
88         *
89         * BuildCognitiveEngine performs the CE implementation specific work
90         * that defines the internals of a CE.  For example, a CBR CE engine
91         * would build the case-base reasoner or create the database, a neural
92         * network based CE may perform the initial training, a GA based CE
93         * may build the chromosome structure.
94         */
95        void BuildCognitiveEngine();
96
97        /*! \brief Each of these functions responds to a specific command.
98         *
99         * These functions are left principally un-implemented. It is the duty
100         * of child classes to implement these functions, as they define the
101         * cognitive engine's functionality.
102         */
103        void PerformUpdatePerformance();
104        void PerformRequestOptimizationService();
105        void PerformRequestOptimization();
106        void PerformQueryComponentType();
107        void PerformConnectSML();
108        void PerformDisconnectSML();
109        void PerformResetEngineCognitive();
110        void PerformShutdownEngineCognitive();
111
112        CBR *myCBR;
113};
114
115#endif
Note: See TracBrowser for help on using the browser.