Graph file reader (actually, only a writer).
Write a weighted column/variable graph, i.e., the nodes correspond to the columns (variables) of the constraint matrix. Two nodes are adjacent if the corresponding columns/variables appear in a common row/constraint (with nonzero coefficient). The weight is obtained by summing for each row that produces an edge the absolute values of coefficients in the row; hence, we avoid parallel edges.
This graph gives an indication of the connectivity structure of the constraint matrix.
The graph is output in DIMACS graph format.
Definition in file reader_ccg.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_ccg.h"#include "scip/scip_cons.h"#include "scip/scip_mem.h"#include "scip/scip_message.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 "ccgreader" |
| #define | READER_DESC "file writer for column connectivity graph file format" |
| #define | READER_EXTENSION "ccg" |
Functions | |
| static SCIP_RETCODE | initGraph (SCIP *scip, SparseGraph *G, unsigned int nNodes, unsigned int initSize) |
| static void | freeGraph (SCIP *scip, SparseGraph *G) |
| static SCIP_RETCODE | ensureEdgeCapacity (SCIP *scip, SparseGraph *G, unsigned int node) |
| static SCIP_RETCODE | getActiveVariables (SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed) |
| static SCIP_RETCODE | createEdgesFromRow (SCIP *scip, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SparseGraph *G) |
| static SCIP_RETCODE | handleLinearCons (SCIP *scip, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool transformed, SparseGraph *G) |
| static | SCIP_DECL_READERCOPY (readerCopyCcg) |
| static | SCIP_DECL_READERWRITE (readerWriteCcg) |
| SCIP_RETCODE | SCIPincludeReaderCcg (SCIP *scip) |
| SCIP_RETCODE | SCIPwriteCcg (SCIP *scip, FILE *file, const char *name, SCIP_Bool transformed, SCIP_VAR **vars, int nvars, SCIP_CONS **conss, int nconss, SCIP_RESULT *result) |
| #define READER_NAME "ccgreader" |
Definition at line 61 of file reader_ccg.c.
| #define READER_DESC "file writer for column connectivity graph file format" |
Definition at line 62 of file reader_ccg.c.
| #define READER_EXTENSION "ccg" |
Definition at line 63 of file reader_ccg.c.
| typedef struct sparseGraph SparseGraph |
Definition at line 81 of file reader_ccg.c.
|
static |
initialize graph
| scip | SCIP data structure |
| G | graph to free |
| nNodes | number of nodes |
| initSize | initial size of lists |
Definition at line 90 of file reader_ccg.c.
References i, SCIP_CALL, SCIP_OKAY, and SCIPallocBufferArray.
Referenced by SCIPwriteCcg().
|
static |
frees graph
Definition at line 124 of file reader_ccg.c.
References i, and SCIPfreeBufferArray.
Referenced by SCIPwriteCcg().
|
static |
check whether there is enough capacity for one additional edge in the given adjacency list
Definition at line 146 of file reader_ccg.c.
References SCIP_CALL, SCIP_OKAY, and SCIPreallocBufferArray.
Referenced by createEdgesFromRow().
|
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_graph.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 167 of file reader_ccg.c.
References assert(), NULL, nvars, scalars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and vars.
Referenced by handleLinearCons().
|
static |
| scip | SCIP data structure |
| vars | array of constraint variables |
| vals | array of constraint values |
| nvars | number of constraint variables |
| G | graph |
Definition at line 212 of file reader_ccg.c.
References a, ABS, assert(), ensureEdgeCapacity(), i, NULL, nvars, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPvarGetProbindex(), vars, and w.
Referenced by handleLinearCons().
|
static |
handle given linear constraint information
| scip | SCIP data structure |
| vars | array of variables |
| vals | array of coefficients values (or NULL if all coefficient values are 1) |
| nvars | number of variables |
| transformed | transformed constraint? |
| G | graph |
Definition at line 298 of file reader_ccg.c.
References assert(), createEdgesFromRow(), getActiveVariables(), NULL, nvars, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, SCIPfreeBufferArray, and vars.
Referenced by SCIPwriteCcg().
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 349 of file reader_ccg.c.
References assert(), NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderCcg(), and SCIPreaderGetName().
|
static |
problem writing method of reader
Definition at line 364 of file reader_ccg.c.
References nvars, result, SCIP_CALL, SCIP_OKAY, SCIPwriteCcg(), and vars.