📄 classifier.h
字号:
/* XCSR_DE1.0
* --------------------------------------------------------
* Learning classifier system based on accuracy in dynamic environments
*
* by Huong Hai (Helen) Dam
* z3140959@itee.adfa.edu.au
* UNSW @ ADFA, Canberra Australia
* Artificial Life and Adaptive Robotics Laboratory
* http://www.itee.adfa.edu.au/~alar
*
* Last modified: 24-11-2005
*
*/
#ifndef CLASSIFIER_H
#define CLASSIFIER_H
#include "declare.h"
#include "random.h"
#include <fstream.h>
#include <string.h>
class Classifier {
public:
Classifier(int type);
~Classifier();
double getFitness() {return m_fitness; }
void resetParam();
double getPrediction(){return m_prediction;}
void setPrediction(double prediction){m_prediction = prediction;}
double getPredictionError(){return m_prediction_error;}
void setPredictionError(double prediction_error){m_prediction_error = prediction_error;}
double getAccuracy(){return m_accuracy;}
void setAccuracy(double accuracy){ m_accuracy = accuracy;}
int getNum(){return m_num;}
void setNum(int num){m_num = num;}
void increaseNum(){m_num++;}
void decreaseNum(){m_num--;}
double getAS(){return m_as;}
void setAS(double as){m_as = as;}
int getExp(){return m_exp;}
void setExp(int exp){m_exp = exp;}
void increaseExp(){m_exp = m_exp + 1;}
int getRepresentationType(){return rep_type;}
int getTimeStamp(){return m_timestamp;}
void setTimeStamp(int timestamp){m_timestamp = timestamp;}
//void setFitness(double fitness){m_fitness = fitness;}
void updateFitness(double fitness){ m_fitness = fitness;}
int getAction() { return m_interval->action;}
//void setAction(Action *action){m_action = action;}
d_interval_t* getInterval(){ return m_interval;}
void classifiercpy(Classifier *c);
void savePopulation(ofstream &of);
int matchInput(input_t *input);
int matchClassifier(Classifier *c);
double getIntervalMin(int i);
double getIntervalMax(int i);
void validateClassifier();
int belongTo(); //Return to the correct rule, which the classifier is belong to in MP
int getSchemaOrder();
int getSchemaLength();
int getSchema(){return schema;}
void setSchema(int s){schema = s;}
void print();
#ifdef MP
int isASchema(double threshold, int id);
int belongToSchema(double threshold, int id);
#endif
private:
int rep_type;
d_interval_t *m_interval;
double m_fitness;
double m_prediction;
double m_prediction_error;
double m_accuracy;
int m_num;
int m_exp;
int m_timestamp; //time stamp of GA occurs
double m_as; //action size
int schema;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -