Detailed Description
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" |
Typedefs | |
typedef struct sparseGraph | SparseGraph |
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) |
Macro Definition Documentation
◆ READER_NAME
#define READER_NAME "ccgreader" |
Definition at line 51 of file reader_ccg.c.
Referenced by SCIP_DECL_READERCOPY(), and SCIPincludeReaderCcg().
◆ READER_DESC
#define READER_DESC "file writer for column connectivity graph file format" |
Definition at line 52 of file reader_ccg.c.
Referenced by SCIPincludeReaderCcg().
◆ READER_EXTENSION
#define READER_EXTENSION "ccg" |
Definition at line 53 of file reader_ccg.c.
Referenced by SCIPincludeReaderCcg().
Typedef Documentation
◆ SparseGraph
typedef struct sparseGraph SparseGraph |
Definition at line 71 of file reader_ccg.c.
Function Documentation
◆ initGraph()
|
static |
initialize graph
- Parameters
-
scip SCIP data structure G graph to free nNodes number of nodes initSize initial size of lists
Definition at line 80 of file reader_ccg.c.
References SCIP_CALL, SCIP_OKAY, and SCIPallocBufferArray.
Referenced by SCIPwriteCcg().
◆ freeGraph()
|
static |
frees graph
- Parameters
-
scip SCIP data structure G graph to free
Definition at line 114 of file reader_ccg.c.
References SCIPfreeBufferArray.
Referenced by SCIPwriteCcg().
◆ ensureEdgeCapacity()
|
static |
check whether there is enough capacity for one additional edge in the given adjacency list
- Parameters
-
scip SCIP data structure G graph node list for node
Definition at line 136 of file reader_ccg.c.
References SCIP_CALL, SCIP_OKAY, and SCIPreallocBufferArray.
Referenced by createEdgesFromRow().
◆ 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_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 157 of file reader_ccg.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPgetProbvarLinearSum(), SCIPreallocBufferArray, SCIPvarGetOrigvarSum(), and TRUE.
Referenced by handleLinearCons().
◆ createEdgesFromRow()
|
static |
- Parameters
-
scip SCIP data structure vars array of constraint variables vals array of constraint values nvars number of constraint variables G graph
Definition at line 202 of file reader_ccg.c.
References a, ABS, ensureEdgeCapacity(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPvarGetProbindex(), and w.
Referenced by handleLinearCons().
◆ handleLinearCons()
|
static |
handle given linear constraint information
- Parameters
-
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 288 of file reader_ccg.c.
References createEdgesFromRow(), getActiveVariables(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPduplicateBufferArray, and SCIPfreeBufferArray.
Referenced by SCIPwriteCcg().
◆ SCIP_DECL_READERCOPY()
|
static |
copy method for reader plugins (called when SCIP copies plugins)
Definition at line 339 of file reader_ccg.c.
References NULL, READER_NAME, SCIP_CALL, SCIP_OKAY, SCIPincludeReaderCcg(), and SCIPreaderGetName().
◆ SCIP_DECL_READERWRITE()
|
static |
problem writing method of reader
Definition at line 354 of file reader_ccg.c.
References SCIP_CALL, SCIP_OKAY, and SCIPwriteCcg().