From b84975e11b70045c2eaa9e1981da1478513bf51f Mon Sep 17 00:00:00 2001 From: Dayana31 <70593166+Dayana31@users.noreply.github.com> Date: Mon, 11 Apr 2022 01:55:25 -0500 Subject: Clases para algoritmo en Java --- VRP/src/Algoritmo/Almacen.java | 24 +++++++++++++++ VRP/src/Algoritmo/Ciudad.java | 18 +++++++++++ VRP/src/Algoritmo/Main.java | 15 +++++++++ VRP/src/Algoritmo/PlanTransporte.java | 14 +++++++++ VRP/src/Algoritmo/TipoAlmacen.java | 15 +++++++++ VRP/src/Algoritmo/Tramo.java | 24 +++++++++++++++ VRP/src/Algoritmo/VRP.java | 57 +++++++++++++++++++++++++++++++++++ VRP/src/Algoritmo/Vehiculo.java | 18 +++++++++++ 8 files changed, 185 insertions(+) create mode 100644 VRP/src/Algoritmo/Almacen.java create mode 100644 VRP/src/Algoritmo/Ciudad.java create mode 100644 VRP/src/Algoritmo/Main.java create mode 100644 VRP/src/Algoritmo/PlanTransporte.java create mode 100644 VRP/src/Algoritmo/TipoAlmacen.java create mode 100644 VRP/src/Algoritmo/Tramo.java create mode 100644 VRP/src/Algoritmo/VRP.java create mode 100644 VRP/src/Algoritmo/Vehiculo.java (limited to 'VRP/src/Algoritmo') diff --git a/VRP/src/Algoritmo/Almacen.java b/VRP/src/Algoritmo/Almacen.java new file mode 100644 index 0000000..52f3f13 --- /dev/null +++ b/VRP/src/Algoritmo/Almacen.java @@ -0,0 +1,24 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class Almacen { + Ciudad ciudad; + String region; + TipoAlmacen tipo; + + public Almacen(Ciudad ciudad, String region, TipoAlmacen tipo) { + this.ciudad = ciudad; + this.region = region; + this.tipo = tipo; + } + + +} diff --git a/VRP/src/Algoritmo/Ciudad.java b/VRP/src/Algoritmo/Ciudad.java new file mode 100644 index 0000000..81ef2c6 --- /dev/null +++ b/VRP/src/Algoritmo/Ciudad.java @@ -0,0 +1,18 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class Ciudad { + String nombre; + String region; + double longitud; + double latitud; + +} diff --git a/VRP/src/Algoritmo/Main.java b/VRP/src/Algoritmo/Main.java new file mode 100644 index 0000000..8b8aa93 --- /dev/null +++ b/VRP/src/Algoritmo/Main.java @@ -0,0 +1,15 @@ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class Main { + + public static void main (String[] args){ + int num_iter=45; + VRP vrp = new VRP(); + vrp.init_data(); + vrp.genetic_algorithm(num_iter); + } +} diff --git a/VRP/src/Algoritmo/PlanTransporte.java b/VRP/src/Algoritmo/PlanTransporte.java new file mode 100644 index 0000000..cf5d66b --- /dev/null +++ b/VRP/src/Algoritmo/PlanTransporte.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class PlanTransporte { + +} diff --git a/VRP/src/Algoritmo/TipoAlmacen.java b/VRP/src/Algoritmo/TipoAlmacen.java new file mode 100644 index 0000000..2f107ed --- /dev/null +++ b/VRP/src/Algoritmo/TipoAlmacen.java @@ -0,0 +1,15 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class TipoAlmacen { + String nombre; + double capacidad; +} diff --git a/VRP/src/Algoritmo/Tramo.java b/VRP/src/Algoritmo/Tramo.java new file mode 100644 index 0000000..eb2955d --- /dev/null +++ b/VRP/src/Algoritmo/Tramo.java @@ -0,0 +1,24 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package Algoritmo; + +/** + * + * @author DAYANA + */ +public class Tramo { + Ciudad ciudad1; + Ciudad ciudad2; + double distancia; + + public Tramo(Ciudad ciudad1, Ciudad ciudad2, double distancia) { + this.ciudad1 = ciudad1; + this.ciudad2 = ciudad2; + this.distancia = distancia; + } + + +} diff --git a/VRP/src/Algoritmo/VRP.java b/VRP/src/Algoritmo/VRP.java new file mode 100644 index 0000000..b1423b9 --- /dev/null +++ b/VRP/src/Algoritmo/VRP.java @@ -0,0 +1,57 @@ + +package Algoritmo; + +/** + * + * @author DAYANA + */ + + +public class VRP { + + + public static void genetic_algorithm(int max_iter){ + //generar poblacion inicial aleatoria + PlanTransporte poblacion[] = new PlanTransporte[200]; + PlanTransporte nueva_generacion[] = new PlanTransporte[200]; + + poblacion = init_population(); + + //evaluar fitness de la poblacion + evaluar(poblacion); + + for(int i=1;i Date: Mon, 11 Apr 2022 01:58:05 -0500 Subject: Clases compiladas --- VRP/src/Algoritmo/VRP.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'VRP/src/Algoritmo') diff --git a/VRP/src/Algoritmo/VRP.java b/VRP/src/Algoritmo/VRP.java index b1423b9..a512e40 100644 --- a/VRP/src/Algoritmo/VRP.java +++ b/VRP/src/Algoritmo/VRP.java @@ -28,15 +28,15 @@ public class VRP { } - private static Tramo[] generar_nueva_generacion(Tramo[] poblacion) { + private static PlanTransporte[] generar_nueva_generacion(PlanTransporte[] poblacion) { return null; } - private static Tramo[] survive(Tramo[] poblacion, Tramo[] nueva_generacion) { + private static PlanTransporte[] survive(PlanTransporte[] poblacion, PlanTransporte[] nueva_generacion) { return null; } - public static Tramo[] init_population(){ + public static PlanTransporte[] init_population(){ for(int i=1;i<10;i++){ @@ -46,7 +46,7 @@ public class VRP { return null; } - public static void evaluar(Tramo[] poblacion){ + public static void evaluar(PlanTransporte[] poblacion){ } -- cgit v1.2.3