initial commit
This commit is contained in:
34
test_cost.cpp
Executable file
34
test_cost.cpp
Executable file
@@ -0,0 +1,34 @@
|
||||
#include<vector>
|
||||
#include<stdlib.h>
|
||||
#include<time.h>
|
||||
#include<iostream>
|
||||
#include "costfunctions.h"
|
||||
|
||||
int main(){
|
||||
srand(time(0));
|
||||
std::vector<std::vector<double>> Exp, Mod;
|
||||
double x=0,y=0,delta=0;
|
||||
for(int i=0;i<20;i++){
|
||||
x = 10.*rand()/(RAND_MAX + 1.);
|
||||
y = 2.*x+4.;
|
||||
delta = 0.2*(2.*rand()/(RAND_MAX+1.)-1.);
|
||||
Exp.push_back({x,y});
|
||||
Mod.push_back({x,y+delta});
|
||||
//std::cout << "Exp : " << Exp[i][1] << " ; Mod : " << Mod[i][1] << std::endl;
|
||||
}
|
||||
Khi2 poids1(Exp,Mod);
|
||||
//std::cout << poids1.get() << std::endl;
|
||||
|
||||
std::vector<std::vector<double>> Villes;
|
||||
std::vector<int> Ordre;
|
||||
for(int i=0;i<20;i++){
|
||||
x = 10.*rand()/(RAND_MAX + 1.);
|
||||
y = 10.*rand()/(RAND_MAX + 1.);
|
||||
Villes.push_back({x,y});
|
||||
Ordre.push_back(i);
|
||||
}
|
||||
Distance poids2(Villes,Ordre);
|
||||
std::cout << poids2.get() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user