Commit aaa9f4b8 authored by Maxime POULAIN's avatar Maxime POULAIN
Browse files

add performance test

parent 6c8ee1f6
......@@ -11,23 +11,49 @@
#include "utils.h"
#include <iostream>
#include <vector>
#include <chrono>
void testPerf(void) {
using namespace std;
graph_t graph;
char filename[128];
solution_t solution;
for (int i = 1; i < 21; i++)
{
solution.cost = INT_FAST16_MAX;
sprintf_s(filename, "la%02d.txt", i);
graph = gestionGraph::lecture_fichier(filename);
auto t_start = std::chrono::high_resolution_clock::now();
solution::grasp(&solution, graph);
auto t_end = std::chrono::high_resolution_clock::now();
double elapsed_time_ms = std::chrono::duration<double, std::milli>(t_end - t_start).count();
cout << filename << " : " << solution.cost << " in " << elapsed_time_ms << " ms" << endl;
}
}
void test10Seq(void) {
using namespace std;
graph_t graph;
graph = gestionGraph::lecture_fichier("la01.txt");
graph = gestionGraph::lecture_fichier("cours.txt");
solution_t sol;
bierwirth_t v[30];
bierwirth_t v[10];
for (int i = 0; i < 30; i++)
for (int i = 0; i < 10; i++)
{
v[i]=bierwirthManager::generateVector(graph.nb_pieces, graph.nb_machines);
cout << to_string(i) << " : " << solution::evaluer(v[i], graph).cost << " -> " << solution::rechercheLocale(v[i], graph, 1000).cost << endl;
v[i] = bierwirthManager::generateVector(graph.nb_pieces, graph.nb_machines);
auto solution = solution::evaluer(v[i], graph);
auto opti = solution::rechercheLocale(v[i], graph, 1000);
cout << to_string(i) << " : " << solution.cost << " -> " << opti.cost << endl;
}
string in;
cin >> in;
}
......@@ -36,10 +62,11 @@ void test10Seq(void) {
int main() {
srand(2145);
test10Seq();
srand(100145);
//test10Seq();
testPerf();
MainForm form;
form.ShowDialog();
//MainForm form;
//form.ShowDialog();
return 0;
}
\ No newline at end of file
No preview for this file type
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment