-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
64 lines (53 loc) · 2.04 KB
/
Copy pathMain.cpp
File metadata and controls
64 lines (53 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <fstream>
#include <cstring>
#include <bits/stdc++.h>
#include "GeneradorSoluciones.h"
#include <chrono>
using namespace std;
using std::chrono::high_resolution_clock;
using std::chrono::duration_cast;
using std::chrono::duration;
using std::chrono::milliseconds;
int Variable::id_actual = 1;
int Vehiculo::id_actual = 1;
int main() {
string nombreArchivo = "";
double tiempoEjecucion = 0.0;
for(int i=1;i<=2;i++){
for(int j=1;j<=20;j++){
nombreArchivo = "";
if(j<10){
nombreArchivo = "AB"+to_string(i)+"0"+to_string(j);
}
else{
nombreArchivo = "AB"+to_string(i)+to_string(j);
}
Instancia inst = Instancia();
Nodo depot = Nodo();
ListaNodos nodos = ListaNodos();
ListaNodos estaciones = ListaNodos();
ListaNodos clientes = ListaNodos();
inst = extraerArchivo(&nodos,nombreArchivo);
depot = nodos.getNodo(0);
for(int i=0;i<inst.numEstaciones;i++){
estaciones.append(nodos.getNodo(i+1));
}
for(int i=0;i<inst.numClientes;i++){
clientes.append(nodos.getNodo(i+inst.numEstaciones+1));
}
//time(&start);
auto t1 = high_resolution_clock::now();
ListaVehiculos vehiculos = generarSoluciones(4000,inst,clientes,estaciones,depot);
auto t2 = high_resolution_clock::now();
auto ms_int = duration_cast<milliseconds>(t2 - t1);
duration<double, std::milli> ms_double = t2 - t1;
//cout<<"-----SOLUCION FINAL-----\n";
//vehiculos.mostrar();
cout<<"Procesada instancia "<<nombreArchivo<<"\n";
tiempoEjecucion = ms_double.count()/1000;
generarOutput(vehiculos,nombreArchivo,&inst,tiempoEjecucion);
}
}
return 0;
}