Detailed Description
tex file reader for writing partialdecs to LaTeX files
Definition in file reader_tex.cpp.
#include <cassert>#include <cstring>#include <cstdio>#include <vector>#include <sstream>#include <algorithm>#include "gcg/reader_tex.h"#include "gcg/scip_misc.h"#include "gcg/reader_gp.h"#include "gcg/cons_decomp.h"#include "gcg/cons_decomp.hpp"#include "gcg/pub_decomp.h"#include "gcg/miscvisualization.h"#include "gcg/class_partialdecomp.h"#include "gcg/class_detprobdata.h"#include "gcg/params_visu.h"Go to the source code of this file.
Data Structures | |
| struct | SCIP_ReaderData |
Macros | |
| #define | READER_NAME "texreader" |
| #define | READER_DESC "LaTeX file writer for partialdec visualization" |
| #define | READER_EXTENSION "tex" |
Functions | |
| SCIP_DECL_READERFREE (readerFreeTex) | |
| SCIP_DECL_READERREAD (readerReadTex) | |
| SCIP_DECL_READERWRITE (readerWriteTex) | |
| static SCIP_RETCODE | getRgbFromHex (const char *hex, int *red, int *green, int *blue) |
| static SCIP_RETCODE | getTexColorFromHex (const char *hex, const char *colorname, char *code) |
| static SCIP_RETCODE | writeTexHeader (GCG *gcg, FILE *file, SCIP_Bool externalizepics) |
| static SCIP_RETCODE | writeTexTitlepage (GCG *gcg, FILE *file, int *npresentedpartialdecs) |
| static SCIP_RETCODE | writeTexTableOfContents (SCIP *scip, FILE *file) |
| static SCIP_RETCODE | writeTikzBox (SCIP *scip, FILE *file, int xmax, int ymax, int x1, int y1, int x2, int y2, const char *color) |
| static SCIP_RETCODE | writeTikzNonzeros (SCIP *scip, FILE *file, PARTIALDECOMP *partialdec, float radius, int xmax, int ymax) |
| static SCIP_RETCODE | writeTexPartialdec (GCG *gcg, FILE *file, PARTIALDECOMP *partialdec, SCIP_Bool nofigure) |
| static SCIP_RETCODE | writeTexPartialdecStatistics (GCG *gcg, FILE *file, PARTIALDECOMP *partialdec) |
| static SCIP_RETCODE | writeTexEnding (SCIP *scip, FILE *file) |
| SCIP_RETCODE | GCGwriteTexReport (GCG *gcg, FILE *file, int *partialdecids, int *npartialdecs, SCIP_Bool titlepage, SCIP_Bool toc, SCIP_Bool statistics, SCIP_Bool usegp) |
| SCIP_RETCODE | GCGwriteTexVisualization (GCG *gcg, FILE *file, int partialdecid, SCIP_Bool statistics, SCIP_Bool usegp) |
| SCIP_RETCODE | GCGtexWriteMakefileAndReadme (GCG *gcg, FILE *file, SCIP_Bool usegp, SCIP_Bool compiletex) |
| SCIP_RETCODE | GCGincludeReaderTex (GCG *gcg) |
Macro Definition Documentation
◆ READER_NAME
| #define READER_NAME "texreader" |
Definition at line 55 of file reader_tex.cpp.
◆ READER_DESC
| #define READER_DESC "LaTeX file writer for partialdec visualization" |
Definition at line 56 of file reader_tex.cpp.
◆ READER_EXTENSION
| #define READER_EXTENSION "tex" |
Definition at line 57 of file reader_tex.cpp.
Function Documentation
◆ SCIP_DECL_READERFREE()
| SCIP_DECL_READERFREE | ( | readerFreeTex | ) |
Destructor of reader to free user data (called when SCIP is exiting)
Definition at line 68 of file reader_tex.cpp.
References assert(), and SCIPfreeMemory().
◆ SCIP_DECL_READERREAD()
| SCIP_DECL_READERREAD | ( | readerReadTex | ) |
Problem reading method of reader. Since the reader is not supposed to read files this returns a reading error.
Definition at line 82 of file reader_tex.cpp.
◆ SCIP_DECL_READERWRITE()
| SCIP_DECL_READERWRITE | ( | readerWriteTex | ) |
Problem writing method of reader
Definition at line 88 of file reader_tex.cpp.
References assert(), SCIP_ReaderData::gcg, GCGgetPartialdecToWrite(), GCGwriteTexVisualization(), gcg::PARTIALDECOMP::getID(), and result.
◆ getRgbFromHex()
|
static |
Outputs the r, g, b decimal values for the rgb hex input
- Returns
- SCIP status
- Parameters
-
hex input hex rgb code of form "#000000" red output decimal r green output decimal g blue output decimal b
Definition at line 121 of file reader_tex.cpp.
References assert(), and getRgbFromHex().
Referenced by getRgbFromHex(), and getTexColorFromHex().
◆ getTexColorFromHex()
|
static |
Converts a hex color code into a tex-conform line of code that defines the color as "colorname"
- Returns
- SCIP status
- Parameters
-
hex hex code for color colorname name of color code output resulting code line
Definition at line 154 of file reader_tex.cpp.
References getRgbFromHex(), and getTexColorFromHex().
Referenced by getTexColorFromHex(), and writeTexHeader().
◆ writeTexHeader()
|
static |
Write LaTeX code header & begin of document to given file
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file File pointer to write to externalizepics whether to use the tikz externalize package
Definition at line 194 of file reader_tex.cpp.
References GCGgetOrigprob(), GCGgetUseGp(), GCGvisuGetColorBlock(), GCGvisuGetColorLine(), GCGvisuGetColorLinking(), GCGvisuGetColorMasterconss(), GCGvisuGetColorMastervars(), GCGvisuGetColorNonzero(), GCGvisuGetColorOpen(), GCGvisuGetColorStairlinking(), getTexColorFromHex(), and writeTexHeader().
Referenced by GCGwriteTexReport(), GCGwriteTexVisualization(), and writeTexHeader().
◆ writeTexTitlepage()
|
static |
Write LaTeX code title page that includes general statistics about the problem to given file
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file File pointer to write to npresentedpartialdecs Number of decompositions to be shown in the file or NULL if unknown
Definition at line 297 of file reader_tex.cpp.
References GCGconshdlrDecompGetNDecomps(), GCGconshdlrDecompGetNPartialdecs(), GCGgetCurrentScore(), GCGgetOrigprob(), GCGscoreGetDesc(), and writeTexTitlepage().
Referenced by GCGwriteTexReport(), and writeTexTitlepage().
◆ writeTexTableOfContents()
|
static |
Write LaTeX code for table of contents to given file
- Returns
- SCIP status
- Parameters
-
scip SCIP data structure file File pointer to write to
Definition at line 363 of file reader_tex.cpp.
References writeTexTableOfContents().
Referenced by GCGwriteTexReport(), and writeTexTableOfContents().
◆ writeTikzBox()
|
static |
Writes tikz code for a box
- Returns
- SCIP status
- Parameters
-
scip SCIP data structure file File pointer to write to xmax maximum x axis value ymax maximum y axis value x1 x value of lower left vertex coordinate y1 y value of lower left vertex coordinate x2 x value of upper right vertex coordinate y2 y value of upper right vertex coordinate color color name of box color
Definition at line 381 of file reader_tex.cpp.
References writeTikzBox().
Referenced by writeTexPartialdec(), and writeTikzBox().
◆ writeTikzNonzeros()
|
static |
Writes tikz code for dots representing nonzeros
- Returns
- SCIP status
- Parameters
-
scip SCIP data structure file file to write to partialdec PARTIALDECOMP for which the nonzeros should be visualized radius radius of the dots xmax maximum x axis value ymax maximum y axis value
Definition at line 405 of file reader_tex.cpp.
References assert(), gcg::PARTIALDECOMP::getConssForBlock(), gcg::PARTIALDECOMP::getDetprobdata(), gcg::PARTIALDECOMP::getLinkingvars(), gcg::PARTIALDECOMP::getMasterconss(), gcg::PARTIALDECOMP::getMastervars(), gcg::PARTIALDECOMP::getNBlocks(), gcg::PARTIALDECOMP::getNConss(), gcg::PARTIALDECOMP::getNConssForBlock(), gcg::PARTIALDECOMP::getNLinkingvars(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNMastervars(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNOpenvars(), gcg::PARTIALDECOMP::getNStairlinkingvars(), gcg::PARTIALDECOMP::getNVars(), gcg::PARTIALDECOMP::getNVarsForBlock(), gcg::PARTIALDECOMP::getOpenconss(), gcg::PARTIALDECOMP::getOpenvars(), gcg::PARTIALDECOMP::getStairlinkingvars(), gcg::DETPROBDATA::getVal(), gcg::PARTIALDECOMP::getVarsForBlock(), i, and writeTikzNonzeros().
Referenced by writeTexPartialdec(), and writeTikzNonzeros().
◆ writeTexPartialdec()
|
static |
Writes LaTeX code that contains a figure with a tikz picture of the given partialdec
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file file to write to partialdec PARTIALDECOMP to be visualized nofigure if true there will be no figure environment around tikz code
Definition at line 527 of file reader_tex.cpp.
References GCGgetOrigprob(), GCGvisuGetDraftmode(), GCGvisuGetNonzeroRadius(), gcg::PARTIALDECOMP::getNBlocks(), gcg::PARTIALDECOMP::getNConss(), gcg::PARTIALDECOMP::getNConssForBlock(), gcg::PARTIALDECOMP::getNLinkingvars(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNMastervars(), gcg::PARTIALDECOMP::getNOpenconss(), gcg::PARTIALDECOMP::getNOpenvars(), gcg::PARTIALDECOMP::getNStairlinkingvars(), gcg::PARTIALDECOMP::getNVars(), gcg::PARTIALDECOMP::getNVarsForBlock(), nvars, writeTexPartialdec(), writeTikzBox(), and writeTikzNonzeros().
Referenced by GCGwriteTexReport(), GCGwriteTexVisualization(), and writeTexPartialdec().
◆ writeTexPartialdecStatistics()
|
static |
Writes LaTeX code for some statistics about the partialdec:
- amount of blocks
- amount of master, linking, stairlinking variables
- amount of master constraints
- score
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file file to write to partialdec statistics are about this partialdec
Definition at line 629 of file reader_tex.cpp.
References GCGdetectorGetName(), GCGgetCurrentScore(), GCGgetOrigprob(), gcg::PARTIALDECOMP::getDetectorchain(), gcg::PARTIALDECOMP::getNBlocks(), gcg::PARTIALDECOMP::getNLinkingvars(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNMastervars(), gcg::PARTIALDECOMP::getNTotalStairlinkingvars(), gcg::PARTIALDECOMP::getScore(), gcg::PARTIALDECOMP::getUsergiven(), gcg::NOT, and writeTexPartialdecStatistics().
Referenced by GCGwriteTexReport(), GCGwriteTexVisualization(), and writeTexPartialdecStatistics().
◆ writeTexEnding()
|
static |
Write LaTeX code for end of document to given file
- Returns
- SCIP status
- Parameters
-
scip SCIP data structure file File pointer to write to
Definition at line 681 of file reader_tex.cpp.
References writeTexEnding().
Referenced by GCGwriteTexReport(), GCGwriteTexVisualization(), and writeTexEnding().
◆ GCGwriteTexReport()
| SCIP_RETCODE GCGwriteTexReport | ( | GCG * | gcg, |
| FILE * | file, | ||
| int * | partialdecids, | ||
| int * | npartialdecs, | ||
| SCIP_Bool | titlepage, | ||
| SCIP_Bool | toc, | ||
| SCIP_Bool | statistics, | ||
| SCIP_Bool | usegp ) |
Writes a report for the given partialdecs
- Note
- *npartialdecs will be set to the number of actually written decompositions.
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file file in which to put the LaTeX code partialdecids ids of partialdecs to visualize npartialdecs number of partialdecs to visualize titlepage true if a title page should be included in the document toc true if an interactive table of contents should be included statistics true if statistics for each partialdec should be included usegp true if the gp reader should be used for the image generation
Definition at line 693 of file reader_tex.cpp.
References gcg::PARTIALDECOMP::buildDecChainString(), GCGconshdlrDecompGetPartialdecFromID(), GCGgetFilePath(), GCGgetOrigprob(), GCGgetVisualizationFilename(), GCGreportGetMaxNDecomps(), GCGtexWriteMakefileAndReadme(), GCGwriteGpVisualization(), GCGwriteTexReport(), gcg::PARTIALDECOMP::getID(), gcg::PARTIALDECOMP::getNBlocks(), i, writeTexEnding(), writeTexHeader(), writeTexPartialdec(), writeTexPartialdecStatistics(), writeTexTableOfContents(), and writeTexTitlepage().
Referenced by GCGwriteTexReport(), and reportAllDecompositions().
◆ GCGwriteTexVisualization()
| SCIP_RETCODE GCGwriteTexVisualization | ( | GCG * | gcg, |
| FILE * | file, | ||
| int | partialdecid, | ||
| SCIP_Bool | statistics, | ||
| SCIP_Bool | usegp ) |
Writes visualization LaTeX code for the given partialdec
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure file file in which to write the LaTeX code partialdecid id of partialdec to visualize statistics additionally to picture show statistics usegp true if the gp reader should be used for the image generation (instead of tikz)
Definition at line 785 of file reader_tex.cpp.
References GCGconshdlrDecompGetPartialdecFromID(), GCGgetOrigprob(), GCGgetVisualizationFilename(), GCGwriteGpVisualization(), GCGwriteTexVisualization(), writeTexEnding(), writeTexHeader(), writeTexPartialdec(), and writeTexPartialdecStatistics().
Referenced by GCGwriteTexVisualization(), and SCIP_DECL_READERWRITE().
◆ GCGtexWriteMakefileAndReadme()
| SCIP_RETCODE GCGtexWriteMakefileAndReadme | ( | GCG * | gcg, |
| FILE * | file, | ||
| SCIP_Bool | usegp, | ||
| SCIP_Bool | compiletex ) |
Makes a new makefile and readme for the given .tex file
- Returns
- SCIP status
- Parameters
-
gcg SCIP data structure file tex file for which the makefile & readme are generated usegp true if the gp reader was used for creation of images compiletex true if there are tex files to be compiled before main document
Definition at line 832 of file reader_tex.cpp.
References GCGgetFilePath(), GCGgetOrigprob(), and GCGtexWriteMakefileAndReadme().
Referenced by GCGtexWriteMakefileAndReadme(), and GCGwriteTexReport().
◆ GCGincludeReaderTex()
| SCIP_RETCODE GCGincludeReaderTex | ( | GCG * | gcg | ) |
Includes the tex file reader into SCIP
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure
Definition at line 959 of file reader_tex.cpp.
References assert(), SCIP_ReaderData::gcg, GCGgetOrigprob(), GCGincludeReaderTex(), origprob, READER_DESC, READER_EXTENSION, READER_NAME, and SCIP_CALL().
Referenced by GCGincludeGcgPlugins(), and GCGincludeReaderTex().