[go: nahoru, domu]

Skip to content

Commit

Permalink
Report article
Browse files Browse the repository at this point in the history
  • Loading branch information
castellanos94 committed Jan 21, 2022
1 parent def6d24 commit 718c403
Show file tree
Hide file tree
Showing 3 changed files with 1,307 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
public class AlgorithmComparisonReport {

private final static int numberOfObjectives = 10;
private final static int numberOfObjectives = 3;
private static String algorithmName = numberOfObjectives + File.separator + "NSGA3";
// private static String algorithmName = File.separator + "NSGA3_last";
private static final String OWNER = "FROM_PROBLEM";
Expand All @@ -57,7 +57,8 @@ public class AlgorithmComparisonReport {
+ "IMOACOR" + File.separator;
private static String MOGWOVSIMOACOR = "experiments" + File.separator + numberOfObjectives + File.separator
+ "MOGWOVSIMOACOR" + File.separator;
private static String CMP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator + "CMP"
private static String CMP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator
+ "CMP-PLOT"
+ File.separator;
private static String MOGWO_EP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator
+ "MOGWO-EP" + File.separator;
Expand All @@ -81,11 +82,14 @@ public class AlgorithmComparisonReport {
private static StringColumn dMaxColumn = StringColumn.create("Max");
private static StringColumn timeColumn = StringColumn.create("time");
private static HashMap<String, ArrayList<HashMap<String, Double>>> rankListMetric = new HashMap<>();
private static String ALGORITHM_IGNORE[] = {"A1","A2","A3","B1","B2","C1","C2", "MOEAD-O-DM1-VAR5-10", "MOGWO-O", "MOGWO-O-EP10M", "MOGWO-P",
"MOGWO-P-EP10M", "MOGWO", "MOGWO-EP10M", "MOGWO-EPN", "MOGWO-P", "MOGWO-V", "C0R0", "C2R1", "C10R0",
"VAR-97", "VAR-98", "VAR-100", "VAR-104", "VAR-127", "VAR-0", "IMOACOR", "IMOACORPR2-Elite2" };// {"C0R0","VAR-0","IMOACOR","MOGWO"};
// primer folder imoacor vs ordinal p1
// segundo folder mogwo vs mogwo - p [b3]
private static String ALGORITHM_IGNORE[] = { "A1", "A2", "B1", "B2", "C1", "C2", "C3", "MOEAD-O-DM1-VAR5-10",
"MOGWO-O", "MOGWO-O-EP10M", "MOGWO-P",
"MOGWO-P-EP10M", "MOGWO", "MOGWO-EP10M", "MOGWO-EPN", "MOGWO-P", "MOGWO-V", "C2R1", "C10R0", "C1R2",
"IMOACORPR2", "C1R0",
"VAR-97", "VAR-98", "VAR-100", "VAR-104", "VAR-127", "VAR-0", "IMOACORPR2-Elite2" };// {"C0R0","VAR-0","IMOACOR","MOGWO"};
// primer folder imoacor vs ordinal p1
// segundo folder mogwo vs mogwo - p [b3]

public static void main(String[] args) throws IOException {
HashMap<String, ArrayList<DoubleSolution>> roi = new HashMap<>();
HashMap<String, DTLZP> problems = new HashMap<>();
Expand All @@ -94,7 +98,8 @@ public static void main(String[] args) throws IOException {
// Espeficia que soluciones
loadSolutionExperiment(DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);

loadSolutionExperiment(NRV_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
// loadSolutionExperiment(NRV_DIRECTORY, problems, roi, globalSolutionByProblem,
// algorithmTimeByProblem);
loadSolutionExperiment(MOGWOP_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
loadSolutionExperiment(IMOACOR_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
// Ruta de salida
Expand Down Expand Up @@ -160,6 +165,8 @@ public static void main(String[] args) throws IOException {
globalSolution.put(_problem, currentBag);
globalCSat.put(_problem, _csat);
});
globalMetric(LAST_DIRECTORY, globalSolution, roi, _names_algorithm, algorithmTimeByProblem);

Table table = Table.create("Metrics DTLZ");
StringColumn _name = StringColumn.create("problem");
DoubleColumn all = DoubleColumn.create("solutions");
Expand Down Expand Up @@ -638,7 +645,7 @@ private static HashMap<String, String> doStatisticTest(String nameProblem, int s
tmpTable.write().csv(file);
System.out.println(nameProblem + "/" + metricName + "-> " + file.getAbsolutePath());
// Non-parametric two groups > Mann-Whitney-U: unpaired data.
//StacConsumer.WILCOXON(file.getAbsolutePath(), firstGroup, secondGroup, 0.05)
// StacConsumer.WILCOXON(file.getAbsolutePath(), firstGroup, secondGroup, 0.05)
NonParametricTestAll friedman = (tmpTable.columnCount() < 5)
? StacConsumer.FRIEDMAN_ALIGNED_RANK(file.getAbsolutePath(), 0.05, POST_HOC.FINNER)
: StacConsumer.FRIEDMAN(file.getAbsolutePath(), 0.05, POST_HOC.FINNER);
Expand Down Expand Up @@ -765,7 +772,7 @@ private static void globalMetric(final String LAST_DIRECTORY,
globalSolutionNDByProblem.forEach((_p, bags) -> {
ArrayList<DoubleSolution> bag = new ArrayList<>();
bags.forEach(b -> bag.addAll(b));
DominanceComparator<DoubleSolution> comparator = new DominanceComparator<>();
/* DominanceComparator<DoubleSolution> comparator = new DominanceComparator<>();
comparator.computeRanking(bag);
ArrayList<DoubleSolution> frontZero = comparator.getSubFront(0);
System.out.println(
Expand Down Expand Up @@ -863,22 +870,36 @@ private static void globalMetric(final String LAST_DIRECTORY,
});
csatSolutions.addAll(roi.get(_p.getName()));
csatSolutions.addAll(roi.get(_p.getName()));*/
if (numberOfObjectives == 3) {
ArrayList<DoubleSolution> arrayList = new ArrayList<>(roi.get(_p.getName()));
System.out.println(_p.getName());
HashMap<String, ArrayList<DoubleSolution>> gba = groupByAlgorithm(bag,
_names_algorithm, true);
gba.forEach((algorithm, cb) -> {
System.out.printf("\tAlgorithm : %10s, bag : %5d\n", algorithm, cb.size());
DominanceComparator<DoubleSolution> dominanceComparator = new DominanceComparator<>();
dominanceComparator.computeRanking(cb);
System.out.printf("\t\tFront zero %5d\n",dominanceComparator.getSubFront(0).size());
ArrayList<DoubleSolution> classifySolutions = classifySolutions(_p, dominanceComparator.getSubFront(0), false, false);
System.out.printf("\t\tFront zero classificated %5d\n",classifySolutions.size());

arrayList.addAll(classifySolutions);
});
try {
System.out.println("\tExport all solutions with class");
EXPORT_OBJECTIVES_TO_CSV(LAST_DIRECTORY, csatSolutions, _p.getName() + "_ALL");
EXPORT_OBJECTIVES_TO_CSV(LAST_DIRECTORY, arrayList, _p.getName() + "_ALL");
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("\tCsat distribution: " + csatSolutions.size());
/* System.out.println("\tCsat distribution: " + csatSolutions.size());
HashMap<String, ArrayList<DoubleSolution>> groupByAlgorithm2 = groupByAlgorithm(csatSolutions,
_names_algorithm, true);
groupByAlgorithm2.forEach((k, v) -> {
System.out.println("\t\t" + k + " -> "
+ v.stream().filter(s -> ((String) s.getAttribute("class")).contains("SAT")).count());
});
});*/
});
Table global = Table.create("global");
global.addColumns(_nameG, allG, frontZeroG);
Expand Down Expand Up @@ -1028,7 +1049,7 @@ private static void EXPORT_OBJECTIVES_TO_CSV(final String LAST_DIRECTORY,
for (int i = 0; i < front_preferences.get(0).getProblem().getNumberOfObjectives(); i++) {
StringColumn column = StringColumn.create("F-" + (i + 1));
for (DoubleSolution solution_ : front_preferences)
column.append(solution_.getObjective(i).toString());
column.append(String.format("%.05f", solution_.getObjective(i).doubleValue()));
table.addColumns(column);
}
StringColumn column = StringColumn.create("Algorithm");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class AlgorithmComparisonReportWilcoxon {

private final static int numberOfObjectives = 3 ;
private final static int numberOfObjectives = 10 ;
private static String algorithmName = numberOfObjectives + File.separator + "NSGA3";
// private static String algorithmName = File.separator + "NSGA3_last";
private static final String OWNER = "FROM_PROBLEM";
Expand All @@ -58,7 +58,7 @@ public class AlgorithmComparisonReportWilcoxon {
+ "IMOACOR" + File.separator;
private static String MOGWOVSIMOACOR = "experiments" + File.separator + numberOfObjectives + File.separator
+ "MOGWOVSIMOACOR" + File.separator;
private static String CMP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator + "CMP-MAT-iMOACOR"
private static String CMP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator + "CMP-MAT-RV-NSGA3-MOGWO"
+ File.separator;
private static String MOGWO_EP_DIRECTORY = "experiments" + File.separator + numberOfObjectives + File.separator
+ "MOGWO-EP" + File.separator;
Expand All @@ -82,20 +82,25 @@ public class AlgorithmComparisonReportWilcoxon {
private static StringColumn dMaxColumn = StringColumn.create("Max");
private static StringColumn timeColumn = StringColumn.create("time");
private static HashMap<String, ArrayList<HashMap<String, Double>>> rankListMetric = new HashMap<>();
private static String ALGORITHM_IGNORE[] = { "A1","A2","B1","B2","C1","C2","C3","IMOACORPR2", "IMOACORPR2-Elite2" };// {"C0R0","VAR-0","IMOACOR","MOGWO"};
private static String ALGORITHM_IGNORE[] = { "A1","A3","A2","B1","B2","C1","C2","C3", "IMOACOR","IMOACORPR2", "IMOACORPR2-Elite2" , "C1R0","C1R2", "C10R0"};// {"C0R0","VAR-0","IMOACOR","MOGWO"};
/*private static String ALGORITHM_IGNORE[] = {"A1","A2","A3","B1","B2","C1","C2", "MOEAD-O-DM1-VAR5-10", "MOGWO-O", "MOGWO-O-EP10M", "MOGWO-P",
"MOGWO-P-EP10M", "MOGWO", "MOGWO-EP10M", "MOGWO-EPN", "MOGWO-P", "MOGWO-V", "C0R0", "C2R1", "C10R0",
"VAR-97", "VAR-98", "VAR-100", "VAR-104", "VAR-127", "VAR-0", "IMOACOR", "IMOACORPR2-Elite2" };// {"C0R0","VAR-0","IMOACOR","MOGWO"};*/
// primer folder imoacor vs ordinal p1
// segundo folder mogwo vs mogwo - p [b3]
// Comparar imoacor con preferencias contra nsga 3
// Comparar mogwo con preferencias contra nsga 3

public static void main(String[] args) throws IOException {
HashMap<String, ArrayList<DoubleSolution>> roi = new HashMap<>();
HashMap<String, DTLZP> problems = new HashMap<>();
HashMap<DTLZP, HashMap<String, ArrayList<ArrayList<DoubleSolution>>>> globalSolutionByProblem = new HashMap<>();
HashMap<DTLZP, HashMap<String, Table>> algorithmTimeByProblem = new HashMap<>();
// Espeficia que soluciones
loadSolutionExperiment(IMOACOR_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
loadSolutionExperiment(DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);

//loadSolutionExperiment(IMOACOR_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
loadSolutionExperiment(MOGWOP_DIRECTORY, problems, roi, globalSolutionByProblem, algorithmTimeByProblem);
// Ruta de salida
final String LAST_DIRECTORY = CMP_DIRECTORY;
// Se valida que la ruta existe
Expand Down
Loading

0 comments on commit 718c403

Please sign in to comment.