public void computeWinsTiesLossesLatex(String path) {

        List<Algorithm> alg = this.streams.get(0).algorithm;
        int algorithmSize = this.streams.get(0).algorithm.size();
        String output = "";
        output += "\\documentclass{article}\n";
        output += "\\usepackage[latin9]{inputenc}\n"
                + "\\usepackage{array}\n"
                + "\\usepackage{rotfloat}\n"
                + "\\usepackage{multirow}\n"
                + "\n"
                + "\\makeatletter\n"
                + "\\providecommand{\\tabularnewline}{\\\\}\n"
                + "\\usepackage{multirow}\n"
                + "\\usepackage{booktabs}\n"
                + "\\makeatother\n"
                + "\n"
                + "\\begin{document}\n"
                + "\\begin{sidewaystable}\n"
                + "\\centering \\caption{Add caption}\n\\begin{tabular}";
        output += "{|r|r|";

        for (int i = 2; i <= algorithmSize * 3; i++) {
            if (i <= algorithmSize) {
                output += "r";
            } else {
                if (i == algorithmSize * 3) {
                    output += "|";
                } else {
                    output += "|r";
                }
            }
        }
        output += "}\n\\hline\n";
        output += "\\multirow{2}{*}{Algorithm } & \\multirow{2}{*}{PM} &";
        output += "\\multicolumn{3}{r|}{" + alg.get(1).name + "}";
        for (int i = 2; i < algorithmSize; i++) {
            output += " & \\multicolumn{3}{r|}{" + alg.get(i).name + "}";
        }
        output += "& \\multirow{2}{*}{AVG}\\tabularnewline\n";
        output += "\\cline{3-" + (algorithmSize * 3 - 1) + "}\n";
        output += " & & ";
        output += "\\multicolumn{1}{r|}{W} & \\multicolumn{1}{r|}{L} & \\multicolumn{1}{r|}{T} & ";
        for (int i = 2; i < algorithmSize; i++) {
            output += "\\multicolumn{1}{r|}{W} & \\multicolumn{1}{r|}{L} & \\multicolumn{1}{r|}{T} & ";
        }
        output += "\\tabularnewline\n\\hline\n";
        int range = 3;
        int measuresSize = this.streams.get(0).algorithm.get(0).measures.size();
        for (int i = 0; i < algorithmSize; i++) {
            output += "\\multirow{" + alg.get(i).measures.size() + "}{*}" + "{" + alg.get(i).name + "}";
            List<Measure> measureRow[] = alg.get(i).getMeasuresPerData(streams);
            int cont = 0;

            while (cont != measuresSize) {

                //String name = measureRow[i].get(cont).getName();
                String name = alg.get(i).measures.get(cont).getName();
                output += " & " + name;
                double sum = 0.0;

                for (int j = 1; j < algorithmSize; j++) {
                    List<Measure> measureCol[] = alg.get(j).getMeasuresPerData(streams);
                    int win = 0, losses = 0, ties = 0;
                    for (int k = 0; k < measureCol.length; k++) {
                        double alg1 = measureRow[k].get(cont).getValue();
                        double alg2 = measureCol[k].get(cont).getValue();
                        if (j == 1) {
                            sum += measureRow[k].get(cont).getValue();
                        }
                        if (measureRow[k].get(cont).isType()) {

                            if (Algorithm.Round(alg1) > Algorithm.Round(alg2)) {
                                win++;
                            } else if (Algorithm.Round(alg1) < Algorithm.Round(alg2)) {
                                losses++;
                            } else {
                                ties++;
                            }
                        } else {
                            if (alg1 < alg2) {
                                win++;
                            } else if (alg1 > alg2) {
                                losses++;
                            } else {
                                ties++;
                            }
                        }

                    }
                    if (i < j) {

                        output += " & \\multicolumn{1}{r|}{" + win + "}";
                        output += " & \\multicolumn{1}{r|}{" + losses + "}";
                        output += " & \\multicolumn{1}{r|}{" + ties + "}";

                    } else if (i == j) {
                        output += " & \\multicolumn{1}{r}{}";
                        output += " & \\multicolumn{1}{r}{}";
                        output += " & \\multicolumn{1}{r|}{}";
                    } else {
                        output += " & \\multicolumn{1}{r}{}";
                        output += " & \\multicolumn{1}{r}{}";
                        output += " & \\multicolumn{1}{r}{}";

                    }

                }

                sum = (double) sum / measureRow.length;
                output += " & " + Algorithm.format(sum);

                if (cont < measuresSize - 1) {
                    output += "\\tabularnewline\n \\cline{2-2} \\cline{" + range + "-" + (algorithmSize * 3) + "}\n";
                } else {
                    if (i != algorithmSize - 1) {
                        output += "\\tabularnewline\n \\cline{1-2} \\cline{" + range + "-" + (algorithmSize * 3) + "}\n";
                    } else {
                        output += "\\tabularnewline\n \\cline{1-" + (algorithmSize * 3) + "}\n";
                    }
                }

                cont++;

            }

            range += 3;
        }
        output += "\\end{tabular}\\label{tab:addlabel}\n"
                + "\\end{sidewaystable}\n"
                + "\n"
                + "\\end{document}";
//        PrintStream out = null;
//        try {
//            out = new PrintStream(new BufferedOutputStream(new FileOutputStream(path + "summary.win.ties.losses.tex")));
//        } catch (FileNotFoundException ex) {
//            Logger.getLogger(Summary.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        System.setOut(out);
//        System.out.println(output);
//        out.close();
        try {
            BufferedWriter out = new BufferedWriter(new FileWriter(path + "summary.win.ties.losses.tex"));
            out.write(output);  //Replace with the string 
            //you are trying to write  
            out.close();
        } catch (IOException e) {
            System.out.println("Error saving summary.win.ties.losses.tex");

        }

    }
