Scippy

SCIP

Solving Constraint Integer Programs

graph_save.c File Reference

Detailed Description

Saving routines for Steiner problems.

Author
Gerald Gamrath
Thorsten Koch
Daniel Rehfeldt

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 void stp_save ( const GRAPH g,
FILE *  fp 
)
static

◆ bea_save()

static void bea_save ( const GRAPH g,
FILE *  fp 
)
static

◆ getOrgNodeToNodeMap()

static void getOrgNodeToNodeMap ( const GRAPH g,
int *  orgToNewNode 
)
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()

static void gmlWriteNode ( const GRAPH graph,
int  k,
FILE *  file 
)
inlinestatic

Writes node to gml file. Discriminates between root, terminals and Steiner nodes

Parameters
graphGraph to be printed
kthe 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()

static void gmlWriteEdge ( const GRAPH graph,
int  edge,
int  tail_id,
int  head_id,
const SCIP_Bool edgemark,
FILE *  file 
)
inlinestatic

Writes edge to gml file

Parameters
graphGraph to be printed
edgethe edge
tail_idtail ID for gml file
head_idhead ID for gml file
edgemarkArray 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 void getReductionRatiosPcMw ( const GRAPH graph,
SCIP_Real ratio_nodes,
SCIP_Real ratio_edges 
)
static

gets ratios of remaining nodes/edges

Parameters
graphgraph
ratio_nodesnodes ratio
ratio_edgesedges 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 void getReductionRatios ( const GRAPH graph,
SCIP_Real ratio_nodes,
SCIP_Real ratio_edges 
)
static

Call before graph packing!

Parameters
graphgraph
ratio_nodesnodes ratio
ratio_edgesedges 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
graphGraph to be printed
probnameName of the problem
filenameName 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
scipSCIP data
graphGraph to be printed
probnameName 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()

void graph_save ( SCIP scip,
const GRAPH g,
const char *  filename,
FILETYPE  type 
)

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
graphGraph to be printed
probnameName of the problem
filenameName 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
graphGraph to be printed
filenameName of the output file
edgemarkArray 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
graphGraph to be printed
filenameName of the output file
subnodesmarkArray 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()

void graph_writeStpByName ( SCIP scip,
const GRAPH g,
const char *  filename,
SCIP_Real  offset 
)

writes graph in .stp format to file

Definition at line 550 of file graph_save.c.

References graph_writeStp().

◆ graph_writeStp()

◆ graph_writeStpOrg()

void graph_writeStpOrg ( SCIP scip,
const GRAPH graph,
const char *  filename 
)

writes SPG (no variant!) to a file; deprecated

Parameters
scipSCIP data structure
graphgraph data structure
filenamefile 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.