Detailed Description
GP file reader writing decompositions to gnuplot files.
Definition in file reader_gp.cpp.
#include <assert.h>#include <string.h>#include <cstring>#include <fstream>#include "scip/scip.h"#include "gcg/reader_gp.h"#include "gcg/scip_misc.h"#include "gcg/struct_decomp.h"#include "gcg/cons_decomp.h"#include "gcg/cons_decomp.hpp"#include "gcg/pub_decomp.h"#include "gcg/params_visu.h"#include "gcg/class_partialdecomp.h"#include "gcg/class_detprobdata.h"#include "gcg/miscvisualization.h"Go to the source code of this file.
Data Structures | |
| struct | SCIP_ReaderData |
Macros | |
| #define | READER_NAME "gpreader" |
| #define | READER_DESC "gnuplot file writer for partialdec visualization" |
| #define | READER_EXTENSION "gp" |
| #define | SCALING_FACTOR_NONZEROS 0.6 |
Functions | |
| static | SCIP_DECL_READERFREE (readerFreeGp) |
| static | SCIP_DECL_READERWRITE (readerWriteGp) |
| static SCIP_RETCODE | writeGpHeader (GCG *gcg, const char *filename, const char *outputname, GP_OUTPUT_FORMAT outputformat) |
| static SCIP_RETCODE | drawGpBox (GCG *gcg, const char *filename, int objectid, int x1, int y1, int x2, int y2, const char *color) |
| static SCIP_RETCODE | writeGpNonzeros (GCG *gcg, const char *filename, PARTIALDECOMP *partialdec, float radius) |
| static SCIP_RETCODE | writeGpPartialdec (GCG *gcg, const char *filename, PARTIALDECOMP *partialdec) |
| Adds the gnuplot body of the partialdec visualization to the given file. More... | |
| SCIP_RETCODE | GCGwriteGpVisualizationFormat (GCG *gcg, const char *filename, const char *outputname, int partialdecid, GP_OUTPUT_FORMAT outputformat) |
| SCIP_RETCODE | GCGwriteGpVisualization (GCG *gcg, const char *filename, const char *outputname, int partialdecid) |
| SCIP_RETCODE | GCGWriteGpDecompMatrix (GCG *gcg, const char *filename, const char *workfolder, SCIP_Bool originalmatrix) |
| SCIP_RETCODE | GCGincludeReaderGp (GCG *gcg) |
Macro Definition Documentation
◆ READER_NAME
| #define READER_NAME "gpreader" |
Definition at line 58 of file reader_gp.cpp.
◆ READER_DESC
| #define READER_DESC "gnuplot file writer for partialdec visualization" |
Definition at line 59 of file reader_gp.cpp.
◆ READER_EXTENSION
| #define READER_EXTENSION "gp" |
Definition at line 60 of file reader_gp.cpp.
◆ SCALING_FACTOR_NONZEROS
| #define SCALING_FACTOR_NONZEROS 0.6 |
Definition at line 62 of file reader_gp.cpp.
Function Documentation
◆ SCIP_DECL_READERFREE()
|
static |
Destructor of reader to free user data (called when SCIP is exiting)
Definition at line 78 of file reader_gp.cpp.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeMemory, SCIPreaderGetData(), and SCIPreaderGetName().
◆ SCIP_DECL_READERWRITE()
|
static |
Problem writing method of reader
Definition at line 93 of file reader_gp.cpp.
References SCIP_ReaderData::gcg, GCGgetFilePath(), GCGgetPartialdecToWrite(), GCGgetVisualizationFilename(), GCGwriteGpVisualization(), gcg::PARTIALDECOMP::getID(), NULL, SCIP_DIDNOTRUN, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_SUCCESS, SCIPreaderGetData(), SCIPstrncpy(), and SCIPwarningMessage().
◆ writeGpHeader()
|
static |
Write gnuplot file header with terminal etc.
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure filename filename (including path) to write to outputname the filename to which gnuplot should compile the visualization outputformat the output format which gnuplot should emit
Definition at line 146 of file reader_gp.cpp.
References GP_OUTPUT_FORMAT_PDF, GP_OUTPUT_FORMAT_PNG, GP_OUTPUT_FORMAT_SVG, and SCIP_OKAY.
Referenced by GCGwriteGpVisualizationFormat().
◆ drawGpBox()
|
static |
Adds gnuplot code to given file that contains a box with given coordinates and color
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure filename filename (including path) to write to objectid id number of box (>0), must be unique 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 hex code (e.g. #000000) for box filling
Definition at line 186 of file reader_gp.cpp.
References GCGvisuGetColorLine(), and SCIP_OKAY.
Referenced by writeGpPartialdec().
◆ writeGpNonzeros()
|
static |
Writes gnuplot code to given file that contains all nonzero points
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure filename filename to write to (including path & extension) partialdec PARTIALDECOMP for which the nonzeros should be visualized radius radius of the dots (scaled concerning matrix dimensions)
Definition at line 211 of file reader_gp.cpp.
References b, GCGgetOrigprob(), GCGvisuGetColorNonzero(), 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::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getOpenconss(), gcg::PARTIALDECOMP::getOpenvars(), gcg::PARTIALDECOMP::getStairlinkingvars(), gcg::PARTIALDECOMP::getVarsForBlock(), gcg::DETPROBDATA::getVarsForCons(), SCIP_OKAY, and SCIPgetIntParam().
Referenced by writeGpPartialdec().
◆ writeGpPartialdec()
|
static |
Adds the gnuplot body of the partialdec visualization to the given file.
Adds the gnuplot body of the partialdec visualization to the given file. This includes axes, blocks and nonzeros.
- Parameters
-
gcg GCG data structure filename filename (including path) to write to partialdec PARTIALDECOMP for which the nonzeros should be visualized
Definition at line 352 of file reader_gp.cpp.
References b, drawGpBox(), FALSE, GCGvisuGetColorBlock(), GCGvisuGetColorLinking(), GCGvisuGetColorMasterconss(), GCGvisuGetColorOpen(), GCGvisuGetColorStairlinking(), 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(), gcg::PARTIALDECOMP::isComplete(), SCALING_FACTOR_NONZEROS, SCIP_Bool, SCIP_OKAY, TRUE, and writeGpNonzeros().
Referenced by GCGwriteGpVisualizationFormat().
◆ GCGwriteGpVisualizationFormat()
| SCIP_RETCODE GCGwriteGpVisualizationFormat | ( | GCG * | gcg, |
| const char * | filename, | ||
| const char * | outputname, | ||
| int | partialdecid, | ||
| GP_OUTPUT_FORMAT | outputformat | ||
| ) |
- Parameters
-
gcg GCG data structure filename filename (including path) to write to outputname filename for compiled output file partialdecid id of partialdec to visualize outputformat the output format which gnuplot should emit
Definition at line 476 of file reader_gp.cpp.
References GCGconshdlrDecompGetPartialdecFromID(), gcg::PARTIALDECOMP::getDetprobdata(), NULL, SCIP_ERROR, SCIP_OKAY, SCIPerrorMessage, writeGpHeader(), and writeGpPartialdec().
Referenced by GCGwriteGpVisualization(), and gcg::PARTIALDECOMP::writeVisualizationFile().
◆ GCGwriteGpVisualization()
| SCIP_RETCODE GCGwriteGpVisualization | ( | GCG * | gcg, |
| const char * | filename, | ||
| const char * | outputname, | ||
| int | partialdecid | ||
| ) |
Writes a visualization as .pdf file for the given partialdec
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure filename filename (including path) to write to outputname filename for compiled output file partialdecid id of partialdec to visualize
Definition at line 510 of file reader_gp.cpp.
References GCGwriteGpVisualizationFormat(), and GP_OUTPUT_FORMAT_PDF.
Referenced by gcg::PARTIALDECOMP::exportVisualization(), GCGWriteGpDecompMatrix(), GCGwriteTexReport(), GCGwriteTexVisualization(), and SCIP_DECL_READERWRITE().
◆ GCGWriteGpDecompMatrix()
| SCIP_RETCODE GCGWriteGpDecompMatrix | ( | GCG * | gcg, |
| const char * | filename, | ||
| const char * | workfolder, | ||
| SCIP_Bool | originalmatrix | ||
| ) |
Creates a block matrix and outputs its visualization as .pdf file
- Returns
- SCIP return code
- Parameters
-
gcg GCG data structure filename filename the output should be written to (including directory) workfolder directory in which should be worked originalmatrix should the original (or transformed) matrix be written
Definition at line 523 of file reader_gp.cpp.
References GCGconshdlrDecompAddMatrixPartialdec(), GCGconshdlrDecompGetPartialdecFromID(), GCGgetOrigprob(), GCGgetVisualizationFilename(), GCGwriteGpVisualization(), NULL, SCIP_MAXSTRLEN, SCIP_OKAY, and SCIPinfoMessage().
Referenced by writeMatrix().
◆ GCGincludeReaderGp()
| SCIP_RETCODE GCGincludeReaderGp | ( | GCG * | gcg | ) |
Includes the gp file reader into SCIP
- Returns
- SCIP status
- Parameters
-
gcg GCG data structure
Definition at line 554 of file reader_gp.cpp.
References SCIP_ReaderData::gcg, GCGgetOrigprob(), NULL, READER_DESC, READER_EXTENSION, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPallocMemory, and SCIPincludeReader().
Referenced by GCGincludeGcgPlugins().