Detailed Description
file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)
Definition in file reader_pbm.c.
#include "blockmemshell/memory.h"
#include "scip/cons_knapsack.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_varbound.h"
#include "scip/pub_cons.h"
#include "scip/pub_message.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.h"
#include "scip/reader_pbm.h"
#include "scip/scip_cons.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_param.h"
#include "scip/scip_reader.h"
#include "scip/scip_var.h"
#include <string.h>
Go to the source code of this file.
Macros | |
#define | READER_NAME "pbmreader" |
#define | READER_DESC "file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)" |
#define | READER_EXTENSION "pbm" |
#define | PBM_MAX_LINELEN 71 |
#define | DEFAULT_PBM_BINARY TRUE |
#define | DEFAULT_PBM_MAXROWS 1000 |
#define | DEFAULT_PBM_MAXCOLS 1000 |
#define | readerReadPbm NULL |
Functions | |
static SCIP_RETCODE | getActiveVariables (SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed) |
static SCIP_RETCODE | getActiveVariables2 (SCIP *scip, SCIP_VAR **vars, int *nvars, SCIP_Bool transformed) |
static void | clearLine (char *linebuffer, int *linecnt) |
static void | flushBits (SCIP *scip, FILE *file, unsigned char *bitcnt, unsigned char *bitbuffer) |
static void | appendBit (SCIP *scip, FILE *file, unsigned char bit, unsigned char *bitcnt, unsigned char *bitbuffer) |
static int | getSubmatrixSize (SCIP_READERDATA *readerdata, int nvars, int nconss) |
static void | printRow (SCIP *scip, SCIP_READERDATA *readerdata, SCIP_VAR **vars, int conscnt, int nvars, int submatrixsize, int *scaledimage) |
static SCIP_RETCODE | printLinearCons (SCIP *scip, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int conscnt, SCIP_Bool transformed, int submatrixsize, int *scaledimage) |
static void | drawScaledImage (SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, int *scaledimage) |
static | SCIP_DECL_READERCOPY (readerCopyPbm) |
static | SCIP_DECL_READERFREE (readerFreePbm) |
static | SCIP_DECL_READERWRITE (readerWritePbm) |
SCIP_RETCODE | SCIPincludeReaderPbm (SCIP *scip) |
SCIP_RETCODE | SCIPwritePbm (SCIP *scip, FILE *file, const char *name, SCIP_READERDATA *readerdata, SCIP_Bool transformed, int nvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "pbmreader" |
Definition at line 44 of file reader_pbm.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERWRITE(), and SCIPincludeReaderPbm().
◆ READER_DESC
#define READER_DESC "file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)" |
Definition at line 45 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
◆ READER_EXTENSION
#define READER_EXTENSION "pbm" |
Definition at line 46 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
◆ PBM_MAX_LINELEN
#define PBM_MAX_LINELEN 71 |
the maximum length of any line is 70 + '\0' = 71
Definition at line 51 of file reader_pbm.c.
Referenced by SCIPwritePbm().
◆ DEFAULT_PBM_BINARY
#define DEFAULT_PBM_BINARY TRUE |
binary is the default format for PBM
Definition at line 52 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
◆ DEFAULT_PBM_MAXROWS
#define DEFAULT_PBM_MAXROWS 1000 |
allowed maximum of pixel-rows int the picture
Definition at line 53 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
◆ DEFAULT_PBM_MAXCOLS
#define DEFAULT_PBM_MAXCOLS 1000 |
allowed maximum of pixel-columns in the picture
Definition at line 54 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
◆ readerReadPbm
#define readerReadPbm NULL |
problem reading method of reader
Definition at line 423 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
Function Documentation
◆ getActiveVariables()
|
static |
transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant
- Parameters
-
scip SCIP data structure vars vars array to get active variables for scalars scalars a_1, ..., a_n in sum a_1*x_1 + ... + a_n*x_n + c nvars pointer to number of variables and values in vars and vals array constant pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c transformed transformed constraint?
Definition at line 70 of file reader_pbm.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.
Referenced by printLinearCons().
◆ getActiveVariables2()
|
static |
transforms given variables to the corresponding active variables
- Parameters
-
scip SCIP data structure vars vars array to get active variables for nvars pointer to number of variables and values in vars and vals array transformed transformed constraint?
Definition at line 114 of file reader_pbm.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetActiveVars(), SCIPreallocBufferArray, and SCIPvarGetOrigvarSum().
Referenced by SCIPwritePbm().
◆ clearLine()
|
static |
clears the given line buffer
- Parameters
-
linebuffer line linecnt number of characters in line
Definition at line 157 of file reader_pbm.c.
References NULL.
Referenced by SCIPwritePbm().
◆ flushBits()
|
static |
appends a bit to buffer and prints it to the give file stream if we've gather a whole byte
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) bitcnt counts bits until whole byte is gathered bitbuffer bit buffer
Definition at line 172 of file reader_pbm.c.
References NULL.
Referenced by appendBit(), and drawScaledImage().
◆ appendBit()
|
static |
appends a bit to buffer and prints it to the given file stream if we've gathered a whole byte
- Parameters
-
scip SCIP data structure file output file (or NULL for standard output) bit bit to append bitcnt counts bits until whole byte is gathered bitbuffer bit buffer
Definition at line 198 of file reader_pbm.c.
References flushBits(), and NULL.
Referenced by drawScaledImage().
◆ getSubmatrixSize()
|
static |
calculates the size of the quadratic matrix, which will correspond to one pixel in the picture
- Parameters
-
readerdata information for reader nvars number of variables nconss number of constraints
Definition at line 219 of file reader_pbm.c.
Referenced by SCIPwritePbm().
◆ printRow()
|
static |
print row in PBM format to file stream
- Parameters
-
scip SCIP data structure readerdata information for reader vars array of constraint variables conscnt current constraint nvars number of constraint variables submatrixsize size of the submatrices scaledimage array of ints that count variables in every submatrix
Definition at line 267 of file reader_pbm.c.
References NULL, SCIPvarGetProbindex(), x, and y.
Referenced by printLinearCons(), and SCIPwritePbm().
◆ printLinearCons()
|
static |
prints given linear constraint information in PBM format to file stream
- Parameters
-
scip SCIP data structure readerdata information for reader vars array of variables vals array of coefficients values (or NULL if all coefficient values are 1) nvars current constraint conscnt counts variables in the constraint transformed transformed constraint? submatrixsize size of the submatrices scaledimage array of ints that count variables in every submatrix
Definition at line 303 of file reader_pbm.c.
References getActiveVariables(), NULL, printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, and SCIPfreeBufferArray.
Referenced by SCIPwritePbm().
◆ drawScaledImage()
|
static |
- Parameters
-
scip SCIP data structure file output file, or NULL if standard output should be used readerdata information for reader scaledimage array of ints that count variables in every submatrix
Definition at line 357 of file reader_pbm.c.
References appendBit(), flushBits(), NULL, x, and y.
Referenced by SCIPwritePbm().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 394 of file reader_pbm.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderPbm(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 408 of file reader_pbm.c.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 427 of file reader_pbm.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), SCIPreaderGetName(), and SCIPwritePbm().