예제 #1
0
    def publish(self,
                filelist,
                options,
                timPerOpt,
                optPerSol,
                fnames,
                maxtime,
                bestever={},
                plot=True,
                details=True,
                problems="fzn"):
        # Then start the document
        doc = Document(document_options="table")
        doc.packages.append(Package(
            "xcolor", options="dvipsnames"))  # to deal with colors
        doc.color = True  # to deal with colors
        # np.random.seed(0)
        for opt in options:
            col = list(np.random.choice(range(128), size=3))
            doc.add_color(
                opt, "RGB",
                "%d,%d,%d" % (col[0] + 128, col[1] + 128, col[2] + 128))

        doc.preamble.append(
            Command(
                'title',
                'Benchmark analysis of %d problems and %d configurations.' %
                (len(fnames), len(options))))
        doc.preamble.append(Command('author', "Charles Prud'homme"))
        doc.append(NoEscape(r'\maketitle'))

        doc.packages.append(Package('geometry'))

        if plot:
            self.__globals(doc, options, timPerOpt, maxtime)

        self.__sybil(doc, options, optPerSol, fnames, maxtime, bestever)
        if details:
            if problems is "fzn":
                self.__detailsFZN(doc, options, optPerSol, fnames, maxtime,
                                  bestever)
            elif problems is "xcsp":
                self.__detailsXCSP(doc, options, optPerSol, fnames, maxtime,
                                   bestever)

        name = os.path.basename(filelist)
        print(name)
        # doc.generate_tex(name[:-4])
        doc.generate_pdf(filepath=name[:-4], clean=True, silent=False)