GuiNuMo: beginning of Viterbi & many other things

Partout où cela était possible :
* Utilisation du passage de paramètre aux fonctions par référence
  constante plutôt que par valeur.

server.cc/hh :
* Suppression de l'ancienne ébauche de Fred viterbiLike().
* Création de la fonction fastViterbiLike() (Viterbi-like optimisé).
* Fonctions getkWeightedInSs() et getkClosestInSs() : simplification du
  traitement des points ignorés (suppression du booléen et passage du
  point à ignorer en pointeur, de manière à permettre une valeur NULL).
  Création de surcharges pour un appel sans point à ignorer.
* Lecture de trois coordonnées (X;Y;Z) au lieu de deux (X;Y) depuis le
  fichier des points de référence (fonctions
  makeReferencePointListFromFile() et
  extractReferencePointInfoFromBuffer()).
* Lecture des fichiers au format « Matteo » (une ligne par agrégation).
  Le format « Fred » (une ligne par AP par agrégation) est toujours
  supporté (via #define FRED_CSV_FORMAT).
* Ajout d'affichages supplémentaires pour le déboguage.

clientinfo.cc/hh :
* Modifications des attributs pour l'algorithme Viterbi-like.

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@29 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
Matteo Cypriani 2008-04-30 09:36:55 +00:00
parent f5292a5dd6
commit ae11d3a2c3
14 changed files with 444 additions and 145 deletions

View File

@ -1,7 +1,7 @@
GXX=g++ GXX=g++
GXXFLAGS=-Wall -O2 GXXFLAGS=-Wall -O2
LD=g++ LD=g++
LDFLAGS= -lm -O2 LDFLAGS=-Wall -lm -O2
all: test all: test

View File

@ -1,7 +1,7 @@
#include "accesspoint.hh" #include "accesspoint.hh"
AccessPoint::AccessPoint(string addr, float fidx, Point coords, unsigned int f, float antg, float outp) AccessPoint::AccessPoint(const string &addr, const float &fidx, const Point &coords, const unsigned int &f, const float &antg, const float &outp)
{ {
coordinates = coords; coordinates = coords;
ap_addr = addr; ap_addr = addr;
@ -46,7 +46,7 @@ AccessPoint AccessPoint::operator=(const AccessPoint &ap)
return *this; return *this;
} }
ostream &operator<<(ostream & os, AccessPoint & ap) ostream &operator<<(ostream &os, const AccessPoint &ap)
{ {
os << "MAC Address: " << ap.ap_addr << endl; os << "MAC Address: " << ap.ap_addr << endl;
os << "Coordinates: " << ap.coordinates << endl; os << "Coordinates: " << ap.coordinates << endl;

View File

@ -25,7 +25,7 @@ protected:
float output_power; float output_power;
public: public:
AccessPoint(string addr = AP_DEFAULT_ADDR, float fidx = AP_DEFAULT_FRIIS_INDEX, Point coords = Point(), unsigned int f = AP_DEFAULT_FREQ, float antg = AP_DEFAULT_ANTENNA_GAIN, float outp = AP_DEFAULT_OUTPUT_POWER); AccessPoint(const string &addr = AP_DEFAULT_ADDR, const float &fidx = AP_DEFAULT_FRIIS_INDEX, const Point &coords = Point(), const unsigned int &f = AP_DEFAULT_FREQ, const float &antg = AP_DEFAULT_ANTENNA_GAIN, const float &outp = AP_DEFAULT_OUTPUT_POWER);
AccessPoint(const AccessPoint &ap); AccessPoint(const AccessPoint &ap);
~AccessPoint() {}; ~AccessPoint() {};
string getApAddr()const { return ap_addr; }; string getApAddr()const { return ap_addr; };
@ -34,17 +34,17 @@ public:
float getAntennaGain()const { return antenna_gain; }; float getAntennaGain()const { return antenna_gain; };
unsigned int getFrequency()const { return freq; }; unsigned int getFrequency()const { return freq; };
float getOutputPower()const { return output_power; }; float getOutputPower()const { return output_power; };
void setApAddr(string addr) { ap_addr = addr; }; void setApAddr(const string &addr) { ap_addr = addr; };
void setFriisIndex(float fidx) { friis_index = fidx; }; void setFriisIndex(const float &fidx) { friis_index = fidx; };
void setCoordinates(Point apc) { coordinates = apc; }; void setCoordinates(const Point &apc) { coordinates = apc; };
void setCoordinates(float x, float y, float z) { Point apc(x, y, z); coordinates = apc; }; void setCoordinates(const float &x, const float &y, const float &z) { Point apc(x, y, z); coordinates = apc; };
void setFrequency(unsigned int f) { freq = f; }; void setFrequency(const unsigned int &f) { freq = f; };
void setAntennaGain(float antg) { antenna_gain = antg; }; void setAntennaGain(const float &antg) { antenna_gain = antg; };
void setOutputPower(float outp) {output_power = outp; }; void setOutputPower(const float &outp) {output_power = outp; };
bool operator==(const AccessPoint &ap)const; bool operator==(const AccessPoint &ap)const;
bool operator!=(const AccessPoint &ap)const; bool operator!=(const AccessPoint &ap)const;
AccessPoint operator=(const AccessPoint &ap); AccessPoint operator=(const AccessPoint &ap);
friend ostream &operator<<(ostream & os, AccessPoint & ap); friend ostream &operator<<(ostream &os, const AccessPoint &ap);
}; };
#endif #endif

View File

@ -0,0 +1,19 @@
# Fichier de configuration pour les AP.
# Chaque ligne est de la forme :
# MAC;X;Y;Z;Fréquence d'émission (Hz);Gain d'antenne (dBi);Puissance d'émission (dBm)
# Les lignes vides ou commençant par un # sont ignorées. Les commentaires doivent obligatoirement être en début de ligne.
# mini5 (Laseldi)
00:13:CE:95:E1:6F;4.93;25.81;3.00;2417000000;5.0;20.0
# mini6 (Laurent / Wassim Haimed)
00:13:CE:95:DE:7E;4.83;10.88;3.71;2417000000;5.0;20.0
# mini4 (Incubateur)
00:13:CE:97:78:79;20.05;28.31;3.74;2417000000;5.0;20.0
# mini3 (Dominique)
00:13:CE:8F:77:43;7.085;4.13;0.74;2417000000;5.0;20.0
# mini1 (Adrien)
00:13:CE:8F:78:D9;30.35;5.74;0.98;2417000000;5.0;20.0

View File

@ -1,19 +1,31 @@
#include "clientinfo.hh" #include "clientinfo.hh"
ClientInfo::ClientInfo(string ip, int port, float antg) ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
{ {
client_ip = ip; client_ip = ip;
antenna_gain = antg; antenna_gain = antg;
client_listen_port = port; client_listen_port = port;
for(int i=0 ; i < 5 ; i++) int N = VITERBI_N, K = VITERBI_K ;
viterbi_distances[i] = 0; viterbi_V = new float*[N-1] ;
for (int n=0 ; n < N-1 ; n++)
{
viterbi_V[n] = new float[K] ;
for (int k=0 ; k < K ; k++)
viterbi_V[n][k] = 0 ;
}
} }
ClientInfo::~ClientInfo() ClientInfo::~ClientInfo()
{ {
viterbi_vector1.clear(); viterbi_Eprevious.clear();
viterbi_vector2.clear(); viterbi_Ecurrent.clear();
int N = VITERBI_N ;
for(int n=0; n < N-1 ; n++)
delete[] viterbi_V[n] ;
delete viterbi_V ;
} }

View File

@ -13,20 +13,27 @@ using std::string;
#define CLIENT_DEFAULT_IP "127.0.0.1" #define CLIENT_DEFAULT_IP "127.0.0.1"
#define CLIENT_DEFAULT_ANTENNA_GAIN 2 // Good default value #define CLIENT_DEFAULT_ANTENNA_GAIN 2 // Good default value
#define VITERBI_N 5
#define VITERBI_K 8
class ClientInfo class ClientInfo
{ {
protected: protected:
string client_ip; string client_ip;
float antenna_gain; float antenna_gain;
int client_listen_port; int client_listen_port;
vector<Point> viterbi_vector1; // Previous vector vector<Point> viterbi_Ecurrent; // Last vector
vector<Point> viterbi_vector2; // Last vector vector<Point> viterbi_Eprevious; // Previous vector
float viterbi_distances[5]; // float viterbi_distances[5];
float **viterbi_V ;
public: public:
ClientInfo(string ip = CLIENT_DEFAULT_IP, int port = CLIENT_DEFAULT_PORT, float antg = CLIENT_DEFAULT_ANTENNA_GAIN); ClientInfo(const string &ip = CLIENT_DEFAULT_IP, const int &port = CLIENT_DEFAULT_PORT, const float &antg = CLIENT_DEFAULT_ANTENNA_GAIN);
~ClientInfo(); ~ClientInfo();
float getAntennaGain()const { return antenna_gain; }; float getAntennaGain()const { return antenna_gain; };
vector<Point>& getRef_viterbi_Ecurrent() { return viterbi_Ecurrent; } ;
vector<Point>& getRef_viterbi_Eprevious() { return viterbi_Eprevious; } ;
float** get_viterbi_V() { return viterbi_V; } ;
}; };
#endif #endif

View File

@ -1,6 +1,6 @@
#include "measurement.hh" #include "measurement.hh"
void Measurement::addSsValue(int ssv) void Measurement::addSsValue(const int &ssv)
{ {
float ss_mwatts = pow(10, (float) ssv / 10.0) + (ss_list.size() * pow(10, average_ss / 10.0)); float ss_mwatts = pow(10, (float) ssv / 10.0) + (ss_list.size() * pow(10, average_ss / 10.0));
@ -8,12 +8,12 @@ void Measurement::addSsValue(int ssv)
average_ss = 10 * log10(ss_mwatts / ss_list.size()); average_ss = 10 * log10(ss_mwatts / ss_list.size());
} }
float Measurement::getSsSquareDistance(float ss)const float Measurement::getSsSquareDistance(const float &ss)const
{ {
return ((ss - average_ss) * (ss - average_ss)); return ((ss - average_ss) * (ss - average_ss));
} }
ostream &operator<<(ostream &os, Measurement &m) ostream &operator<<(ostream &os, const Measurement &m)
{ {
unsigned int i; unsigned int i;

View File

@ -17,16 +17,16 @@ protected:
vector<int> ss_list; vector<int> ss_list;
public: public:
Measurement(string ma = "ff:ff:ff:ff:ff:ff", float avg = 0, vector<int> ssl = vector<int>()) { mac_addr = ma; average_ss = avg, ss_list = ssl; }; Measurement(const string &ma = "ff:ff:ff:ff:ff:ff", const float &avg = 0, const vector<int> &ssl = vector<int>()) { mac_addr = ma; average_ss = avg, ss_list = ssl; };
Measurement(const Measurement &m) { mac_addr = m.mac_addr; average_ss = m.average_ss; ss_list = m.ss_list; }; Measurement(const Measurement &m) { mac_addr = m.mac_addr; average_ss = m.average_ss; ss_list = m.ss_list; };
~Measurement() { ss_list.clear(); }; ~Measurement() { ss_list.clear(); };
vector<int> getSsList()const { return ss_list; }; vector<int> getSsList()const { return ss_list; };
float getAverage()const { return average_ss; }; float getAverage()const { return average_ss; };
string getMacAddr()const { return mac_addr; }; string getMacAddr()const { return mac_addr; };
void addSsValue(int ssv); void addSsValue(const int &ssv);
void setMacAddr(string ma) { mac_addr = ma; }; void setMacAddr(const string &ma) { mac_addr = ma; };
float getSsSquareDistance(float ss)const; float getSsSquareDistance(const float &ss)const;
friend ostream &operator<<(ostream &os, Measurement &m); friend ostream &operator<<(ostream &os, const Measurement &m);
}; };
#endif #endif

View File

@ -14,17 +14,17 @@ protected:
float z; float z;
public: public:
Point(float _x = 0, float _y = 0, float _z = 0) { x = _x; y = _y; z = _z; } ; Point(const float &_x = 0, const float &_y = 0, const float &_z = 0) { x = _x; y = _y; z = _z; } ;
Point(const Point &p) { x = p.x; y = p.y; z = p.z; } ; Point(const Point &p) { x = p.x; y = p.y; z = p.z; } ;
~Point() {}; ~Point() {};
float getX()const { return x; }; float getX()const { return x; };
float getY()const { return y; }; float getY()const { return y; };
float getZ()const { return z; }; float getZ()const { return z; };
void setX(float my_x) { x = my_x; }; void setX(const float &_x) { x = _x; };
void setY(float my_y) { y = my_y; }; void setY(const float &_y) { y = _y; };
void setZ(float my_z) { z = my_z; }; void setZ(const float &_z) { z = _z; };
float squareDistance(const Point &p)const { return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)); }; float squareDistance(const Point &p)const { return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)); };
float squareDistance(float mx, float my, float mz)const { return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)); }; float squareDistance(const float &mx, const float &my, const float &mz)const { return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)); };
float distance(const Point &p)const { return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z))); }; float distance(const Point &p)const { return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z))); };
Point operator=(const Point &p); Point operator=(const Point &p);
bool operator==(const Point &p)const; bool operator==(const Point &p)const;

