file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)
Definition in file reader_ppm.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_misc.h"
#include "scip/pub_reader.h"
#include "scip/pub_var.h"
#include "scip/reader_ppm.h"
#include "scip/scip_cons.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.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 "ppmreader" |
#define | READER_DESC "file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)" |
#define | READER_EXTENSION "ppm" |
#define | PPM_MAX_LINELEN 71 |
#define | DEFAULT_PPM_RGB_LIMIT 160 |
#define | DEFAULT_PPM_COEF_LIMIT 3 |
#define | DEFAULT_PPM_RGB_RELATIVE TRUE |
#define | DEFAULT_PPM_RGB_ASCII TRUE |
Functions | |
static void | initReaderdata (SCIP_READERDATA *readerdata) |
static SCIP_RETCODE | getActiveVariables (SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed) |
static void | clearLine (char *linebuffer, int *linecnt) |
static void | endLine (SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, char *linebuffer, int *linecnt) |
static void | appendLine (SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, char *linebuffer, int *linecnt, const char *extension) |
static void | calcColorValue (SCIP *scip, SCIP_READERDATA *readerdata, SCIP_Real coef, int *red, int *green, int *blue, SCIP_Real scale) |
static void | printRow (SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int ntotalvars, SCIP_Real maxcoef) |
static SCIP_RETCODE | printLinearCons (SCIP *scip, FILE *file, SCIP_READERDATA *readerdata, SCIP_VAR **vars, SCIP_Real *vals, int nvars, int ncompletevars, SCIP_Bool transformed, SCIP_Real *maxcoef, SCIP_Bool printbool) |
static | SCIP_DECL_READERCOPY (readerCopyPpm) |
static | SCIP_DECL_READERFREE (readerFreePpm) |
static | SCIP_DECL_READERWRITE (readerWritePpm) |
SCIP_RETCODE | SCIPincludeReaderPpm (SCIP *scip) |
SCIP_RETCODE | SCIPwritePpm (SCIP *scip, FILE *file, const char *name, SCIP_READERDATA *readerdata, SCIP_Bool transformed, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result) |
#define READER_NAME "ppmreader" |
Definition at line 55 of file reader_ppm.c.
#define READER_DESC "file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)" |
Definition at line 56 of file reader_ppm.c.
#define READER_EXTENSION "ppm" |
Definition at line 57 of file reader_ppm.c.
#define PPM_MAX_LINELEN 71 |
the maximum length of any line is 70 + '\0' = 71
Definition at line 62 of file reader_ppm.c.
Referenced by appendLine(), printRow(), and SCIPwritePpm().
#define DEFAULT_PPM_RGB_LIMIT 160 |
Definition at line 63 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
#define DEFAULT_PPM_COEF_LIMIT 3 |
Definition at line 64 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
#define DEFAULT_PPM_RGB_RELATIVE TRUE |
Definition at line 65 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
#define DEFAULT_PPM_RGB_ASCII TRUE |
Definition at line 66 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
|
static |
initializes the reader data
readerdata | reader data |
Definition at line 83 of file reader_ppm.c.
References assert(), DEFAULT_PPM_COEF_LIMIT, DEFAULT_PPM_RGB_ASCII, DEFAULT_PPM_RGB_LIMIT, DEFAULT_PPM_RGB_RELATIVE, and NULL.
Referenced by SCIPincludeReaderPpm().
|
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 inrc/scip/reader_ppm.c linear 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 98 of file reader_ppm.c.
References assert(), NULL, nvars, scalars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), TRUE, and vars.
Referenced by printLinearCons().
|
static |
clears the given line buffer
linebuffer | line |
linecnt | number of characters in line |
Definition at line 141 of file reader_ppm.c.
References assert(), and NULL.
Referenced by endLine(), printRow(), and SCIPwritePpm().
|
static |
ends the given line with '\0' and prints it to the given file stream
scip | SCIP data structure |
file | output file (or NULL for standard output) |
readerdata | information for reader |
linebuffer | line |
linecnt | number of characters in line |
Definition at line 155 of file reader_ppm.c.
References assert(), clearLine(), NULL, and SCIPinfoMessage().
Referenced by appendLine(), and printRow().
|
static |
appends extension to line and prints it to the give file stream if the line exceeded PPM_PRINTLEN
scip | SCIP data structure |
file | output file (or NULL for standard output) |
readerdata | information for reader |
linebuffer | line |
linecnt | number of characters in line |
extension | string to extent the line |
Definition at line 181 of file reader_ppm.c.
References assert(), endLine(), NULL, and PPM_MAX_LINELEN.
Referenced by printRow().
|
static |
calculates the color value for a given coefficient
scip | SCIP data structure |
readerdata | information for reader |
coef | coefficient to scale |
red | red part |
green | green part |
blue | blue part |
scale | maximal coefficient |
Definition at line 206 of file reader_ppm.c.
References assert(), NULL, SCIP_Real, and SCIPfloor().
Referenced by printRow().
|
static |
print row in PPM format to file stream
scip | SCIP data structure |
file | output file (or NULL for standard output) |
readerdata | information for reader |
vars | array of constraint variables |
vals | array of constraint values |
nvars | number of constraint variables |
ntotalvars | number of variables |
maxcoef | maximal coefficient |
Definition at line 268 of file reader_ppm.c.
References appendLine(), assert(), calcColorValue(), clearLine(), endLine(), i, NULL, nvars, PPM_MAX_LINELEN, REALABS, SCIP_Real, SCIPsnprintf(), SCIPvarGetProbindex(), and vars.
Referenced by printLinearCons().
|
static |
prints given linear constraint information in PPM format to file stream
scip | SCIP data structure |
file | output file (or NULL for standard output) |
readerdata | information for reader |
vars | array of variables |
vals | array of coefficients values (or NULL if all coefficient values are 1) |
nvars | number of variables |
ncompletevars | number of variables in whole problem |
transformed | transformed constraint? |
maxcoef | maximal coefficient |
printbool | print row or calculate maximum coefficient |
Definition at line 373 of file reader_ppm.c.
References assert(), getActiveVariables(), NULL, nvars, printRow(), REALABS, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, and vars.
Referenced by SCIPwritePpm().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 452 of file reader_ppm.c.
References assert(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderPpm(), and SCIPreaderGetName().
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 466 of file reader_ppm.c.
References assert(), NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().
|
static |
problem writing method of reader
Definition at line 481 of file reader_ppm.c.
References assert(), NULL, nvars, READER_NAME, result, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), SCIPreaderGetName(), SCIPwritePpm(), and vars.