Index: vtcross/branches/nikhil/CBRcode_development/CBR_CE.h
===================================================================
--- vtcross/branches/nikhil/CBRcode_development/CBR_CE.h	(revision 558)
+++ vtcross/branches/nikhil/CBRcode_development/CBR_CE.h	(revision 558)
@@ -0,0 +1,126 @@
+/*
+ Copyright 2009 Virginia Polytechnic Institute and State University  
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+ 
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License. 
+*/
+
+/*! This file provides a default implementation for a case-based-reasoning based
+ * cognitive engine.
+ */
+
+#ifndef CBR_CE_H
+#define CBR_CE_H
+
+#include <cstdlib>
+#include <cstring>
+#include <stdint.h>
+#include <cmath>
+#include <string>
+
+#include "vtcross/cbr.h"
+#include "vtcross/cognitive_engine.h"
+#include "vtcross/ppe.h"
+#include "vtcross/common.h"
+#include "vtcross/containers.h"
+#include "vtcross/debug.h"
+#include "vtcross/error.h"
+#include "vtcross/socketcomm.h"
+
+
+//typedef float (*array)[radioInfo->numParameters][radioInfo->numUtilities];
+
+class CBR_CE : public CognitiveEngine
+{
+    public:
+
+        /*! Default constructor. */
+        CBR_CE() : CognitiveEngine(){};
+        /*! Default destructor. */
+        ~CBR_CE(){};
+
+        /*! \brief Preferred constructor.
+         *
+         * Overloaded constructor that creates a cognitive engine object and
+         * connects it to either the shell or an SML, depening on the SML bool.
+         *
+         * The 'numFields' parameter sets how large the parameter, observable,
+         * and utility arrays should be upon instantiation.
+         */
+        CBR_CE(const char* serverName, const char* serverPort, \
+                const int32_t numFields, const bool SML);
+
+        /*! \brief Request that the CE optimize a set of parameters. 
+         *
+         * Find the most optimal set of transmission parameters given certain
+         * observables and possibly a service if the SML component is present
+         * and active. */
+        Parameter *GetSolution(Observable *observables, \
+                Parameter *currentParameters, Utility *utilities);
+
+        /*! \brief Receive feedback from the radio 
+         *
+         * Receive a feedback from the radio regarding the performance of a
+         * certain set of parameters, possibly associated with a service.
+         *
+         * Feedback is a single set of performance statistics that is achieved
+         * corresponding to a specific set of transmission parameters.  Feedback
+         * helps a Cognitive Engine make better future decisions based upon 
+         * more accurate performance statistics. 
+         */
+        void ReceiveFeedback(Observable *observables,Parameter *parameters, Utility *utilities);
+
+        /*! \brief Initialize the CE and prepare it for operation. 
+         *
+         * BuildCognitiveEngine performs the CE implementation specific work
+         * that defines the internals of a CE.  For example, a CBR CE engine
+         * would build the case-base reasoner or create the database, a neural
+         * network based CE may perform the initial training, a GA based CE
+         * may build the chromosome structure.
+         */
+        void BuildCognitiveEngine();
+
+        /*! \brief Each of these functions responds to a specific command.
+         *
+         * These functions are left principally un-implemented. It is the duty
+         * of child classes to implement these functions, as they define the
+         * cognitive engine's functionality.
+         */
+	void InitialSetting();
+
+        void PerformUpdatePerformance();
+        void PerformRequestOptimization();
+
+        void PerformResetEngineCognitive();
+        void PerformShutdownEngineCognitive();
+
+        CBR *myCBR1;
+	CBR *myCBR2;
+
+    private:
+
+	float * Pweights;
+	float * Uweights;
+
+	float (*Status)[10];
+// this array stores the relationship between all parameters vs utilities.. 
+	float (*Trend)[10];
+
+	int * Slope;
+
+	float PoC;
+// this term represents percentage of change.. as in if this min PoC
+// is not detected its as good as no change.. 
+
+};
+
+#endif
Index: vtcross/branches/nikhil/CBRcode_development/CBR_CE.cpp
===================================================================
--- vtcross/branches/nikhil/CBRcode_development/CBR_CE.cpp	(revision 558)
+++ vtcross/branches/nikhil/CBRcode_development/CBR_CE.cpp	(revision 558)
@@ -0,0 +1,630 @@
+/*
+ Copyright 2009 Virginia Polytechnic Institute and State University  
+
+ Licensed under the Apache License, Version 2.0 (the "License"); 
+ you may not use this file except in compliance with the License. 
+ You may obtain a copy of the License at 
+ 
+ http://www.apache.org/licenses/LICENSE-2.0 
+
+ Unless required by applicable law or agreed to in writing, software 
+ distributed under the License is distributed on an "AS IS" BASIS, 
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ See the License for the specific language governing permissions and 
+ limitations under the License. 
+*/
+
+/*! This file provides a default implementation for a case-based-reasoning based
+ * cognitive engine.
+ */
+
+#include "CBR_CE.h"
+#include <iostream>
+
+
+using namespace std;
+
+// ZERO is consider +1 sign
+inline int signof(int nos) { return ( (nos < 0) ? -1:1 ); }
+//inline int signof(int nos) { return (nos==0)?0:(nos<0?-1:1); }
+
+
+
+CBR_CE::CBR_CE(const char* serverName, const char* serverPort, \
+        const int32_t numFields, const bool SML) \
+    : CognitiveEngine(serverName, serverPort, numFields, SML)
+{
+    BuildCognitiveEngine();
+}
+
+
+Parameter* 
+CBR_CE::GetSolution(Observable *observables, Parameter *currentParameters, Utility *utilities)
+{
+    LOG("Cognitive Engine:: Generating solution.\n");
+
+    string searchNames[radioInfo->numUtilities];
+
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        searchNames[i] = uList[i].name;
+    }
+
+    float searchVals[radioInfo->numUtilities];
+
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        searchVals[i] = uList[i].target;
+    }
+
+    uint32_t numberColumns = radioInfo->numParameters + radioInfo->numUtilities + radioInfo->numObservables + 1;
+    
+    float returnValues[numberColumns];
+    
+    int searchOps[radioInfo->numUtilities];
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+
+        /* If the goal is to maximum, set the search operation to
+         * return values greater than the target.
+         *
+         * If the goal is to minimize, set the search operation to
+         * return values less than the target.
+         *
+         * NOTE: the values '2' and '4' here are from some old preprocesser
+         * definitions, which I will copy here until I can figure out just what
+         * exactly they were for:
+                42	#define EQ 0    // equals
+                43	#define NE 1    // not equals
+                44	#define GT 2    // greater than
+                45	#define GE 3    // greater than or equal to
+                46	#define LT 4    // less than
+                47	#define LE 5    // less than or equal to
+         */
+        if(strcmp(uList[i].goal.c_str(), "max") == 0) {
+            searchOps[i] = 2;
+        } else if(strcmp(uList[i].goal.c_str(), "min") == 0) {
+            searchOps[i] = 4;
+        }
+    }
+
+    /* CBR specific call */
+    uint32_t rc = myCBR1->Search(searchNames, searchOps, searchVals,
+            radioInfo->numUtilities, returnValues);
+
+    if(rc == 0){
+        /* Adapt the returned parameters to meet the objective */
+        LOG("Cognitive Engine:: Found\n");
+
+/*
+        No need or random adaptation since it will get updated 
+        using update function call
+        if(returnValues[numberColumns-1] < 0) {
+            returnValues[2] = returnValues[2] - 15;
+            returnValues[3] = returnValues[3] - 2;
+        } else {
+            returnValues[2] = returnValues[2] + 15;
+            returnValues[3] = returnValues[3] + 2;
+        }
+*/
+    } else if(rc == 31337) {
+        LOG("Cognitive Engine:: Not Found.\n");
+        /* No rows in the CBR, pick default parameters */
+        /* Currently this is hard coded and implementation specific! */
+
+	for (int i = 0; i < radioInfo->numParameters; i++) {
+
+            returnValues[i] = currentParameters[i].value + pList[i].step*Slope[i];
+
+
+////////////////////   LIMITER   /////////////////////////////
+            if (returnValues[i] > pList[i].max) {
+	        std::cout << "SORRY CANT EXCEED MAX VALUE" << std::endl;
+	        returnValues[i] = returnValues[i] - pList[i].step;
+            }
+	    if (returnValues[i] < pList[i].min) {
+		std::cout << "SORRY CANT GO BELOW MIN VALUE" << std::endl;
+	        returnValues[i] = returnValues[i] + pList[i].step ;		 
+	    }
+/////////////////////////////////////////////////////////////
+
+	}
+
+	for (int i = 0; i < radioInfo->numUtilities; i++)
+	    returnValues[radioInfo->numParameters + i] = uList[i].value;
+
+	for (int i = 0; i < radioInfo->numObservables; i++)
+	    returnValues[radioInfo->numParameters + radioInfo->numUtilities + i] = oList[i].value;
+
+    size_t returnValueIndex = 0;
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        pList[i].value = returnValues[returnValueIndex];
+        returnValueIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numParameters; i++) {
+        uList[i].value = returnValues[returnValueIndex];
+        returnValueIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numObservables; i++) {
+        oList[i].value = returnValues[returnValueIndex];
+        returnValueIndex++;
+    }
+    returnValues[returnValueIndex] = 0;
+
+    string allNames[numberColumns];
+    size_t allNameIndex = 0;
+    for(size_t i = 0; i < radioInfo->numParameters; i++) {
+        allNames[allNameIndex] = pList[i].name;
+        allNameIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        allNames[allNameIndex] = uList[i].name;
+        allNameIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numObservables; i++) {
+        allNames[allNameIndex] = oList[i].name;
+        allNameIndex++;
+    }
+    allNames[allNameIndex] = "TotalWeight";
+
+    // Add row to CBR. 
+    myCBR1->AddRow(allNames, returnValues, returnValueIndex + 1);
+    myCBR2->AddRow(allNames, returnValues, returnValueIndex + 1);	
+	} else {
+        LOG("Cognitive Engine:: Search return an invalid value.\n");
+    }
+
+
+    return pList;
+}
+
+
+void 
+CBR_CE::ReceiveFeedback(Observable *observables, Parameter *parameters, Utility *utilities)
+{ 
+    LOG("Cognitive Engine:: Receiving feedback.\n");
+    
+    uint32_t numberColumns = radioInfo->numParameters + radioInfo->numUtilities + radioInfo->numObservables + 1;
+
+    uint32_t whereLen = radioInfo->numParameters;
+    uint32_t setLen = radioInfo->numUtilities + radioInfo->numObservables + 1;
+
+
+    float whereValue[whereLen];
+    float setValue[setLen];
+    string whereList[whereLen];
+    string setList[setLen];
+
+/*
+    size_t columnObsIndex = 0;
+    for (size_t i = 0; i < radioInfo->numObservables; i++){
+        obsList[columnObsIndex] = observables[i].name;
+        columnObsIndex++;
+    }  
+    obsList[columnObsIndex] = "utility";
+
+    size_t columnIndex = 0;
+    for (size_t i = 0; i < radioInfo->numParameters; i++){
+        nameList[columnIndex] = parameters[i].name;
+        columnIndex++;
+    }   
+    for (size_t i = 0; i < radioInfo->numUtilities; i++){
+        nameList[columnIndex] = uList[i].name;
+        columnIndex++;
+    }   
+
+    size_t obsValueIndex = 0;
+    for(size_t i = 0; i < radioInfo->numObservables; i++) {
+        obsVals[obsValueIndex] = observables[i].value;
+        obsValueIndex++;
+    }
+
+///  Calculate Utility 
+   float newUtilityValue = 0;
+
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        newUtilityValue = newUtilityValue + (uList[i].target - observables[i].value);
+    }
+    obsVals[obsValueIndex] = newUtilityValue;
+
+    size_t returnValueIndex = 0;
+    for(size_t i = 0; i < radioInfo->numParameters; i++) {
+        valList[returnValueIndex] = parameters[i].value;
+        returnValueIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+        valList[returnValueIndex] = uList[i].target;
+        returnValueIndex++;
+    }
+*/
+	float TotalWeight = 0;
+	int Penalty = 10;
+
+    for(size_t i = 0; i < radioInfo->numParameters; i++) {
+        whereList[i] = parameters[i].name;
+        whereValue[i] = parameters[i].value;
+	TotalWeight += parameters[i].value*Pweights[i];
+    }
+
+    size_t returnValueIndex = 0;
+    for(size_t i = 0; i < radioInfo->numUtilities; i++) {
+	setList[returnValueIndex] = utilities[i].name;
+	setValue[returnValueIndex] = utilities[i].value;
+	if ((utilities[i].value > uList[i].target && uList[i].goal == "max") || (utilities[i].value < uList[i].target && uList[i].goal == "min")) 
+		TotalWeight += abs(utilities[i].value - uList[i].target)*Uweights[i];
+	else
+                TotalWeight += abs(utilities[i].value - uList[i].target)*Uweights[i]*Penalty;   
+        returnValueIndex++;
+    }
+    for(size_t i = 0; i < radioInfo->numObservables; i++) {
+	setList[returnValueIndex] = observables[i].name;
+	setValue[returnValueIndex] = observables[i].value;
+	returnValueIndex++;
+    }
+	setList[returnValueIndex] = "TotalWeight";
+	setValue[returnValueIndex] = TotalWeight; 
+	
+myCBR1->Update(whereList,setList,whereValue,setValue,whereLen,setLen);
+
+// MAIN CODE HERE //
+
+int searchOps[radioInfo->numParameters];
+string searchNames[radioInfo->numParameters];
+float searchVals[radioInfo->numParameters];
+float returnValues[numberColumns];
+
+
+for (int L = 0; L < radioInfo->numParameters ; L++) { 
+   searchOps[L] = 0;
+   searchNames[L] = parameters[L].name;
+   searchVals[L] = parameters[L].value;
+}
+
+
+for (int lp = 0; lp < radioInfo->numParameters; lp++ ) {
+
+   searchOps[lp] = (Slope[lp] == -1)?2:4;   
+
+   uint32_t rc = myCBR1->Search(searchNames, searchOps, searchVals,radioInfo->numParameters, returnValues);
+
+    for (int ul = 0; ul < radioInfo->numUtilities; ul++) {
+	int rl = radioInfo->numParameters + ul;
+	if( (1 - returnValues[rl]/utilities[ul].value) > PoC ) {
+	    if(Trend[lp][ul] == 0) {
+
+		if ((returnValues[rl] > utilities[ul].value) && Status[lp][ul] >= 0 ) {
+		    Status[lp][ul] += 1;
+		} 
+		else if ( ((returnValues[rl]) < utilities[ul].value) && Status[lp][ul] ) {
+		    Status[lp][ul] -= 1;
+ 		}		
+		else {
+		    Status[lp][ul] = 0;
+		}
+	    
+		if (abs(Status[lp][ul]) > 2) {
+		    Trend[lp][ul] = signof(Status[lp][ul]);
+		}
+            }
+	    else if ( Trend[lp][ul] == 1 && (returnValues[rl] > utilities[ul].value) && Status[lp][ul] >= 0 ) {
+		    Status[lp][ul] += 1;
+	    }
+	    else if ( Trend[lp][ul] == -1 && (returnValues[rl] < utilities[ul].value) && Status[lp][ul] <= 0) {
+		    Status[lp][ul] -= 1;
+            }
+	    else {
+		    Status[lp][ul] = 0;
+		    Trend[lp][ul] = 0;	
+	    }
+
+
+
+	}
+    }
+
+}
+
+// updating slope matrix..
+// AS OF NOW VALID ONLY FOR ONE UTILITY 
+    for (int i = 0; i < radioInfo->numParameters; i++) {
+	if ( (uList[0].goal == "min" && Trend[i][0] <= 0) || (uList[0].goal == "max" && Trend[i][0] >= 0) ) {
+	    Slope[i] = 1;
+	}
+	else { 
+	    Slope[i] = -1;	
+	}
+    }
+
+
+
+ /// end of MAIN CODE //
+}
+
+void
+CBR_CE::BuildCognitiveEngine()
+{
+    string filename = "exdb";
+    string tablename1 = "data1";
+    string tablename2 = "data2";
+
+	//// NEW SET OF VARIABLES ///
+
+//	float * Pweights = new float[radioInfo->numParameters];
+	float * Uweights = new float[radioInfo->numUtilities];
+	float * Pweights = new float[radioInfo->numParameters];
+
+///// we have to assume 10 utilities maxxx!!!! VERY important
+
+	float (*Status)[10] = new float[radioInfo->numParameters][10];
+	float (*Trend)[10] = new float[radioInfo->numParameters][10];
+	float PoC = 0.1;
+	int * Slope = new int[radioInfo->numParameters];	
+
+//	InitialSetting();
+
+////////////initializing here since initialsetting giving wierd errors/////
+
+        for (int x = 0; x < radioInfo->numParameters; x++) {
+                std::cout << x << std::endl;
+                Pweights[x] = 1/(pList[x].step);
+                Slope[x] = 1;
+        }
+
+
+
+        for (size_t i = 0; i < radioInfo->numUtilities; i++) {
+                Uweights[i] = 1;
+        }
+
+
+        for (size_t i = 0; i < radioInfo->numParameters; i++) {
+                for (size_t k = 0; k < radioInfo->numUtilities; k++) {
+                        Status[i][k] = 0;
+                        Trend[i][k] = 0;
+                }
+        }
+////////////////////////////////////////////////////////////////////////
+
+
+
+
+    uint32_t numberColumns = radioInfo->numParameters + radioInfo->numUtilities \
+                             + radioInfo->numObservables + 1;
+
+    uint32_t numberParameters = radioInfo->numParameters;
+    uint32_t numberUtilities = radioInfo->numUtilities;
+
+    string cols[numberColumns];
+    string Plist[numberParameters];
+    string Ulist[numberUtilities];
+    float Utarget[numberUtilities];
+    string Ugoal[numberUtilities];
+
+    size_t columnIndex = 0;
+    size_t Pindex = 0;              // new
+    size_t Uindex = 0;              // new
+
+
+    for (size_t i = 0; i < radioInfo->numParameters; i++){
+        cols[columnIndex] = pList[i].name;
+        columnIndex++;
+        Plist[Pindex] = pList[i].name;   // new
+        Pindex++;                        // new
+    }
+    for (size_t i = 0; i < radioInfo->numUtilities; i++){
+        cols[columnIndex] = uList[i].name;
+        columnIndex++;
+        Ulist[Uindex] = uList[i].name;     // new
+	Utarget[Uindex] = uList[i].target; // new
+	Ugoal[Uindex] = uList[i].goal;	   // new
+        Uindex++;			   // new
+
+    }      
+    for (size_t i = 0; i < radioInfo->numObservables; i++){   
+        cols[columnIndex] = oList[i].name;
+	columnIndex++;
+    }
+    cols[columnIndex] = "TotalWeight";	
+
+    myCBR1 = new CBR(filename, tablename1, cols, numberColumns);	
+
+    myCBR2 = new CBR(filename, tablename2, cols, numberColumns);	
+
+
+
+}
+
+
+void 
+CBR_CE::PerformUpdatePerformance()
+{
+
+    /* Receive Set of current Parameters */
+    char buffer[256];
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD, buffer);
+    uint32_t numParameters = atoi(buffer);
+
+    Parameter *p = new Parameter[numParameters];
+
+    for(size_t i = 0; i < numParameters; i++) {
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        p[i].name = std::string(buffer);
+
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        p[i].value = atof(buffer);
+    } 
+
+
+    /* Receive Set of Observables */
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD, buffer);
+    uint32_t numObservables = atoi(buffer);
+
+    Observable *o = new Observable[numObservables];
+
+    for(size_t i = 0; i < numObservables; i++) {
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        o[i].name = std::string(buffer);
+
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        o[i].value = atof(buffer);
+    }
+
+
+    /* Receive Set of Utilities */
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD, buffer);
+    uint32_t numUtilities = atoi(buffer);
+    
+    Utility *u = new Utility[numUtilities];
+
+    for(size_t i = 0; i < numUtilities; i++) {
+ 	memset(buffer, 0, 256);
+	ReadMessage(commandSocketFD, buffer);
+	u[i].name = std::string(buffer);
+	
+	memset(buffer, 0, 256);
+	ReadMessage(commandSocketFD, buffer);
+	u[i].value = atof(buffer);
+    }
+ 
+    ReceiveFeedback(o, p, u);
+
+    delete [] o;
+    delete [] p;
+    delete [] u;
+}
+
+
+void
+CBR_CE::PerformRequestOptimization()
+{
+    /* Receive Set of Observables */
+    LOG("\nCognitive Engine:: Receiving Observables\n");
+
+    char buffer[256];
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD,buffer);
+    uint32_t numObservables = atoi(buffer);
+
+    Observable *o = new Observable[numObservables];
+
+    for(size_t i = 0; i < numObservables; i++) {
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        o[i].name = std::string(buffer);
+
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        o[i].value = atof(buffer);
+    }  
+
+    /* Receive Set of current Parameters */
+    LOG("Cognitive Engine:: Receiving Current Transmission Parameters\n");
+
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD, buffer);
+    uint32_t numCurrentParameters = atoi(buffer);
+
+    Parameter *cp = new Parameter[numCurrentParameters];
+
+    for(size_t i = 0; i < numCurrentParameters; i++) {
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        cp[i].name = std::string(buffer);
+
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        cp[i].value = atof(buffer);
+    }
+
+    /* Receive Set of Utilities */
+    LOG("Cognitive Engine:: Receiving Utilities\n");
+
+    memset(buffer, 0, 256);
+    ReadMessage(commandSocketFD, buffer);
+    uint32_t numUtilities = atoi(buffer);
+
+    Utility *u = new Utility[numUtilities];
+
+    for(size_t i = 0; i < numUtilities; i++) {
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        u[i].name = std::string(buffer);
+
+        memset(buffer, 0, 256);
+        ReadMessage(commandSocketFD, buffer);
+        u[i].value = atof(buffer);
+    }
+
+
+
+  
+    LOG("Cognitive Engine:: Processing parameters....\n");
+
+    Parameter *solutionSet;
+    
+    solutionSet = GetSolution(o,cp,u);
+
+ 
+   
+    LOG("Cognitive Engine:: Sending Optimal Parameters to Application.\n");
+    char numParametersChar[10];
+    char solutionValue[50];
+    sprintf(numParametersChar, "%i", radioInfo->numParameters);
+    SendMessage(commandSocketFD, numParametersChar);
+    for(size_t i = 0; i < radioInfo->numParameters; i++) {
+        SendMessage(commandSocketFD, solutionSet[i].name.c_str());
+        memset(solutionValue, 0, 50);
+        sprintf(solutionValue, "%f", solutionSet[i].value);
+        SendMessage(commandSocketFD, solutionValue);
+    }
+
+    delete [] o;
+    delete [] cp;
+    delete [] u;
+}
+
+void CBR_CE::InitialSetting()
+{
+
+	std::cout << "inside initilsetting method" << std::endl; 
+
+	for (int x = 0; x < radioInfo->numParameters; x++) {
+		std::cout << x << std::endl;
+		Pweights[x] = 1/(pList[x].step);
+		Slope[x] = 0;
+	}
+
+
+
+	for (size_t i = 0; i < radioInfo->numUtilities; i++) { 
+		Uweights[i] = 1;
+	}
+
+
+	for (size_t i = 0; i < radioInfo->numParameters; i++) {
+		for (size_t k = 0; k < radioInfo->numUtilities; k++) {
+			Status[i][k] = 0;
+			Trend[i][k] = 0;
+		}
+	}
+
+}
+
+
+void
+CBR_CE::PerformResetEngineCognitive()
+{
+    Reset();
+}
+
+
+void
+CBR_CE::PerformShutdownEngineCognitive()
+{
+    Shutdown();
+}
+ 
