-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a444d51
commit 5b1deb2
Showing
6 changed files
with
251 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
nbproject/private/private.xml | ||
nbproject/private/private.properties | ||
/log/ | ||
*0.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ [email protected] | |
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=29d45fb8 | ||
nbproject/build-impl.xml.script.CRC32=405e9818 | ||
nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.92.0.48 | ||
nbproject/build-impl.xml.script.CRC32=8fe6f3b0 | ||
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.96.0.48 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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 tools; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
|
||
/** | ||
* | ||
* @author Miguerubsk | ||
*/ | ||
public class CargaDatos { | ||
private int TamMatriz, TamSolucion; | ||
private double Matriz[][]; | ||
private String NombreFichero; | ||
|
||
public CargaDatos(String fichero){ | ||
NombreFichero = fichero; | ||
FileReader f = null; | ||
String linea; | ||
try { | ||
f = new FileReader(fichero); | ||
BufferedReader b = new BufferedReader(f); | ||
|
||
if((linea = b.readLine()) != null){ | ||
String[] split = linea.split(" "); | ||
TamMatriz = Integer.parseInt(split[0]); | ||
TamSolucion = Integer.parseInt(split[1]); | ||
Matriz = new double[TamMatriz][TamMatriz]; | ||
} | ||
|
||
for (int i = 0; i < TamMatriz; i++) { | ||
for (int j = 0; j < TamMatriz; j++) { | ||
Matriz[i][j] = 0; | ||
} | ||
} | ||
|
||
while((linea = b.readLine()) != null){ | ||
String[] split = linea.split(" "); | ||
Matriz[Integer.parseInt(split[0])][Integer.parseInt(split[1])] = Double.parseDouble(split[2]); | ||
Matriz[Integer.parseInt(split[1])][Integer.parseInt(split[0])] = Double.parseDouble(split[2]); | ||
} | ||
|
||
} catch (IOException e) { | ||
System.out.println(e); | ||
} | ||
|
||
} | ||
|
||
public int getTamMatriz() { | ||
return TamMatriz; | ||
} | ||
|
||
public int getTamSolucion() { | ||
return TamSolucion; | ||
} | ||
|
||
public double[][] getMatriz() { | ||
return Matriz; | ||
} | ||
|
||
public String getNombreFichero() { | ||
return NombreFichero; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* 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 util; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
/** | ||
* | ||
* @author Miguerubsk | ||
*/ | ||
public class Configurador { | ||
|
||
private ArrayList<String> Ficheros, Algoritmos; | ||
private ArrayList<Long> Semillas; | ||
private Integer Evaluaciones; | ||
private Integer Tenencia; | ||
|
||
public Configurador(String ruta) { | ||
Ficheros = new ArrayList<>(); | ||
Algoritmos = new ArrayList<>(); | ||
Semillas = new ArrayList<>(); | ||
|
||
String linea; | ||
FileReader f = null; | ||
try { | ||
f = new FileReader(ruta); | ||
BufferedReader b = new BufferedReader(f); | ||
|
||
while ((linea = b.readLine()) != null) { | ||
String[] split = linea.split("="); | ||
switch (split[0]) { | ||
case "Archivos": | ||
String[] vF = split[1].split(" "); | ||
for (int i = 0; i < vF.length; i++) { | ||
Ficheros.add(vF[i]); | ||
} | ||
break; | ||
case "Semillas": | ||
String[] vS = split[1].split(" "); | ||
for (int i = 0; i < vS.length; i++) { | ||
Semillas.add(Long.parseLong(vS[i])); | ||
} | ||
break; | ||
case "Algoritmos": | ||
String[] vA = split[1].split(" "); | ||
for (int i = 0; i < vA.length; i++) { | ||
Algoritmos.add(vA[i]); | ||
} | ||
break; | ||
case "Evaluaciones": | ||
Evaluaciones = Integer.parseInt(split[1]); | ||
break; | ||
case "Tenencia_Tabu": | ||
Tenencia = Integer.parseInt(split[1]); | ||
break; | ||
} | ||
} | ||
|
||
} catch (IOException e) { | ||
System.out.println(e); | ||
} | ||
} | ||
|
||
public ArrayList<String> getFicheros() { | ||
return Ficheros; | ||
} | ||
|
||
public ArrayList<String> getAlgoritmos() { | ||
return Algoritmos; | ||
} | ||
|
||
public ArrayList<Long> getSemillas() { | ||
return Semillas; | ||
} | ||
|
||
public Integer getEvaluaciones() { | ||
return Evaluaciones; | ||
} | ||
|
||
public int getTenencia() { | ||
return Tenencia; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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 tools; | ||
|
||
import java.io.File; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
|
||
/** | ||
* | ||
* @author Miguerubsk | ||
*/ | ||
public class GuardarLog { | ||
|
||
private FileWriter fichero = null; | ||
private PrintWriter pw = null; | ||
private String separador = "\n-------------------------------------"; | ||
|
||
public GuardarLog(String nombreArchivo, String texto, String algoritmo) { | ||
try { | ||
String carpeta = "log/" + algoritmo + "/"; | ||
File directorio = new File(carpeta); | ||
if (!directorio.exists()) { | ||
directorio.mkdirs(); | ||
} | ||
|
||
File file = new File(carpeta + nombreArchivo + ".txt"); | ||
if (!file.exists()) { | ||
file.createNewFile(); | ||
} else { | ||
file.delete(); | ||
file.createNewFile(); | ||
} | ||
fichero = new FileWriter(carpeta + nombreArchivo + ".txt"); | ||
pw = new PrintWriter(fichero); | ||
|
||
pw.write(texto + separador); | ||
|
||
} catch (IOException e) { | ||
System.err.println(e.toString()); | ||
} | ||
} | ||
|
||
public void escribir(String texto) { | ||
try { | ||
fichero.write("\n[INFORMACION]\n" + texto + "\n"); | ||
} catch (Exception e) { | ||
System.out.println("tools.GuardarLog.escribir()" + e.toString()); | ||
} | ||
} | ||
|
||
public void escribirNoInfo(String texto) { | ||
try { | ||
fichero.write("\n" + texto + "\n"); | ||
} catch (Exception e) { | ||
System.out.println("tools.GuardarLog.escribir()" + e.toString()); | ||
} | ||
} | ||
|
||
public void escribirFinal(String texto) { | ||
try { | ||
fichero.write(separador + "\n" + texto + "\n"); | ||
fichero.close(); | ||
} catch (Exception e) { | ||
System.out.println("tools.GuardarLog.escribir()" + e.toString()); | ||
} | ||
} | ||
} |