Beispiel #1
0
def addIPPCScoreTable(doc, domain, planners):
    table_style = (["|", "l", "|"] +
                   ["r", r"@{$\pm$}", "r"] * len(domain.instances) + ["|"])
    table = latex.Table(table_style)
    head = table.head()
    head.add_hline()
    head.add_cell(r"")

    for instanceName in domain.instances:
        head.add_cell(instanceName, span=2, align="c")
    head.add_row()
    head.add_hline()
    head.add_hline()
    table.foot().add_hline()

    for planner in planners:
        table.add_cell(planner.name)
        for instanceName in domain.instances:
            score = domain.instances[instanceName].getIPPCScore(planner.name)
            if score == 1.0:
                table.add_cell("\\textbf{\\textcolor{red}{" + str(score) +
                               "}}",
                               span=2,
                               align="c")
            elif score > printFatThreshold:
                table.add_cell("\\textbf{" + str(score) + "}",
                               span=2,
                               align="c")
            else:
                table.add_cell(str(score), span=2, align="c")
        table.add_row()

    doc.add(table, r"\bigskip")
Beispiel #2
0
 def get_latex_table(self):
     return latex.Table(data=self.get_data(),
                        title=self.get_title(),
                        row_info=self.get_row_info(),
                        totals=self.show_totals(),
                        rows=self.get_rows(),
                        columns=self.get_columns(),
                        hline_before=self.block_starters())
Beispiel #3
0
def addTotalIPPCScoreTable(doc, domains, planners):
    table_style = (["|", "l", "|"] + ["r", r"@{$\pm$}", "r"] *
                   (len(domains) + 1) + ["|"])
    table = latex.Table(table_style)
    head = table.head()
    head.add_hline()
    head.add_cell(r"")

    for domainName in domains:
        head.add_cell(domainName, span=2, align="c")
    head.add_cell("Total", span=2, align="c")
    head.add_row()
    head.add_hline()
    head.add_hline()
    table.foot().add_hline()

    for planner in planners:
        table.add_cell(planner.name)

        IPPCSum = float(0.0)
        numberOfInstances = 0
        for domainName in domains:
            domainSum = float(0.0)
            for instanceName in domains[domainName].instances:
                numberOfInstances += 1
                domainSum += domains[domainName].instances[
                    instanceName].getIPPCScore(planner.name)
                IPPCSum += domains[domainName].instances[
                    instanceName].getIPPCScore(planner.name)
            domainSum = round(
                float(domainSum / float(len(domains[domainName].instances))),
                2)
            if domainSum == 1.0:
                table.add_cell("\\textbf{\\textcolor{red}{" + str(domainSum) +
                               "}}",
                               span=2,
                               align="c")
            elif domainSum > printFatThreshold:
                table.add_cell("\\textbf{" + str(domainSum) + "}",
                               span=2,
                               align="c")
            else:
                table.add_cell(str(domainSum), span=2, align="c")

        IPPCSum = round(float(IPPCSum / (float(numberOfInstances))), 2)
        if IPPCSum >= 0.98:
            table.add_cell("\\textbf{\\textcolor{red}{" + str(IPPCSum) + "}}",
                           span=2,
                           align="c")
        elif IPPCSum > totalScorePrintFatThreshold:
            table.add_cell("\\textbf{" + str(IPPCSum) + "}", span=2, align="c")
        else:
            table.add_cell(str(IPPCSum), span=2, align="c")
        table.add_row()

    doc.add(table, r"\bigskip")
Beispiel #4
0
def domain_pairing_summaries(suite, results, pairings, aggregator, title):
    table_data = defaultdict(lambda: "missing")
    for config1, config2 in PAIRS:
        pairing = r"%s vs.\ %s" % (config1, config2)
        pair_data = domain_pairing_summary(suite, results, config1, config2,
                                           aggregator)
        for domain, entry in pair_data.iteritems():
            table_data[domain, pairing] = str(entry)
    table = latex.Table(title=title, data=table_data)
    latex.Document([table]).dump()
Beispiel #5
0
def compare_config_pairs(suite, results, pairs, comparator, title):
    table_data = defaultdict(lambda: "missing")
    for config1, config2 in pairs:
        pairing = r"%s vs.\ %s" % (config1, config2)
        pair_data = compare_config_pair(suite, results, config1, config2,
                                        comparator)
        for domain, comparison in pair_data.iteritems():
            table_data[domain, pairing] = comparison
    table = latex.Table(title=title, data=table_data)
    latex.Document([table]).dump()
