file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)
Definition in file reader_pbm.c.
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "scip/reader_pbm.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_misc.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) |
#define READER_NAME "pbmreader" |
Definition at line 36 of file reader_pbm.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERWRITE(), and SCIPincludeReaderPbm().
#define READER_DESC "file writer for portable bitmap file format (PBM), open with common graphic viewer programs (e.g. xview)" |
Definition at line 37 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
#define READER_EXTENSION "pbm" |
Definition at line 38 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
#define PBM_MAX_LINELEN 71 |
the maximum length of any line is 70 + '\0' = 71
Definition at line 43 of file reader_pbm.c.
Referenced by SCIPwritePbm().
#define DEFAULT_PBM_BINARY TRUE |
binary is the default format for PBM
Definition at line 44 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
#define DEFAULT_PBM_MAXROWS 1000 |
allowed maximum of pixel-rows int the picture
Definition at line 45 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
#define DEFAULT_PBM_MAXCOLS 1000 |
allowed maximum of pixel-columns in the picture
Definition at line 46 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
#define readerReadPbm NULL |
problem reading method of reader
Definition at line 414 of file reader_pbm.c.
Referenced by SCIPincludeReaderPbm().
|
static |
transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant
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 62 of file reader_pbm.c.
References SCIP_CALL, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.
Referenced by printLinearCons().
|
static |
transforms given variables to the corresponding active variables
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 106 of file reader_pbm.c.
References SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetActiveVars(), SCIPreallocBufferArray, and SCIPvarGetOrigvarSum().
Referenced by SCIPwritePbm().
|
static |
clears the given line buffer
linebuffer | line |
linecnt | number of characters in line |
Definition at line 149 of file reader_pbm.c.
Referenced by SCIPwritePbm().
|
static |
appends a bit to buffer and prints it to the give file stream if we've gather a whole byte
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 164 of file reader_pbm.c.
Referenced by appendBit(), and drawScaledImage().
|
static |
appends a bit to buffer and prints it to the given file stream if we've gathered a whole byte
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 190 of file reader_pbm.c.
References flushBits().
Referenced by drawScaledImage().
|
static |
calculates the size of the quadratic matrix, which will correspond to one pixel in the picture
readerdata | information for reader |
nvars | number of variables |
nconss | number of constraints |
Definition at line 211 of file reader_pbm.c.
Referenced by SCIPwritePbm().
|
static |
print row in PBM format to file stream
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 259 of file reader_pbm.c.
References SCIPvarGetProbindex().
Referenced by printLinearCons(), and SCIPwritePbm().
|
static |
prints given linear constraint information in PBM format to file stream
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 293 of file reader_pbm.c.
References getActiveVariables(), printRow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, and SCIPfreeBufferArray.
Referenced by SCIPwritePbm().
|
static |
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 347 of file reader_pbm.c.
References appendBit(), and flushBits().
Referenced by SCIPwritePbm().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 385 of file reader_pbm.c.
References READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderPbm(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 399 of file reader_pbm.c.
References READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().
|
static |
problem writing method of reader
Definition at line 418 of file reader_pbm.c.
References READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), SCIPreaderGetName(), and SCIPwritePbm().