View File

@ -1,12 +1,12 @@
#include "referencepoint.hh" #include "referencepoint.hh"
float ReferencePoint::getSsSquareDistance(vector<Measurement> m)const float ReferencePoint::getSsSquareDistance(const vector<Measurement> &m)const
{ {
unsigned int i, j; unsigned int i, j;
float ret = 0; float ret = 0;
bool found; bool found;
for(i=0;i<m.size();i++) for (i = 0 ; i < m.size() ; i++)
{ {
j = 0; j = 0;
found = false; found = false;
@ -20,16 +20,17 @@ float ReferencePoint::getSsSquareDistance(vector<Measurement> m)const
j++; j++;
} }
} }
return ret; return ret;
} }
void ReferencePoint::addMeasurement(string mac_a, int value) void ReferencePoint::addMeasurement(const string &mac_a, const int &value)
{ {
unsigned int i; unsigned int i;
Measurement m; Measurement m;
bool inserted = false; bool inserted = false;
for(i=0;i<measurement_list.size();i++) for (i = 0 ; i < measurement_list.size() ; i++)
if(measurement_list[i].getMacAddr() == mac_a) if(measurement_list[i].getMacAddr() == mac_a)
{ {
measurement_list[i].addSsValue(value); measurement_list[i].addSsValue(value);
@ -62,17 +63,17 @@ ostream &operator<<(ostream &os, ReferencePoint &rp)
if(rp.measurement_list.size() == 0) if(rp.measurement_list.size() == 0)
os << "No measurements" << endl; os << "No measurements" << endl;
else else
for(i=0;i<rp.measurement_list.size();i++) for (i = 0 ; i < rp.measurement_list.size() ; i++)
os << rp.measurement_list[i] << endl; os << rp.measurement_list[i] << endl;
return os; return os;
} }
bool ReferencePoint::getPowerForAp(string ap_mac, float * p)const bool ReferencePoint::getPowerForAp(const string &ap_mac, float *p)const
{ {
unsigned int i; unsigned int i;
for(i=0;i<measurement_list.size();i++) for (i = 0 ; i < measurement_list.size() ; i++)
if(measurement_list[i].getMacAddr() == ap_mac) if(measurement_list[i].getMacAddr() == ap_mac)
{ {
*p = measurement_list[i].getAverage(); *p = measurement_list[i].getAverage();

View File

@ -15,18 +15,18 @@ protected:
vector<Measurement> measurement_list; vector<Measurement> measurement_list;
public: public:
ReferencePoint(float x = 0, float y = 0, float z = 0) { coordinates.setX(x); coordinates.setY(y); coordinates.setZ(z); }; ReferencePoint(const float &x = 0, const float &y = 0, const float &z = 0) { coordinates.setX(x); coordinates.setY(y); coordinates.setZ(z); };
ReferencePoint(const ReferencePoint &rp) { coordinates = rp.coordinates; measurement_list = rp.measurement_list; }; ReferencePoint(const ReferencePoint &rp) { coordinates = rp.coordinates; measurement_list = rp.measurement_list; };
ReferencePoint(Point c) { coordinates = c; }; ReferencePoint(const Point &c) { coordinates = c; };
~ReferencePoint() { measurement_list.clear(); }; ~ReferencePoint() { measurement_list.clear(); };
float getSsSquareDistance(vector<Measurement> m)const; float getSsSquareDistance(const vector<Measurement> &m)const;
Point getCoordinates()const { return coordinates; }; Point getCoordinates()const { return coordinates; };
void addMeasurement(string mac_a, int value); void addMeasurement(const string &mac_a, const int &value);
void setCoordinates(Point p) { coordinates = p; }; void setCoordinates(const Point &p) { coordinates = p; };
ReferencePoint operator=(const ReferencePoint &rp); ReferencePoint operator=(const ReferencePoint &rp);
friend ostream &operator<<(ostream &os, ReferencePoint &rp); friend ostream &operator<<(ostream &os, ReferencePoint &rp);
vector<Measurement> getMeasurementList()const { return measurement_list; }; vector<Measurement> getMeasurementList()const { return measurement_list; };
bool getPowerForAp(string ap_mac, float * p)const; bool getPowerForAp(const string &ap_mac, float *p)const;
}; };
#endif #endif

View File

@ -1,9 +1,18 @@
#include "server.hh" #include "server.hh"
/* Misc. very usefull functions */ #define TEST
#define DEBUG // Décommenter pour avoir de l'affichage en plus.
//#define DEBUG_2 // Décommenter pour avoir encore plus d'affichage.
/******* Misc. very usefull functions *******/
/* Explodes a string into substrings based on separator sep. Returns a string vector. */ /* Explodes a string into substrings based on separator sep. Returns a string vector. */
inline vector<string> explode(string input, char sep) inline vector<string> explode(const string &input, const char &sep)
{ {
vector<string> vs; vector<string> vs;
string tmp; string tmp;
@ -27,8 +36,10 @@ inline vector<string> explode(string input, char sep)
return vs; return vs;
} }
/* Function to convert a string to an integer */ /* Function to convert a string to an integer */
inline int string2int(string nb) inline int string2int(const string &nb)
{ {
istringstream iss(nb); istringstream iss(nb);
@ -37,8 +48,10 @@ inline int string2int(string nb)
return tmp; return tmp;
} }
/* Function to convert a string to an unsigned integer */ /* Function to convert a string to an unsigned integer */
inline unsigned int string2uint(string nb) inline unsigned int string2uint(const string &nb)
{ {
istringstream iss(nb); istringstream iss(nb);
@ -47,8 +60,10 @@ inline unsigned int string2uint(string nb)
return tmp; return tmp;
} }
/* Function to convert a string to a float */ /* Function to convert a string to a float */
inline float string2float(string nb) inline float string2float(const string &nb)
{ {
istringstream iss(nb); istringstream iss(nb);
@ -57,6 +72,8 @@ inline float string2float(string nb)
return tmp; return tmp;
} }
/* Function extracts ints from string */ /* Function extracts ints from string */
inline vector<int> extractValues(string buff) inline vector<int> extractValues(string buff)
{ {
@ -81,7 +98,9 @@ inline vector<int> extractValues(string buff)
return ret; return ret;
} }
inline vector<string> extractReferencePointInfoFromBuffer(string buffer_in)
inline vector<string> extractReferencePointInfoFromBuffer(const string &buffer_in)
{ {
unsigned int i = 0; unsigned int i = 0;
string tmp_field; string tmp_field;
@ -96,7 +115,7 @@ inline vector<string> extractReferencePointInfoFromBuffer(string buffer_in)
} }
ret.push_back(tmp_field); ret.push_back(tmp_field);
tmp_field.clear(); tmp_field.clear();
i++; //go after the ';' i++; // go after the ';'
/* y */ /* y */
while (buffer_in[i] != ';') while (buffer_in[i] != ';')
@ -108,6 +127,18 @@ inline vector<string> extractReferencePointInfoFromBuffer(string buffer_in)
tmp_field.clear(); tmp_field.clear();
i++; i++;
#ifndef FRED_CSV_FORMAT // Dans le format Fred, on n'a pas de coordonnée Z.
/* z */
while (buffer_in[i] != ';')
{
tmp_field.push_back(buffer_in[i]);
i++;
}
ret.push_back(tmp_field);
tmp_field.clear();
i++;
#endif
/* Extract direction (not used now) */ /* Extract direction (not used now) */
while (buffer_in[i] != ';') while (buffer_in[i] != ';')
{ {
@ -118,6 +149,7 @@ inline vector<string> extractReferencePointInfoFromBuffer(string buffer_in)
tmp_field.clear(); tmp_field.clear();
i++; i++;
#ifdef FRED_CSV_FORMAT
/* Extract mac address */ /* Extract mac address */
while (buffer_in[i] != ';') while (buffer_in[i] != ';')
{ {
@ -136,15 +168,36 @@ inline vector<string> extractReferencePointInfoFromBuffer(string buffer_in)
} }
ret.push_back(tmp_field); ret.push_back(tmp_field);
tmp_field.clear(); tmp_field.clear();
#else
while (i <= buffer_in.size())
{
if ((buffer_in[i] == ';' || i == buffer_in.size()) && !tmp_field.empty()) // Si on est sur un séparateur et que la valeur lue n'est pas vide,
{
#ifdef DEBUG_2
cout << "Ajout de la valeur lue : " << tmp_field << endl ;
#endif
ret.push_back(tmp_field) ; // on met la valeur lue dans les valeurs de retour.
tmp_field.clear() ;
}
else // Si on n'est pas sur un séparateur,
tmp_field.push_back(buffer_in[i]) ; // on ajoute le caractère courant à la suite de la valeur lue.
i++ ;
}
#endif
/* Return the vector with each data */ /* Return the vector with each data */
return ret; return ret;
} }
/* ***************************************************************** */ /* ***************************************************************** */
//Server::Server(string ip_addr, int listen_port, int send_port) // FIXME : paramètre send_port inutilisé //Server::Server(string ip_addr, int listen_port, int send_port) // FIXME : paramètre send_port inutilisé
Server::Server(string ip_addr, int listen_port) Server::Server(const string &ip_addr, const int &listen_port)
{ {
/* Open socket */ /* Open socket */
sockListen = socket(PF_INET, SOCK_DGRAM, 0); sockListen = socket(PF_INET, SOCK_DGRAM, 0);
@ -158,8 +211,13 @@ Server::Server(string ip_addr, int listen_port)
/* Bind */ /* Bind */
bind(sockListen, (struct sockaddr *)&server_addr, sizeof(server_addr)); bind(sockListen, (struct sockaddr *)&server_addr, sizeof(server_addr));
makeReferencePointListFromFile(DEFAULT_REF_POINT_FILE);
makeApListFromFile(DEFAULT_AP_FILE);
} }
Server::~Server() Server::~Server()
{ {
client_list.clear(); client_list.clear();
@ -169,18 +227,24 @@ Server::~Server()
close(sockSend); close(sockSend);
} }
void Server::send_to_client(int cl)
void Server::send_to_client(const int &cl)
{ {
/* Do not forget to implement later: usefull for a demo */ /* Do not forget to implement later: usefull for a demo */
} }
int Server::receive_data() int Server::receive_data()
{ {
/* Do not forget to implement later: usefull for a demo */ /* Do not forget to implement later: usefull for a demo */
return 0; return 0;
} }
bool Server::pointExists(float x, float y, float z)const
bool Server::pointExists(const float &x, const float &y, const float &z)const
{ {
Point p(x, y, z); Point p(x, y, z);
unsigned int i; unsigned int i;
@ -192,8 +256,10 @@ bool Server::pointExists(float x, float y, float z)const
return false; return false;
} }
/* Do not forget to call pointExists() before this one */ /* Do not forget to call pointExists() before this one */
unsigned int Server::pointIndex(float x, float y, float z)const unsigned int Server::pointIndex(const float &x, const float &y, const float &z)const
{ {
Point p(x, y, z); Point p(x, y, z);
unsigned int i; unsigned int i;
@ -205,7 +271,9 @@ unsigned int Server::pointIndex(float x, float y, float z)const
return 0; // Should never happen return 0; // Should never happen
} }
bool Server::pointExists(Point p)const
bool Server::pointExists(const Point &p)const
{ {
unsigned int i; unsigned int i;
@ -216,7 +284,9 @@ bool Server::pointExists(Point p)const
return false; return false;
} }
bool Server::apExists(string ap_addr)const
bool Server::apExists(const string &ap_addr)const
{ {
unsigned int i; unsigned int i;
@ -227,7 +297,9 @@ bool Server::apExists(string ap_addr)const
return false; return false;
} }
unsigned int Server::apIndex(string ap_addr)const
unsigned int Server::apIndex(const string &ap_addr)const
{ {
unsigned int i; unsigned int i;
@ -238,8 +310,10 @@ unsigned int Server::apIndex(string ap_addr)const
return 0; // Should never happen return 0; // Should never happen
} }
/* Do not forget to call pointExists() before this one */ /* Do not forget to call pointExists() before this one */
unsigned int Server::pointIndex(Point p)const unsigned int Server::pointIndex(const Point &p)const
{ {
unsigned int i; unsigned int i;
@ -250,8 +324,23 @@ unsigned int Server::pointIndex(Point p)const
return 0; // Should never happen return 0; // Should never happen
} }
/* return -1 if point does not exist, which should never happen */
vector<Point> Server::getkClosestInSs(vector<Measurement> m, unsigned int k, bool ignore_point, Point point_ignored)const
/* Selects the "k" closest points from the measurement "m", in the SS space.
* Returns an empty vector if no points are found, which should never happen.
*/
vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsigned int &k)const
{
return getkClosestInSs(m, k, NULL) ;
}
/* Selects the "k" closest points from the measurement "m", in the SS space.
* If "point_ignored" is not NULL, the Point "*point_ignored" is ignored.
* Returns an empty vector if no points are found, which should never happen.
*/
vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{ {
unsigned int i, j, min_idx; unsigned int i, j, min_idx;
vector<float> distances_vector; vector<float> distances_vector;
@ -260,7 +349,7 @@ vector<Point> Server::getkClosestInSs(vector<Measurement> m, unsigned int k, boo
float tmp_distance = 0, dist_max = 10000000, tmp_min; float tmp_distance = 0, dist_max = 10000000, tmp_min;
for (i = 0 ; i < reference_point_list.size() ; i++) for (i = 0 ; i < reference_point_list.size() ; i++)
if (!ignore_point||(reference_point_list[i].getCoordinates() != point_ignored)) if (point_ignored == NULL || (reference_point_list[i].getCoordinates() != *point_ignored))
{ {
tmp_distance = reference_point_list[i].getSsSquareDistance(m); tmp_distance = reference_point_list[i].getSsSquareDistance(m);
/* if not k points, add it */ /* if not k points, add it */
@ -268,7 +357,7 @@ vector<Point> Server::getkClosestInSs(vector<Measurement> m, unsigned int k, boo
{ {
distances_vector.push_back(tmp_distance); distances_vector.push_back(tmp_distance);
points_vector.push_back(reference_point_list[i].getCoordinates()); points_vector.push_back(reference_point_list[i].getCoordinates());
dist_max = (dist_max > tmp_distance)?tmp_distance:dist_max; dist_max = (dist_max > tmp_distance) ? tmp_distance : dist_max;
} }
else else
{ {
@ -319,7 +408,18 @@ vector<Point> Server::getkClosestInSs(vector<Measurement> m, unsigned int k, boo
return points_vector; return points_vector;
} }
Point Server::getkWeightedInSs(vector<Measurement> m, unsigned int k, bool ignore_point, Point point_ignored)const
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k)const
{
return getkWeightedInSs(m, k, NULL) ;
}
/* If "point_ignored" is not NULL, the Point "*point_ignored" is ignored.
*/
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{ {
unsigned int i, j; unsigned int i, j;
vector<float> distances_vector; vector<float> distances_vector;
@ -329,7 +429,7 @@ Point Server::getkWeightedInSs(vector<Measurement> m, unsigned int k, bool ignor
float total = 0, x = 0, y = 0, z = 0; float total = 0, x = 0, y = 0, z = 0;
for (i = 0 ; i < reference_point_list.size() ; i++) for (i = 0 ; i < reference_point_list.size() ; i++)
if (!ignore_point || (reference_point_list[i].getCoordinates() != point_ignored)) if (point_ignored == NULL || (reference_point_list[i].getCoordinates() != *point_ignored))
{ {
tmp_distance = reference_point_list[i].getSsSquareDistance(m); tmp_distance = reference_point_list[i].getSsSquareDistance(m);
/* if not k points, add it */ /* if not k points, add it */
@ -376,7 +476,9 @@ Point Server::getkWeightedInSs(vector<Measurement> m, unsigned int k, bool ignor
return ret; return ret;
} }
Point Server::kPointsAverage(vector<Point> vp)const
Point Server::kPointsAverage(const vector<Point> &vp)const
{ {
unsigned int i; unsigned int i;
float x=0, y=0, z=0; float x=0, y=0, z=0;
@ -395,7 +497,9 @@ Point Server::kPointsAverage(vector<Point> vp)const
return p; return p;
} }
Point Server::fbcm(vector<Measurement> m, int client_idx)const
Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
{ {
Point ret(0, 0, 0); Point ret(0, 0, 0);
vector<string> addr; vector<string> addr;
@ -449,7 +553,9 @@ Point Server::fbcm(vector<Measurement> m, int client_idx)const
return ret; return ret;
} }
Point Server::interlink(vector<Measurement> m, int client_idx)const
Point Server::interlink(const vector<Measurement> &m, const int &client_idx)const
{ {
Point ret(0, 0, 0); Point ret(0, 0, 0);
vector<string> addr; vector<string> addr;
@ -498,58 +604,116 @@ Point Server::interlink(vector<Measurement> m, int client_idx)const
return ret; return ret;
} }
void Server::makeReferencePointListFromFile(string filename)
void Server::makeReferencePointListFromFile(const string &filename)
{ {
ifstream input_file; ifstream input_file;
char buffer[BUFFER_LENGTH]; char buffer[BUFFER_LENGTH];
string lecture_fichier; string lecture_fichier;
ReferencePoint rp; ReferencePoint rp;
Point tmp_point; Point tmp_point;
float x, y; float x, y, z ; // Coordonnées des points
unsigned int i, pt_idx; unsigned int i, pt_idx;
string cpp_buffer, tmp_mes; string cpp_buffer, tmp_mes;
vector<int> measures_vector;
vector<string> infos; vector<string> infos;
input_file.open(filename.c_str()) ; input_file.open(filename.c_str()) ;
if (input_file.fail()) if (input_file.fail())
{ {
cerr << "Error opening input file « " << filename << " » !" << endl ; cerr << "Error opening input file « " << filename << " » !" << endl ;
return ; return ;
} }
#ifdef DEBUG
cout << "Lecture du fichier « " << filename << " »..." ;
int nlines = 0 ;
int npoints = 0 ;
#endif
while (!input_file.eof()) while (!input_file.eof())
{ {
#ifdef DEBUG
if (nlines % 100 == 0)
printf("\n%5d", nlines) ;
cout << '.' ;
nlines++ ;
#endif
input_file.getline(buffer, BUFFER_LENGTH); input_file.getline(buffer, BUFFER_LENGTH);
if ((input_file.rdstate() & ifstream::eofbit) == 0) if ((input_file.rdstate() & ifstream::eofbit) == 0)
{ {
/* Extract fields */ /* Extract fields */
cpp_buffer = buffer; cpp_buffer = buffer;
if (cpp_buffer.size() == 0) // Ignorer une ligne vide
continue ;
infos = extractReferencePointInfoFromBuffer(cpp_buffer); infos = extractReferencePointInfoFromBuffer(cpp_buffer);
x = string2float(infos[0]); x = string2float(infos[0]);
y = string2float(infos[1]); y = string2float(infos[1]);
#ifdef FRED_CSV_FORMAT
z = DEFAULT_Z ;
#else
z = string2float(infos[2]) ;
#endif
/* Set point coordinates */ /* Set point coordinates */
tmp_point.setX(x); tmp_point.setX(x);
tmp_point.setY(y); tmp_point.setY(y);
tmp_point.setZ(DEFAULT_Z); tmp_point.setZ(z);
/* Use C++ string format */ /* Use C++ string format */
if (!pointExists(tmp_point)) if (!pointExists(tmp_point))
{ {
rp.setCoordinates(tmp_point); rp.setCoordinates(tmp_point);
reference_point_list.push_back(rp); reference_point_list.push_back(rp);
#ifdef DEBUG_2
npoints++ ;
cout << tmp_point << " : ajouté." << endl ;
}
else
{
cout << tmp_point << " : existe déjà." << endl ;
#endif
} }
pt_idx = pointIndex(tmp_point); pt_idx = pointIndex(tmp_point);
measures_vector = extractValues(infos[4]);
#ifdef FRED_CSV_FORMAT
vector<int> measures_vector = extractValues(infos[4]) ;
for (i = 0 ; i < measures_vector.size() ; i++) for (i = 0 ; i < measures_vector.size() ; i++)
reference_point_list[pt_idx].addMeasurement(infos[3], measures_vector[i]); reference_point_list[pt_idx].addMeasurement(infos[3], measures_vector[i]);
measures_vector.clear();
#else
for (i = 4 ; i < infos.size() ; i++)
{
#ifdef DEBUG_2
cout << "Lecture de la valeur : " << infos[i] << "... " ;
#endif
if (i + 1 < infos.size())
{
reference_point_list[pt_idx].addMeasurement(infos[i], string2int(infos[i+1])) ;
#ifdef DEBUG_2
cout << "Mesure ajoutée : AP = " << infos[i] << " | SS = " << string2int(infos[i+1]) << endl ;
#endif
i++ ;
}
}
#endif
} }
} }
#ifdef DEBUG
cout << '\n' << nlines << " lignes lues, " << npoints << " points différents ajoutés.\n" << endl ;
#endif
input_file.close(); input_file.close();
measures_vector.clear(); infos.clear() ;
} }
void Server::makeApListFromFile(string filename)
void Server::makeApListFromFile(const string &filename)
{ {
ifstream input_file; ifstream input_file;
char buffer[BUFFER_LENGTH]; char buffer[BUFFER_LENGTH];
@ -563,15 +727,25 @@ void Server::makeApListFromFile(string filename)
return ; return ;
} }
#ifdef DEBUG
cout << "Lecture du fichier « " << filename << " »..." << endl ;
#endif
while (!input_file.eof()) while (!input_file.eof())
{ {
input_file.getline(buffer, BUFFER_LENGTH); input_file.getline(buffer, BUFFER_LENGTH);
if ((input_file.rdstate() & ifstream::eofbit) == 0) if ((input_file.rdstate() & ifstream::eofbit) == 0)
{ {
/* Traitement basique des commentaires */
if (buffer[0] == '\0' // Ligne vide
|| buffer[0] == '#') // ou ligne commençant par #
continue ; // ignorer cette ligne.
ap_infos = explode(buffer, ';'); ap_infos = explode(buffer, ';');
cout << buffer << endl; #ifdef DEBUG
for (unsigned int i=0 ; i < ap_infos.size() ; i++) cout << "AP : " << buffer ;
cout << ap_infos[i] << endl; #endif
tmp_ap.setApAddr(ap_infos[0]); tmp_ap.setApAddr(ap_infos[0]);
tmp_ap.setCoordinates(string2float(ap_infos[1]), string2float(ap_infos[2]), string2float(ap_infos[3])); tmp_ap.setCoordinates(string2float(ap_infos[1]), string2float(ap_infos[2]), string2float(ap_infos[3]));
tmp_ap.setFrequency(string2uint(ap_infos[4])); tmp_ap.setFrequency(string2uint(ap_infos[4]));
@ -579,12 +753,22 @@ void Server::makeApListFromFile(string filename)
tmp_ap.setOutputPower(string2float(ap_infos[6])); tmp_ap.setOutputPower(string2float(ap_infos[6]));
access_point_list.push_back(tmp_ap); access_point_list.push_back(tmp_ap);
ap_infos.clear(); ap_infos.clear();
#ifdef DEBUG
cout << " ajouté." << endl ;
#endif
} }
} }
#ifdef DEBUG
cout << endl ;
#endif
input_file.close(); input_file.close();
} }
void Server::printReferencePointList() void Server::printReferencePointList()
{ {
unsigned int i; unsigned int i;
@ -593,6 +777,8 @@ void Server::printReferencePointList()
cout << reference_point_list[i] << endl; cout << reference_point_list[i] << endl;
} }
void Server::printAccessPointList() void Server::printAccessPointList()
{ {
unsigned int i; unsigned int i;
@ -601,6 +787,8 @@ void Server::printAccessPointList()
cout << access_point_list[i] << endl; cout << access_point_list[i] << endl;
} }
void Server::computeFriisFromRefList() void Server::computeFriisFromRefList()
{ {
unsigned int i, j; unsigned int i, j;
@ -641,47 +829,118 @@ void Server::computeFriisFromRefList()
} }
/* /*
* Function computes new cumulative distances for each running viterbi instance, * Computes new cumulative distances for each running viterbi instance,
* Returns the solution (type: Point) of the last ended viterbi. * Returns the solution (type: Point) of the last ended viterbi.
* Distances are grouped by line corresponding to an instance. * Distances are grouped by line corresponding to an instance.
* vk MUST be the same as last.size() and current.size() ! * "K" MUST be the same as last.size() and current.size() !
*/ */
/* void Server::fastViterbiLike(const unsigned short &N, const unsigned short &K, const unsigned int &id_client)
Point Server::viterbiLike(float ** dists, unsigned short vk, unsigned short vn, vector<Point> last, vector<Point> current)
{ {
unsigned int i, j, k; #ifdef TEST
float min; ClientInfo cl ;
vector<float> last_dists; float **V = cl.get_viterbi_V() ;
Point position; vector<Point>
&E_current = cl.getRef_viterbi_Ecurrent(),
// Compute the ending viterbi: line 0 &E_previous = cl.getRef_viterbi_Eprevious() ;
for (i = 0 ; i < current.size() ; i++) #else
float **V = client_list[id_client].get_viterbi_V() ;
vector<Point>
&E_current = client_list[id_client].getRef_viterbi_Ecurrent(),
&E_previous = client_list[id_client].getRef_viterbi_Eprevious() ;
#endif
int i = 1 ; // Nombre d'ensembles d'historique qu'on a déjà passés
if (N < 2)
{ {
min = dists[0][0] + last[0].distance(current[i]); cerr << "fastViterbiLike() : N ne peut être inférieur à 2 !" << endl ;
for (j = 1 ; j < last.size() ; j++) return ;
if ((dists[0][j] + last[j].distance(current[i])) < min)
min = dists[0][j] + last[j].distance(current[i]);
last_dists.push_back(min);
} }
// Find shortest dist #ifdef TEST
min = last_dists[0]; int pt = 0 ;
j = 0; #ifdef DEBUG
for (i = 1 ; i < last_dists.size() ; i++) cout << reference_point_list.size() << " points à traiter." << endl ;
if (last_dists[i] < min) #endif
{ while (pt < reference_point_list.size())
min = last_dists[i]; #else
j = i; while (true)
} #endif
{
vector<Measurement> vm ;
Point *ref_coords = NULL ; // Coordonnées de référence (à ignorer).
// Shortest distance determines the true point #ifdef TEST
position = current[j]; /* Get point measurements */
vm.clear();
vm = reference_point_list[pt].getMeasurementList();
// *ref_coords = reference_point_list[i].getCoordinates();
#endif
// Now, compute the remaining of the distance matrix E_previous = E_current ;
E_current = getkClosestInSs(vm, K, ref_coords) ; // Création de l'ensemble des K points les plus proches dans l'espace des puissances.
if (i > 1) // Si on n'est plus à la première itération
{
/* Recalcul des plus courtes distances */
for (int n = N-1-i ; n < N-2 ; n++) // Pour chaque historique existant (sauf le dernier),
for (int k = 0 ; k < K ; k++) // pour chaque point de l'historique,
{ // on met à jour le chemin minimum entre l'historique précédent et le point :
V[n][k] = V[n+1][0] + E_previous[0].distance(E_current[k]) ;
for (int l = 1 ; l < K ; l++)
{
float f = V[n+1][l] + E_previous[l].distance(E_current[k]) ;
if (f < V[n][k])
V[n][k] = f ;
}
}
/* Traitement du dernier historique */
for (int k = 0 ; k < K ; k++) // Pour chaque point,
{ // on récupère le chemin minimum entre l'historique précédent et le point :
V[N-2][k] = E_previous[0].distance(E_current[k]) ;
for (int l = 1 ; l < K ; l++)
{
float f = E_previous[l].distance(E_current[k]) ;
if (f < V[N-2][k])
V[N-2][k] = f ;
}
}
/* Choix du min à renvoyer */
if (N-1-i == 0)
{
float V0_min = V[0][0] ;
for (int k=1 ; k < K ; k++)
{
if (V[0][k] < V0_min)
V0_min = V[0][k] ;
cout << "V[0][" << k << "]=" << V[0][k] << " ; V0_min=" << V0_min << " -- " ;
}
cout << "V0_min = " << V0_min << endl ;
}
}
// cout << "(N=" << N << ") - 1 - (i=" << i << ") = " << N-1-i << endl ;
for (int n=0 ; n < N-1 ; n++)
{
for (int k=0 ; k < K ; k++)
cout << "[" << V[n][k] << "]" ;
cout << endl ;
}
cout << "\n--------------------------" << endl ;
if (i < N-1)
i++ ;
#ifdef TEST
pt++ ;
#endif
}
} }
*/
/* For experimentation purpose only */ /* For experimentation purpose only */
@ -693,9 +952,7 @@ void Server::radar_exp()
unsigned int i; unsigned int i;
vector<Measurement> vm; vector<Measurement> vm;
makeReferencePointListFromFile(DEFAULT_REF_POINT_FILE); // computeFriisFromRefList();
makeApListFromFile(DEFAULT_AP_FILE);
computeFriisFromRefList();
/* Open a log file */ /* Open a log file */
logfile.open(DEFAULT_LOGFILE); logfile.open(DEFAULT_LOGFILE);
@ -720,17 +977,17 @@ void Server::radar_exp()
logfile << ref_coords << "\t"; logfile << ref_coords << "\t";
/* From 2 to 5 K-weighted-SS */ /* From 2 to 5 K-weighted-SS */
solution = getkWeightedInSs(vm, 2, true, ref_coords); solution = getkWeightedInSs(vm, 2, &ref_coords);
logfile << solution << "\t" << solution.distance(ref_coords) << "\t"; logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
solution = getkWeightedInSs(vm, 3, true, ref_coords); solution = getkWeightedInSs(vm, 3, &ref_coords);
logfile << solution << "\t" << solution.distance(ref_coords) << "\t"; logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
solution = getkWeightedInSs(vm, 4, true, ref_coords); solution = getkWeightedInSs(vm, 4, &ref_coords);
logfile << solution << "\t" << solution.distance(ref_coords) << "\t"; logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
solution = getkWeightedInSs(vm, 5, true, ref_coords); solution = getkWeightedInSs(vm, 5, &ref_coords);
logfile << solution << "\t" << solution.distance(ref_coords) << "\t"; logfile << solution << "\t" << solution.distance(ref_coords) << "\t";
/* Nearest in SS */ /* Nearest in SS */
solutions = getkClosestInSs(vm, 1, true, ref_coords); solutions = getkClosestInSs(vm, 1, &ref_coords);
logfile << solutions[0] << "\t" << solutions[0].distance(ref_coords) << "\t"; logfile << solutions[0] << "\t" << solutions[0].distance(ref_coords) << "\t";
/* Interlink Networks */ /* Interlink Networks */

View File

@ -22,9 +22,10 @@
using namespace std; using namespace std;
using std::string; using std::string;
#define DEFAULT_LOGFILE "log/radar_exp.csv" #define DEFAULT_LOGFILE "log/radar_exp.csv" // Fichier de sortie
#define DEFAULT_REF_POINT_FILE "csv/complete-scan.csv" #define DEFAULT_REF_POINT_FILE "csv/agreg/toutes.csv" // Fichier des points de référence
#define DEFAULT_AP_FILE "cfg/accesspoints.cfg" #define DEFAULT_AP_FILE "cfg/minipc.cfg" // Fichier de configuration des AP
#define DEFAULT_TRACKING_FILE "csv/agreg/divagation.csv" // Fichier de prérégrination
#define DEFAULT_IP "127.0.0.1" #define DEFAULT_IP "127.0.0.1"
#define DEFAULT_LISTEN_PORT 7777 #define DEFAULT_LISTEN_PORT 7777
#define LIGHT_SPEED 300000000 #define LIGHT_SPEED 300000000
@ -33,9 +34,10 @@ using std::string;
#define MINMAX_Y_START -1 #define MINMAX_Y_START -1
#define MINMAX_X_STOP 15 #define MINMAX_X_STOP 15
#define MINMAX_Y_STOP 45 #define MINMAX_Y_STOP 45
#define BUFFER_LENGTH 1024 #define BUFFER_LENGTH 5000
#define DEFAULT_Z 3 //#define DEFAULT_Z 3 // Décommenter pour utiliser des fichiers d'entrée avec des coordonnées dans un seul plan (X, Y).
#define DEFAULT_VITERBI_K 5 //#define FRED_CSV_FORMAT // Décommenter pour utiliser les fichiers CSV au « format Fred » (plusieurs lignes par mesure, avec un AP par ligne).
class Server class Server
{ {
@ -48,32 +50,33 @@ protected:
int sockSend; int sockSend;
public: public:
//Server(string ip_addr = DEFAULT_IP, int listen_port = DEFAULT_LISTEN_PORT, int send_port); Server(const string &ip_addr = DEFAULT_IP, const int &listen_port = DEFAULT_LISTEN_PORT);
Server(string ip_addr = DEFAULT_IP, int listen_port = DEFAULT_LISTEN_PORT);
~Server(); ~Server();
void send_to_client(int cl); void send_to_client(const int &cl);
int receive_data(); int receive_data();
bool pointExists(float x, float y, float z)const; bool pointExists(const float &x, const float &y, const float &z)const;
unsigned int pointIndex(float x, float y, float z)const; unsigned int pointIndex(const float &x, const float &y, const float &z)const;
bool pointExists(Point p)const; bool pointExists(const Point &p)const;
bool apExists(string ap_addr)const; bool apExists(const string &ap_addr)const;
unsigned int apIndex(string ap_addr)const; unsigned int apIndex(const string &ap_addr)const;
unsigned int pointIndex(Point p)const; unsigned int pointIndex(const Point &p)const;
vector<Point> getkClosestInSs(vector<Measurement> m, unsigned int k, bool ignore_point, Point point_ignored)const; vector<Point> getkClosestInSs(const vector<Measurement> &m, const unsigned int &k)const ;
Point getkWeightedInSs(vector<Measurement> m, unsigned int k, bool ignore_point, Point point_ignored)const; vector<Point> getkClosestInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const ;
Point kPointsAverage(vector<Point> vp)const; Point getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k)const ;
Point fbcm(vector<Measurement> m, int client_idx)const; Point getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const ;
Point interlink(vector<Measurement> m, int client_idx)const; Point kPointsAverage(const vector<Point> &vp)const;
void makeReferencePointListFromFile(string filename); Point fbcm(const vector<Measurement> &m, const int &client_idx)const;
void makeApListFromFile(string filename); Point interlink(const vector<Measurement> &m, const int &client_idx)const;
void makeReferencePointListFromFile(const string &filename);
void makeApListFromFile(const string &filename);
void printReferencePointList(); void printReferencePointList();
void printAccessPointList(); void printAccessPointList();
void computeFriisFromRefList(); void computeFriisFromRefList();
unsigned int getNbReferencePoints()const { return reference_point_list.size(); }; unsigned int getNbReferencePoints()const { return reference_point_list.size(); };
/* For experimentation purpose only ! */ /* For experimentation purpose only ! */
void radar_exp(); void radar_exp();
/* For compilation purpose :-) */
// Point viterbiLike(float**, short unsigned int, short unsigned int, std::vector<Point, std::allocator<Point> >, std::vector<Point, std::allocator<Point> >) ; void fastViterbiLike(const unsigned short &N, const unsigned short &K, const unsigned int &id_client) ;
}; };
#endif #endif

View File

@ -11,7 +11,6 @@
using namespace std; using namespace std;
using std::string; using std::string;
#define BUFFER_LENGTH 1024
int main(int argc, char ** argv) int main(int argc, char ** argv)
{ {
@ -19,7 +18,8 @@ int main(int argc, char ** argv)
string read_file; string read_file;
Server my_server; Server my_server;
my_server.radar_exp(); // my_server.radar_exp();
my_server.fastViterbiLike(VITERBI_N, VITERBI_K, 0) ;
return 0; return 0;
} }