Detailed Description
Saving routines for Steiner problems.
This file includes several saving routines for Steiner problems
A list of all interface methods can be found in graph.h.
Definition in file graph_save.c.
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include "portab.h"
#include "graph.h"
#include "reduce.h"
Go to the source code of this file.
Functions | |
static void | stp_save (const GRAPH *g, FILE *fp) |
static void | bea_save (const GRAPH *g, FILE *fp) |
static void | getOrgNodeToNodeMap (const GRAPH *g, int *orgToNewNode) |
static void | gmlWriteNode (const GRAPH *graph, int k, FILE *file) |
static void | gmlWriteEdge (const GRAPH *graph, int edge, int tail_id, int head_id, const SCIP_Bool *edgemark, FILE *file) |
static void | getReductionRatiosPcMw (const GRAPH *graph, SCIP_Real *ratio_nodes, SCIP_Real *ratio_edges) |
static void | getReductionRatios (const GRAPH *graph, SCIP_Real *ratio_nodes, SCIP_Real *ratio_edges) |
void | graph_writeReductionRatioStats (const GRAPH *graph, const char *probname, const char *filename) |
SCIP_RETCODE | graph_writeReductionRatioStatsLive (SCIP *scip, GRAPH *graph, const char *probname) |
void | graph_save (SCIP *scip, const GRAPH *g, const char *filename, FILETYPE type) |
void | graph_writeReductionStats (const GRAPH *graph, const char *probname, const char *filename) |
SCIP_RETCODE | graph_writeGml (const GRAPH *graph, const char *filename, const SCIP_Bool *edgemark) |
SCIP_RETCODE | graph_writeGmlSub (const GRAPH *graph, const char *filename, const SCIP_Bool *subnodesmark) |
void | graph_writeStpByName (SCIP *scip, const GRAPH *g, const char *filename, SCIP_Real offset) |
void | graph_writeStp (SCIP *scip, const GRAPH *g, FILE *fp, SCIP_Real offset) |
void | graph_writeStpOrg (SCIP *scip, const GRAPH *graph, const char *filename) |
Function Documentation
◆ stp_save()
|
static |
Definition at line 50 of file graph_save.c.
References GRAPH::cost, EAT_FREE, GRAPH::edges, GRAPH::head, GRAPH::ieat, Is_term, GRAPH::knots, NULL, GRAPH::oeat, STP_FILE_MAGIC, STP_FILE_VERSION_MAJOR, STP_FILE_VERSION_MINOR, GRAPH::tail, GRAPH::term, and GRAPH::terms.
Referenced by graph_save().
◆ bea_save()
|
static |
Definition at line 113 of file graph_save.c.
References GRAPH::cost, EAT_FREE, GRAPH::edges, GRAPH::head, GRAPH::ieat, Is_term, GRAPH::knots, NULL, GRAPH::oeat, GRAPH::tail, GRAPH::term, and GRAPH::terms.
Referenced by graph_save().
◆ getOrgNodeToNodeMap()
|
static |
gets node map
Definition at line 149 of file graph_save.c.
References GRAPH::grad, graph_get_nNodes(), graph_pc_isPcMw(), graph_pc_knotIsDummyTerm(), GT, nnodes, GRAPH::prize, and SCIP_Bool.
Referenced by graph_writeStp().
◆ gmlWriteNode()
|
inlinestatic |
Writes node to gml file. Discriminates between root, terminals and Steiner nodes
- Parameters
-
graph Graph to be printed k the node file the gml file
Definition at line 183 of file graph_save.c.
References NULL, SCIP_MAXSTRLEN, SCIPgmlWriteNode(), SCIPsnprintf(), GRAPH::source, and GRAPH::term.
Referenced by graph_writeGml(), and graph_writeGmlSub().
◆ gmlWriteEdge()
|
inlinestatic |
Writes edge to gml file
- Parameters
-
graph Graph to be printed edge the edge tail_id tail ID for gml file head_id head ID for gml file edgemark Array of (undirected) edges to highlight or NULL file the gml file
Definition at line 210 of file graph_save.c.
References GRAPH::cost, graph_edge_isInRange(), graph_knot_isInRange(), NULL, SCIP_MAXSTRLEN, SCIPgmlWriteEdge(), and SCIPsnprintf().
Referenced by graph_writeGml().
◆ getReductionRatiosPcMw()
|
static |
gets ratios of remaining nodes/edges
- Parameters
-
graph graph ratio_nodes nodes ratio ratio_edges edges ratio
Definition at line 236 of file graph_save.c.
References GRAPH::extended, graph_pc_getReductionRatios(), and graph_pc_isPcMw().
Referenced by graph_writeReductionRatioStats(), and graph_writeReductionRatioStatsLive().
◆ getReductionRatios()
|
static |
Call before graph packing!
- Parameters
-
graph graph ratio_nodes nodes ratio ratio_edges edges ratio
Definition at line 251 of file graph_save.c.
References GRAPH::edges, graph_get_nVET(), graph_pc_isPcMw(), GRAPH::knots, nnodes, NULL, and SCIP_Real.
Referenced by graph_writeReductionRatioStats(), and graph_writeReductionRatioStatsLive().
◆ graph_writeReductionRatioStats()
void graph_writeReductionRatioStats | ( | const GRAPH * | graph, |
const char * | probname, | ||
const char * | filename | ||
) |
Write (append) reduction ratio statistics of current graph to file. Call before graph packing!
- Parameters
-
graph Graph to be printed probname Name of the problem filename Name of the output file
Definition at line 285 of file graph_save.c.
References getReductionRatios(), getReductionRatiosPcMw(), graph_pc_isPcMw(), and SCIP_Real.
◆ graph_writeReductionRatioStatsLive()
SCIP_RETCODE graph_writeReductionRatioStatsLive | ( | SCIP * | scip, |
GRAPH * | graph, | ||
const char * | probname | ||
) |
Write (append) reduction ratio statistics of current graph to file. NOTE: Only for testing! Graph will be killed
- Parameters
-
scip SCIP data graph Graph to be printed probname Name of the problem
Definition at line 316 of file graph_save.c.
References getReductionRatios(), getReductionRatiosPcMw(), graph_pc_isPcMw(), graph_typeIsSpgLike(), reduce_exec(), reduce_solFree(), reduce_solInit(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetIntParam(), SCIPgetStringParam(), STP_REDUCTION_ADVANCED, and TRUE.
Referenced by presolveStp().
◆ graph_save()
Definition at line 370 of file graph_save.c.
References bea_save(), FALSE, FF_BEA, FF_GRD, FF_PRB, FF_STP, graph_valid(), NULL, and stp_save().
◆ graph_writeReductionStats()
void graph_writeReductionStats | ( | const GRAPH * | graph, |
const char * | probname, | ||
const char * | filename | ||
) |
Write (append) reduction statistics of current graph to file. Call before graph packing!
- Parameters
-
graph Graph to be printed probname Name of the problem filename Name of the output file
Definition at line 412 of file graph_save.c.
References graph_get_nEdges(), graph_get_nNodes(), graph_get_nVET(), nnodes, and NULL.
◆ graph_writeGml()
SCIP_RETCODE graph_writeGml | ( | const GRAPH * | graph, |
const char * | filename, | ||
const SCIP_Bool * | edgemark | ||
) |
print graph (in undirected form) in GML format
- Parameters
-
graph Graph to be printed filename Name of the output file edgemark Array of (undirected) edges to highlight
Definition at line 441 of file graph_save.c.
References EAT_FREE, GRAPH::edges, FALSE, gmlWriteEdge(), gmlWriteNode(), GRAPH::grad, GRAPH::head, GRAPH::knots, NULL, GRAPH::oeat, SCIP_OKAY, SCIPgmlWriteClosing(), SCIPgmlWriteOpening(), GRAPH::source, and GRAPH::tail.
Referenced by SCIPprobdataCreateFromGraph(), and SCIPprobdataPrintGraph().
◆ graph_writeGmlSub()
SCIP_RETCODE graph_writeGmlSub | ( | const GRAPH * | graph, |
const char * | filename, | ||
const SCIP_Bool * | subnodesmark | ||
) |
prints subgraph of given graph (in undirected form) in GML format
- Parameters
-
graph Graph to be printed filename Name of the output file subnodesmark Array to mark the nodes of the subgraph
Definition at line 490 of file graph_save.c.
References GRAPH::cost, EAT_FREE, GRAPH::edges, FALSE, gmlWriteNode(), GRAPH::grad, GRAPH::head, GRAPH::knots, NULL, GRAPH::oeat, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPgmlWriteClosing(), SCIPgmlWriteEdge(), SCIPgmlWriteOpening(), SCIPsnprintf(), GRAPH::source, and GRAPH::tail.
◆ graph_writeStpByName()
writes graph in .stp format to file
Definition at line 550 of file graph_save.c.
References graph_writeStp().
◆ graph_writeStp()
writes graph in .stp format to file
Definition at line 568 of file graph_save.c.
References GRAPH::cost, EAT_FREE, Edge_anti, GRAPH::edges, EQ, GRAPH::extended, getOrgNodeToNodeMap(), GRAPH::grad, graph_get_nNodes(), graph_get_nVET(), graph_pc_isPcMw(), graph_pc_knotIsDummyTerm(), graph_pc_knotIsFixedTerm(), graph_pc_knotIsNonLeafTerm(), graph_typeIsSpgLike(), GT, GRAPH::head, GRAPH::hoplimit, GRAPH::ieat, Is_anyTerm, Is_term, GRAPH::knots, nnodes, NULL, GRAPH::oeat, GRAPH::prize, SCIP_CALL_ABORT, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPisEQ(), GRAPH::source, STP_DCSTP, STP_DHCSTP, STP_FILE_MAGIC, STP_FILE_VERSION_MAJOR, STP_FILE_VERSION_MINOR, STP_MWCSP, STP_NWPTSPG, STP_NWSPG, STP_OARSMT, STP_PCSPG, STP_RPCSPG, STP_RSMT, STP_SPG, GRAPH::stp_type, GRAPH::tail, GRAPH::term, and GRAPH::terms.
Referenced by graph_writeStpByName(), and SCIP_DECL_READERWRITE().
◆ graph_writeStpOrg()
writes SPG (no variant!) to a file; deprecated
- Parameters
-
scip SCIP data structure graph graph data structure filename file name
Definition at line 799 of file graph_save.c.
References GRAPH::cost, GRAPH::edges, GRAPH::head, Is_term, GRAPH::knots, NULL, GRAPH::tail, GRAPH::term, and GRAPH::terms.