Detailed Description
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) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "ppmreader" |
Definition at line 46 of file reader_ppm.c.
Referenced by SCIP_DECL_READERCOPY(), SCIP_DECL_READERFREE(), SCIP_DECL_READERWRITE(), and SCIPincludeReaderPpm().
◆ READER_DESC
#define READER_DESC "file writer for portable pixmap file format (PPM), open with common graphic viewer programs (e.g. xview)" |
Definition at line 47 of file reader_ppm.c.
Referenced by SCIPincludeReaderPpm().
◆ READER_EXTENSION
#define READER_EXTENSION "ppm" |
Definition at line 48 of file reader_ppm.c.
Referenced by SCIPincludeReaderPpm().
◆ PPM_MAX_LINELEN
#define PPM_MAX_LINELEN 71 |
the maximum length of any line is 70 + '\0' = 71
Definition at line 53 of file reader_ppm.c.
Referenced by appendLine(), printRow(), and SCIPwritePpm().
◆ DEFAULT_PPM_RGB_LIMIT
#define DEFAULT_PPM_RGB_LIMIT 160 |
Definition at line 54 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
◆ DEFAULT_PPM_COEF_LIMIT
#define DEFAULT_PPM_COEF_LIMIT 3 |
Definition at line 55 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
◆ DEFAULT_PPM_RGB_RELATIVE
#define DEFAULT_PPM_RGB_RELATIVE TRUE |
Definition at line 56 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
◆ DEFAULT_PPM_RGB_ASCII
#define DEFAULT_PPM_RGB_ASCII TRUE |
Definition at line 57 of file reader_ppm.c.
Referenced by initReaderdata(), and SCIPincludeReaderPpm().
Function Documentation
◆ initReaderdata()
|
static |
initializes the reader data
- Parameters
-
readerdata reader data
Definition at line 74 of file reader_ppm.c.
References DEFAULT_PPM_COEF_LIMIT, DEFAULT_PPM_RGB_ASCII, DEFAULT_PPM_RGB_LIMIT, DEFAULT_PPM_RGB_RELATIVE, and NULL.
Referenced by SCIPincludeReaderPpm().
◆ 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 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 89 of file reader_ppm.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.
Referenced by printLinearCons().
◆ clearLine()
|
static |
clears the given line buffer
- Parameters
-
linebuffer line linecnt number of characters in line
Definition at line 132 of file reader_ppm.c.
References NULL.
Referenced by endLine(), printRow(), and SCIPwritePpm().
◆ endLine()
|
static |
ends the given line with '\0' and prints it to the given file stream
- Parameters
-
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 146 of file reader_ppm.c.
References clearLine(), NULL, and SCIPinfoMessage().
Referenced by appendLine(), and printRow().
◆ appendLine()
|
static |
appends extension to line and prints it to the give file stream if the line exceeded PPM_PRINTLEN
- Parameters
-
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 172 of file reader_ppm.c.
References endLine(), NULL, and PPM_MAX_LINELEN.
Referenced by printRow().
◆ calcColorValue()
|
static |
calculates the color value for a given coefficient
- Parameters
-
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 197 of file reader_ppm.c.
References NULL, SCIP_Real, and SCIPfloor().
Referenced by printRow().
◆ printRow()
|
static |
print row in PPM format to file stream
- Parameters
-
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 259 of file reader_ppm.c.
References appendLine(), calcColorValue(), clearLine(), endLine(), NULL, PPM_MAX_LINELEN, REALABS, SCIPsnprintf(), and SCIPvarGetProbindex().
Referenced by printLinearCons().
◆ printLinearCons()
|
static |
prints given linear constraint information in PPM format to file stream
- Parameters
-
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 364 of file reader_ppm.c.
References getActiveVariables(), NULL, printRow(), REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, and SCIPfreeBufferArray.
Referenced by SCIPwritePpm().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 443 of file reader_ppm.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderPpm(), and SCIPreaderGetName().
◆ SCIP_DECL_READERFREE()
|
static |
destructor of reader to free user data (called when SCIP is exiting)
Definition at line 457 of file reader_ppm.c.
References NULL, READER_NAME, SCIP_OKAY, SCIPfreeBlockMemory, SCIPreaderGetData(), and SCIPreaderGetName().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 472 of file reader_ppm.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPreaderGetData(), SCIPreaderGetName(), and SCIPwritePpm().