Beispiel #6
0
def addRewardTable(doc, domain, planners):
    table_style = (["|", "l", "|"] +
                   ["r", r"@{$\pm$}", "r"] * len(domain.instances) + ["|"])
    table = latex.Table(table_style)
    head = table.head()
    head.add_hline()
    head.add_cell(r"")

    for instanceName in domain.instances:
        head.add_cell(instanceName, span=2, align="c")
    head.add_row()
    head.add_hline()
    head.add_hline()
    table.foot().add_hline()

    for planner in planners:
        table.add_cell(planner.name)
        for instanceName in domain.instances:
            reward = domain.instances[instanceName].results[planner.name]
            score = domain.instances[instanceName].getIPPCScore(planner.name)
            conf95 = domain.instances[instanceName].confidence95[planner.name]
            if score == 1.0:
                table.add_cell("\\textbf{\\textcolor{red}{" + str(reward) +
                               "($\pm$" + str(conf95) + ")}}",
                               span=2,
                               align="c")
            elif score > printFatThreshold:
                table.add_cell("\\textbf{$" + str(reward) + "(\\pm" +
                               str(conf95) + ")$}",
                               span=2,
                               align="c")
            else:
                table.add_cell("$" + str(reward) + "(\\pm" + str(conf95) +
                               ")$",
                               span=2,
                               align="c")
        table.add_row()

    doc.add(table, r"\bigskip")
Beispiel #7
0
def addTotalTimeTable(doc, domains, planners):
    table_style = (["|", "l", "|"] + ["r", r"@{$\pm$}", "r"] *
                   (len(domains) + 1) + ["|"])
    table = latex.Table(table_style)
    head = table.head()
    head.add_hline()
    head.add_cell(r"")

    for domainName in domains:
        head.add_cell(domainName, span=2, align="c")
    head.add_cell("Total", span=2, align="c")
    head.add_row()
    head.add_hline()
    head.add_hline()
    table.foot().add_hline()

    for planner in planners:
        table.add_cell(planner.name)

        numberOfInstances = 0
        for domainName in domains:
            if planner.timesPerDomain[domainName] < 0.0:
                table.add_cell("n/a", span=2, align="c")
            else:
                table.add_cell(str(
                    round(planner.timesPerDomain[domainName] / 60.0, 2)),
                               span=2,
                               align="c")
        if planner.totalTime < 0.0:
            table.add_cell("n/a", span=2, align="c")
        else:
            table.add_cell(str(round(planner.totalTime / 60.0, 2)),
                           span=2,
                           align="c")
        table.add_row()

    doc.add(table, r"\bigskip")
Beispiel #8
0
def addRewardTable(doc, domain, planners):
    table_style = (["|", "l", "|"] +
                   ["r", r"@{$\pm$}", "r"] * len(domain.instances) + ["|"])
    table = latex.Table(table_style)
    head = table.head()
    head.add_hline()
    head.add_cell(r"")

    for instanceName in domain.instances:
        head.add_cell(instanceName, span=2, align="c")
    head.add_row()
    head.add_hline()
    head.add_hline()
    table.foot().add_hline()

    hasOther = False

    for planner in planners:
        if planner.plannerType is "MinMax":
            table.add_cell(planner.name)
            for instanceName in domain.instances:
                reward = domain.instances[instanceName].results[planner.name]
                score = domain.instances[instanceName].getIPPCScore(
                    planner.name)
                conf95 = domain.instances[instanceName].confidence95[
                    planner.name]
                if score == 1.0:
                    table.add_cell("\\textbf{\\textcolor{red}{" + str(reward) +
                                   "}}",
                                   span=2,
                                   align="c")
                else:
                    table.add_cell("$" + str(reward) + "$", span=2, align="c")
            table.add_row()
        else:
            hasOther = True

    if hasOther:
        table.add_hline()

    printedNumInstances = 0

    for planner in planners:
        if planner.plannerType is "Other":
            table.add_cell(planner.name)
            for instanceName in domain.instances:
                if planner.name in domain.instances[instanceName].results:
                    reward = domain.instances[instanceName].results[
                        planner.name]
                    score = domain.instances[instanceName].getIPPCScore(
                        planner.name)
                    conf95 = domain.instances[instanceName].confidence95[
                        planner.name]
                else:
                    reward = "n/a"
                    score = "n/a"
                    conf95 = ""

                if score == 1.0:
                    table.add_cell("\\textbf{\\textcolor{red}{$" +
                                   str(reward) + "$}}",
                                   span=2,
                                   align="c")
                elif score > printFatThreshold:
                    table.add_cell("\\textbf{$" + str(reward) + "$}",
                                   span=2,
                                   align="c")
                else:
                    table.add_cell("$" + str(reward) + "$", span=2, align="c")
            table.add_row()

            printedNumInstances += 1
            if printedNumInstances == 25:
                printedNumInstances = 0
                doc.add(table, r"\bigskip")
                doc.add(r"\newpage")

                table = latex.Table(table_style)
                head = table.head()
                head.add_hline()
                head.add_cell(r"")

                for instanceName in domain.instances:
                    head.add_cell(instanceName, span=2, align="c")
                head.add_row()
                head.add_hline()
                head.add_hline()
                table.foot().add_hline()

    doc.add(table, r"\bigskip")