Detailed Description
tex file reader for writing partialdecs to LaTeX files
Definition in file reader_tex.cpp.
#include <cassert>
#include <cstring>
#include <strings.h>
#include <cstdio>
#include <vector>
#include <sstream>
#include <algorithm>
#include "reader_tex.h"
#include "scip_misc.h"
#include "reader_gp.h"
#include "cons_decomp.h"
#include "cons_decomp.hpp"
#include "pub_decomp.h"
#include "miscvisualization.h"
#include "class_partialdecomp.h"
#include "class_detprobdata.h"
#include "params_visu.h"
#include "scoretype.h"
Go to the source code of this file.
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 (SCIP *scip, FILE *file, SCIP_Bool externalizepics) |
static SCIP_RETCODE | writeTexTitlepage (SCIP *scip, 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 (SCIP *scip, FILE *file, PARTIALDECOMP *partialdec, SCIP_Bool nofigure) |
static SCIP_RETCODE | writeTexPartialdecStatistics (SCIP *scip, FILE *file, PARTIALDECOMP *partialdec) |
static SCIP_RETCODE | writeTexEnding (SCIP *scip, FILE *file) |
SCIP_RETCODE | GCGwriteTexReport (SCIP *scip, FILE *file, int *partialdecids, int *npartialdecs, SCIP_Bool titlepage, SCIP_Bool toc, SCIP_Bool statistics, SCIP_Bool usegp) |
SCIP_RETCODE | GCGwriteTexVisualization (SCIP *scip, FILE *file, int partialdecid, SCIP_Bool statistics, SCIP_Bool usegp) |
SCIP_RETCODE | GCGtexWriteMakefileAndReadme (SCIP *scip, FILE *file, SCIP_Bool usegp, SCIP_Bool compiletex) |
SCIP_RETCODE | SCIPincludeReaderTex (SCIP *scip) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "texreader" |
Definition at line 59 of file reader_tex.cpp.
◆ READER_DESC
#define READER_DESC "LaTeX file writer for partialdec visualization" |
Definition at line 60 of file reader_tex.cpp.
◆ READER_EXTENSION
#define READER_EXTENSION "tex" |
Definition at line 61 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 66 of file reader_tex.cpp.
◆ 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 73 of file reader_tex.cpp.
◆ SCIP_DECL_READERWRITE()
SCIP_DECL_READERWRITE | ( | readerWriteTex | ) |
Problem writing method of reader
Definition at line 79 of file reader_tex.cpp.
References DECgetPartialdecToWrite(), RefInput::file, GCGwriteTexVisualization(), and gcg::PARTIALDECOMP::getID().
◆ 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 108 of file reader_tex.cpp.
Referenced by 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 141 of file reader_tex.cpp.
References getRgbFromHex().
Referenced by writeTexHeader().
◆ writeTexHeader()
|
static |
Write LaTeX code header & begin of document to given file
- Returns
- SCIP status
- Parameters
-
scip SCIP data structure file File pointer to write to externalizepics whether to use the tikz externalize package
Definition at line 181 of file reader_tex.cpp.
References RefInput::file, GCGgetUseGp(), getTexColorFromHex(), SCIPvisuGetColorBlock(), SCIPvisuGetColorLine(), SCIPvisuGetColorLinking(), SCIPvisuGetColorMasterconss(), SCIPvisuGetColorMastervars(), SCIPvisuGetColorNonzero(), SCIPvisuGetColorOpen(), and SCIPvisuGetColorStairlinking().
Referenced by GCGwriteTexReport(), and GCGwriteTexVisualization().
◆ writeTexTitlepage()
|
static |
Write LaTeX code title page that includes general statistics about the problem to given file
- Returns
- SCIP status
- Parameters
-
scip SCIP 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 282 of file reader_tex.cpp.
References RefInput::file, GCGconshdlrDecompGetNDecomps(), GCGconshdlrDecompGetNPartialdecs(), GCGconshdlrDecompGetScoretype(), and GCGscoretypeGetDescription().
Referenced by GCGwriteTexReport().
◆ 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 347 of file reader_tex.cpp.
References RefInput::file.
Referenced by GCGwriteTexReport().
◆ 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 365 of file reader_tex.cpp.
References RefInput::file.
Referenced by writeTexPartialdec().
◆ 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 389 of file reader_tex.cpp.
References RefInput::file, 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(), and gcg::PARTIALDECOMP::getVarsForBlock().
Referenced by writeTexPartialdec().
◆ writeTexPartialdec()
|
static |
Writes LaTeX code that contains a figure with a tikz picture of the given partialdec
- Returns
- SCIP status
- Parameters
-
scip SCIP 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 511 of file reader_tex.cpp.
References RefInput::file, 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(), SCIPvisuGetDraftmode(), SCIPvisuGetNonzeroRadius(), writeTikzBox(), and writeTikzNonzeros().
Referenced by GCGwriteTexReport(), and GCGwriteTexVisualization().
◆ 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
-
scip SCIP data structure file file to write to partialdec statistics are about this partialdec
Definition at line 612 of file reader_tex.cpp.
References DECdetectorGetName(), RefInput::file, GCGconshdlrDecompGetScoretype(), gcg::PARTIALDECOMP::getDetectorchain(), gcg::PARTIALDECOMP::getNBlocks(), gcg::PARTIALDECOMP::getNLinkingvars(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNMastervars(), gcg::PARTIALDECOMP::getNTotalStairlinkingvars(), gcg::PARTIALDECOMP::getScore(), gcg::PARTIALDECOMP::getUsergiven(), and gcg::NOT.
Referenced by GCGwriteTexReport(), and GCGwriteTexVisualization().
◆ 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 663 of file reader_tex.cpp.
References RefInput::file.
Referenced by GCGwriteTexReport(), and GCGwriteTexVisualization().
◆ GCGwriteTexReport()
SCIP_RETCODE GCGwriteTexReport | ( | SCIP * | scip, |
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
Definition at line 675 of file reader_tex.cpp.
References gcg::PARTIALDECOMP::buildDecChainString(), RefInput::file, GCGconshdlrDecompGetPartialdecFromID(), GCGconshdlrDecompGetScoretype(), GCGgetFilePath(), GCGgetVisualizationFilename(), GCGreportGetMaxNDecomps(), GCGtexWriteMakefileAndReadme(), GCGwriteGpVisualization(), gcg::PARTIALDECOMP::getID(), gcg::PARTIALDECOMP::getNBlocks(), writeTexEnding(), writeTexHeader(), writeTexPartialdec(), writeTexPartialdecStatistics(), writeTexTableOfContents(), and writeTexTitlepage().
Referenced by reportAllDecompositions().
◆ GCGwriteTexVisualization()
SCIP_RETCODE GCGwriteTexVisualization | ( | SCIP * | scip, |
FILE * | file, | ||
int | partialdecid, | ||
SCIP_Bool | statistics, | ||
SCIP_Bool | usegp | ||
) |
Writes visualization LaTeX code for the given partialdec
- Returns
- SCIP status
Definition at line 767 of file reader_tex.cpp.
References RefInput::file, GCGconshdlrDecompGetPartialdecFromID(), GCGgetVisualizationFilename(), GCGwriteGpVisualization(), writeTexEnding(), writeTexHeader(), writeTexPartialdec(), and writeTexPartialdecStatistics().
Referenced by SCIP_DECL_READERWRITE().
◆ GCGtexWriteMakefileAndReadme()
SCIP_RETCODE GCGtexWriteMakefileAndReadme | ( | SCIP * | scip, |
FILE * | file, | ||
SCIP_Bool | usegp, | ||
SCIP_Bool | compiletex | ||
) |
Makes a new makefile and readme for the given .tex file
- Returns
- SCIP status
Definition at line 813 of file reader_tex.cpp.
References RefInput::file, and GCGgetFilePath().
Referenced by GCGwriteTexReport().
◆ SCIPincludeReaderTex()
SCIP_RETCODE SCIPincludeReaderTex | ( | SCIP * | scip | ) |
Includes the tex file reader into SCIP
- Returns
- SCIP status
Definition at line 939 of file reader_tex.cpp.
References READER_DESC, READER_EXTENSION, and READER_NAME.
Referenced by SCIPincludeGcgPlugins().