public void computeWinsTiesLossesLatex ( String path ) { List < Algorithm > alg = this . streams . get ( 0 ) . algorithm ; int algorithmSize = this . streams . get ( 0 ) . algorithm . size ( ) ; String output = "" ; output += "\\documentclass{article}\n" ; output += "\\usepackage[latin9]{inputenc}\n" + "\\usepackage{array}\n" + "\\usepackage{rotfloat}\n" + "\\usepackage{multirow}\n" + "\n" + "\\makeatletter\n" + "\\providecommand{\\tabularnewline}{\\\\}\n" + "\\usepackage{multirow}\n" + "\\usepackage{booktabs}\n" + "\\makeatother\n" + "\n" + "\\begin{document}\n" + "\\begin{sidewaystable}\n" + "\\centering \\caption{Add caption}\n\\begin{tabular}" ; output += "{|r|r|" ; for ( int i = 2 ; i <= algorithmSize * 3 ; i ++ ) { if ( i <= algorithmSize ) { output += "r" ; } else { if ( i == algorithmSize * 3 ) { output += "|" ; } else { output += "|r" ; } } } output += "}\n\\hline\n" ; output += "\\multirow{2}{*}{Algorithm } & \\multirow{2}{*}{PM} &" ; output += "\\multicolumn{3}{r|}{" + alg . get ( 1 ) . name + "}" ; for ( int i = 2 ; i < algorithmSize ; i ++ ) { output += " & \\multicolumn{3}{r|}{" + alg . get ( i ) . name + "}" ; } output += "& \\multirow{2}{*}{AVG}\\tabularnewline\n" ; output += "\\cline{3-" + ( algorithmSize * 3 - 1 ) + "}\n" ; output += " & & " ; output += "\\multicolumn{1}{r|}{W} & \\multicolumn{1}{r|}{L} & \\multicolumn{1}{r|}{T} & " ; for ( int i = 2 ; i < algorithmSize ; i ++ ) { output += "\\multicolumn{1}{r|}{W} & \\multicolumn{1}{r|}{L} & \\multicolumn{1}{r|}{T} & " ; } output += "\\tabularnewline\n\\hline\n" ; int range = 3 ; int measuresSize = this . streams . get ( 0 ) . algorithm . get ( 0 ) . measures . size ( ) ; for ( int i = 0 ; i < algorithmSize ; i ++ ) { output += "\\multirow{" + alg . get ( i ) . measures . size ( ) + "}{*}" + "{" + alg . get ( i ) . name + "}" ; List < Measure > measureRow [ ] = alg . get ( i ) . getMeasuresPerData ( streams ) ; int cont = 0 ; while ( cont != measuresSize ) { String name = alg . get ( i ) . measures . get ( cont ) . getName ( ) ; output += " & " + name ; double sum = 0.0 ; for ( int j = 1 ; j < algorithmSize ; j ++ ) { List < Measure > measureCol [ ] = alg . get ( j ) . getMeasuresPerData ( streams ) ; int win = 0 , losses = 0 , ties = 0 ; for ( int k = 0 ; k < measureCol . length ; k ++ ) { double alg1 = measureRow [ k ] . get ( cont ) . getValue ( ) ; double alg2 = measureCol [ k ] . get ( cont ) . getValue ( ) ; if ( j == 1 ) { sum += measureRow [ k ] . get ( cont ) . getValue ( ) ; } if ( measureRow [ k ] . get ( cont ) . isType ( ) ) { if ( Algorithm . Round ( alg1 ) > Algorithm . Round ( alg2 ) ) { win ++ ; } else if ( Algorithm . Round ( alg1 ) < Algorithm . Round ( alg2 ) ) { losses ++ ; } else { ties ++ ; } } else { if ( alg1 < alg2 ) { win ++ ; } else if ( alg1 > alg2 ) { losses ++ ; } else { ties ++ ; } } } if ( i < j ) { output += " & \\multicolumn{1}{r|}{" + win + "}" ; output += " & \\multicolumn{1}{r|}{" + losses + "}" ; output += " & \\multicolumn{1}{r|}{" + ties + "}" ; } else if ( i == j ) { output += " & \\multicolumn{1}{r}{}" ; output += " & \\multicolumn{1}{r}{}" ; output += " & \\multicolumn{1}{r|}{}" ; } else { output += " & \\multicolumn{1}{r}{}" ; output += " & \\multicolumn{1}{r}{}" ; output += " & \\multicolumn{1}{r}{}" ; } } sum = ( double ) sum / measureRow . length ; output += " & " + Algorithm . format ( sum ) ; if ( cont < measuresSize - 1 ) { output += "\\tabularnewline\n \\cline{2-2} \\cline{" + range + "-" + ( algorithmSize * 3 ) + "}\n" ; } else { if ( i != algorithmSize - 1 ) { output += "\\tabularnewline\n \\cline{1-2} \\cline{" + range + "-" + ( algorithmSize * 3 ) + "}\n" ; } else { output += "\\tabularnewline\n \\cline{1-" + ( algorithmSize * 3 ) + "}\n" ; } } cont ++ ; } range += 3 ; } output += "\\end{tabular}\\label{tab:addlabel}\n" + "\\end{sidewaystable}\n" + "\n" + "\\end{document}" ; try { BufferedWriter out = new BufferedWriter ( new FileWriter ( path + "summary.win.ties.losses.tex" ) ) ; out . write ( output ) ; out . close ( ) ; } catch ( IOException e ) { System . out . println ( "Error saving summary.win.ties.losses.tex" ) ; } }
Generates a latex summary that shows the gains, loses or ties of each
algorithm against each other, in a specific measure..