Scippy

GCG

Branch-and-Price & Column Generation for Everyone

reader_gp.cpp File Reference

Detailed Description

GP file reader writing decompositions to gnuplot files.

Author
Martin Bergner
Hanna Franzen
Michael Bastubbe

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 SCIP_DECL_READERFREE ( readerFreeGp  )
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()

◆ writeGpHeader()

static SCIP_RETCODE writeGpHeader ( GCG *  gcg,
const char *  filename,
const char *  outputname,
GP_OUTPUT_FORMAT  outputformat 
)
static

Write gnuplot file header with terminal etc.

Returns
SCIP status
Parameters
gcgGCG data structure
filenamefilename (including path) to write to
outputnamethe filename to which gnuplot should compile the visualization
outputformatthe 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 SCIP_RETCODE drawGpBox ( GCG *  gcg,
const char *  filename,
int  objectid,
int  x1,
int  y1,
int  x2,
int  y2,
const char *  color 
)
static

Adds gnuplot code to given file that contains a box with given coordinates and color

Returns
SCIP status
Parameters
gcgGCG data structure
filenamefilename (including path) to write to
objectidid number of box (>0), must be unique
x1x value of lower left vertex coordinate
y1y value of lower left vertex coordinate
x2x value of upper right vertex coordinate
y2y value of upper right vertex coordinate
colorcolor 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()

◆ writeGpPartialdec()

static SCIP_RETCODE writeGpPartialdec ( GCG *  gcg,
const char *  filename,
PARTIALDECOMP *  partialdec 
)
static

◆ GCGwriteGpVisualizationFormat()

SCIP_RETCODE GCGwriteGpVisualizationFormat ( GCG *  gcg,
const char *  filename,
const char *  outputname,
int  partialdecid,
GP_OUTPUT_FORMAT  outputformat 
)
Parameters
gcgGCG data structure
filenamefilename (including path) to write to
outputnamefilename for compiled output file
partialdecidid of partialdec to visualize
outputformatthe 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
gcgGCG data structure
filenamefilename (including path) to write to
outputnamefilename for compiled output file
partialdecidid 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
gcgGCG data structure
filenamefilename the output should be written to (including directory)
workfolderdirectory in which should be worked
originalmatrixshould 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
gcgGCG 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().