diff --git a/malva/environment b/malva/environment index 2f1eaac4b96681353f069b364a8f74392322a47e..fecad06feb28400820808414edec463c0d0aaf73 100644 --- a/malva/environment +++ b/malva/environment @@ -1,9 +1,8 @@ # Malva Configuration. -MALLBA_DIR=/ens/home01/g/gonzalo.menendez/malva +MALLBA_DIR=/ens/home01/l/lucas.bruzzone/AEPractico/malva # MPI library MPI_BIN=/lib64/mpich/bin - # Malva information MALLBA_INC=${MALLBA_DIR}/src MALLBA_LIB=${MALLBA_DIR}/lib diff --git a/malva/lib/libmallba.a b/malva/lib/libmallba.a index aa8b8d0e65e3c1868112f58ce9febe2f4d2c22e2..caca61bfac3b2578381e72a4e29daf4a541a0b2c 100644 Binary files a/malva/lib/libmallba.a and b/malva/lib/libmallba.a differ diff --git a/malva/rep/GA/MainLan b/malva/rep/GA/MainLan index 9139cd2135314533f6f792eebc342021aadf23e2..3c264da8176cea8ef985745f1886486fdf6ec58e 100755 Binary files a/malva/rep/GA/MainLan and b/malva/rep/GA/MainLan differ diff --git a/malva/rep/GA/MainLan.o b/malva/rep/GA/MainLan.o index ee952ae0bb50003219493132a90713e762dcd0ae..9385dd20caa64bf3c0a87783a4225bf3b2e79568 100644 Binary files a/malva/rep/GA/MainLan.o and b/malva/rep/GA/MainLan.o differ diff --git a/malva/rep/GA/MainSeq b/malva/rep/GA/MainSeq index 8504b21eb5d13bbbcdcb7e5ff175033ebd031fbc..fb205232104f6ea6d779d642900ef7cf2bfe4b27 100755 Binary files a/malva/rep/GA/MainSeq and b/malva/rep/GA/MainSeq differ diff --git a/malva/rep/GA/MainSeq.o b/malva/rep/GA/MainSeq.o index 7344717638c4bf3e0c1fef3a3f99d7e0e34819fc..155133b817cf52480267b552dd709539a640c87c 100644 Binary files a/malva/rep/GA/MainSeq.o and b/malva/rep/GA/MainSeq.o differ diff --git a/malva/rep/GA/datos_cantidad_empleados b/malva/rep/GA/datos_cantidad_empleados new file mode 100644 index 0000000000000000000000000000000000000000..7813681f5b41c028345ca62a2be376bae70b7f61 --- /dev/null +++ b/malva/rep/GA/datos_cantidad_empleados @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/malva/rep/GA/datos_cantidad_tareas b/malva/rep/GA/datos_cantidad_tareas new file mode 100644 index 0000000000000000000000000000000000000000..301160a93062df23030a69f4b5e4d9bf71866ee9 --- /dev/null +++ b/malva/rep/GA/datos_cantidad_tareas @@ -0,0 +1 @@ +8 \ No newline at end of file diff --git a/malva/rep/GA/datos_empleados b/malva/rep/GA/datos_empleados new file mode 100644 index 0000000000000000000000000000000000000000..31d0f2b3083101b6300fe88f3df853f0c7bf5d80 --- /dev/null +++ b/malva/rep/GA/datos_empleados @@ -0,0 +1,4 @@ +e1 e2 e3 e4 e5 +10 7 1 6 10 +0.47 0.49 0.67 0.08 0.23 +1827 1288 207 839 1563 \ No newline at end of file diff --git a/malva/rep/GA/datos_tareas b/malva/rep/GA/datos_tareas new file mode 100644 index 0000000000000000000000000000000000000000..73250e0ac45ee5ff4c5fba725c03bd1fccf7ef0e --- /dev/null +++ b/malva/rep/GA/datos_tareas @@ -0,0 +1,3 @@ +49 +t1 t2 t3 t4 t5 t6 t7 t8 +59 29 183 88 200 176 18 150 \ No newline at end of file diff --git a/malva/rep/GA/newGA.req.cc b/malva/rep/GA/newGA.req.cc index 20168e31103be644d371db55df3753bdfd479d14..c65fa03efb15e5504eac45513eca88d244eb87fa 100644 --- a/malva/rep/GA/newGA.req.cc +++ b/malva/rep/GA/newGA.req.cc @@ -3,6 +3,7 @@ #include "newGA.hh" #include <math.h> #include <sstream> + skeleton newGA { @@ -29,17 +30,19 @@ skeleton newGA */ string line; - ifstream cantTareasFile ("datos_cantidad_tareas.txt"); + ifstream cantTareasFile ("datos_cantidad_tareas"); getline(cantTareasFile, line); pbm._dimension = stoi(line); + cout << pbm._dimension << endl; //string line; - ifstream cantEmpleadosFile ("datos_cantidad_empleados.txt"); + ifstream cantEmpleadosFile ("datos_cantidad_empleados"); getline(cantEmpleadosFile, line); pbm._cantEmpleados = stoi(line); + cout << pbm._cantEmpleados << endl; string line23; - ifstream datosEmpleadosFile ("datos_empleados.txt"); + ifstream datosEmpleadosFile ("datos_empleados"); getline(datosEmpleadosFile, line23); getline(datosEmpleadosFile, line23); int i1; @@ -80,7 +83,7 @@ skeleton newGA } //string line; - ifstream datosTareasFile ("datos_tareas.txt"); + ifstream datosTareasFile ("datos_tareas"); getline(datosTareasFile, line); pbm._cantDias = stoi(line); getline(datosTareasFile, line); diff --git a/malva/rep/GA/newGA.req.o b/malva/rep/GA/newGA.req.o index d2797fd78a9bc1c6caecd830ed0d2a68aaab135a..4f82e569fc1e56f70197a1983c5ad02662110b10 100644 Binary files a/malva/rep/GA/newGA.req.o and b/malva/rep/GA/newGA.req.o differ diff --git a/malva/rep/GA/res/sol.txt b/malva/rep/GA/res/sol.txt new file mode 100644 index 0000000000000000000000000000000000000000..1687ecab0c103fa5a7cf6e29a4f5e75aec744d66 --- /dev/null +++ b/malva/rep/GA/res/sol.txt @@ -0,0 +1,16 @@ + +--------------------------------------------------------------- + STATISTICS OF TRIALS +------------------------------------------------------------------ + +1 10 1 160 1 260 260 +2 10 1 360 3 610 610 +3 10 2 260 2 451 451 +4 10 1 160 1 250 250 +5 10 2 360 3 645 645 +6 10 1 360 3 679 679 +7 10 2 360 3 672 672 +8 10 2 360 3 636 636 +9 10 1 360 3 693 693 +10 10 0 460 4 824 824 +------------------------------------------------------------------ diff --git a/malva/rep/GA/verificador.py b/malva/rep/GA/verificador.py new file mode 100644 index 0000000000000000000000000000000000000000..0924a327b9ff14cc512ce6195fef79c66afcd093 --- /dev/null +++ b/malva/rep/GA/verificador.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys +import random +import math + +try: + #Sanity check + if (len(sys.argv)<4): + print "Ejecutar con la siguiente linea: ./validador <ruta_tareas> <ruta_empleados> <ruta_solucion>" + sys.exit(1) + + ruta_tareas=sys.argv[1] + ruta_empleados=sys.argv[2] + ruta_solucion=sys.argv[3] + habilidad_empleados=[] + sueldo_diario_empleado=[] + dedicacion_diaria_diponible_empleado=[] + esfuerzo_requerido_tarea=[] + nombres_tareas=[] + nombre_empleados=[] + costo_proyecto=0 + tiempo_solucion_proyecto=0 + + # se sabe que son 3 lineas + archivo_tareas=open(ruta_tareas) + lineasTareas=archivo_tareas.readlines() + deadLine=lineasTareas[0] + nombres_tareas=lineasTareas[1].strip().split(" ") + esfuerzo_requerido_tarea=lineasTareas[2].strip().split(" ") + + # se sabe que son 4 lineas + archivo_empleados=open(ruta_empleados) + lineasEmpleados=archivo_empleados.readlines() + nombre_empleados=lineasEmpleados[0].strip().split(" ") + dedicacion_diaria_diponible_empleado=lineasEmpleados[1].strip().split(" ") + habilidad_empleados=lineasEmpleados[2].strip().split(" ") + sueldo_diario_empleado=lineasEmpleados[3].strip().split(" ") + + # se convierten a entero + dedicacion_diaria_diponible_empleado = map(int, dedicacion_diaria_diponible_empleado) + sueldo_diario_empleado = map(int, sueldo_diario_empleado) + deadLine=int(deadLine) + esfuerzo_requerido_tarea = map(int, esfuerzo_requerido_tarea) + + # se convierte a float + habilidad_empleados = map(float, habilidad_empleados) + + # se levanta la solucion del archivo + matriz_solucion=[] + + archivo_solucion=open(ruta_solucion) + + solucion_empleados_tareas=[] + solucion_empleados=[] + solucion_tareas=[] + + for line in archivo_solucion.readlines(): + empleados_tareas=line.strip().split(" ") + if( not (empleados_tareas[0] in nombre_empleados)): + print "No existe en la instancia el empleado: " + empleados_tareas[0] + sys.exit(1) + solucion_empleados.append(empleados_tareas[0]) + for i in range(1,len(empleados_tareas)): + if( not (empleados_tareas[i] in nombres_tareas)): + print "No existe en la instancia la terea: " + empleados_tareas[i] + sys.exit(1) + solucion_tareas.append(empleados_tareas[i]) + + + for i in range(0,len(solucion_empleados)): + for j in range(i+1,len(solucion_empleados)): + if(solucion_empleados[i]==solucion_empleados[j]): + print "Empleado repetido: " + solucion_empleados[i] + sys.exit(1) + + for i in range(0,len(solucion_tareas)): + for j in range(i+1,len(solucion_tareas)): + if(solucion_tareas[i]==solucion_tareas[j]): + print "Tarea asignada más de una vez: " + solucion_tareas[i] + sys.exit(1) + + + # todas las tareas asignadas + if(len(solucion_tareas)!=len(nombres_tareas)): + print "La cantidad de tareas asignadas es distinta a la cantidad de tareas de la instancia." + sys.exit(1) + + for i in range(0,len(nombres_tareas)): + if( not (nombres_tareas[i] in solucion_tareas)): + print "Tarea no asignada " + nombres_tareas[i] + sys.exit(1) + + costo_total=0 + archivo_solucion=open(ruta_solucion) + maximo_tiempo=0 + tiempo_en_dias=0 + # se hacen los calculos con la informacion en los archivos + for line in archivo_solucion.readlines(): + empleados_tareas=line.strip().split(" ") + indice_empleado = nombre_empleados.index(empleados_tareas[0]) + tiempo_en_horas=0 + for i in range(1,len(empleados_tareas)): + indice_tarea = nombres_tareas.index(empleados_tareas[i]) + tiempo_en_horas=tiempo_en_horas+(esfuerzo_requerido_tarea[indice_tarea] / (0.5 + habilidad_empleados[indice_empleado])) + tiempo_en_dias= int(math.ceil(tiempo_en_horas/dedicacion_diaria_diponible_empleado[indice_empleado])) + costo_total=costo_total+sueldo_diario_empleado[indice_empleado]*tiempo_en_dias + if(tiempo_en_dias>maximo_tiempo): + maximo_tiempo=tiempo_en_dias + + if(maximo_tiempo<=deadLine): + # todo OK! + print costo_total,maximo_tiempo + else: + print "No cumple con el tiempo máximo de finalización ({0} > {1}).".format(maximo_tiempo, deadLine) + sys.exit(1) + +except IOError as error: + print error