GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
graph_interface.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* GCG --- Generic Column Generation */
5/* a Dantzig-Wolfe decomposition based extension */
6/* of the branch-cut-and-price framework */
7/* SCIP --- Solving Constraint Integer Programs */
8/* */
9/* Copyright (C) 2010-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file graph_interface.h
30 * @brief miscellaneous graph interface methods
31 * @author Martin Bergner
32 * @author Annika Thome
33 */
34
35/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36
37
38
39#ifndef GCG_GRAPHINTERFACE_H_
40#define GCG_GRAPHINTERFACE_H_
41
42#include "objscip/objscip.h"
43#include "graph/weights.h"
44
45#include <vector>
46#include <fstream>
47
48using std::ifstream;
49namespace gcg {
50
52protected:
53 std::vector<int> partition;
54public:
55
57
58 virtual ~GraphInterface() {}
59
60 /** return a partition of the nodes */
61 virtual std::vector<int> getPartition() const { return partition; }
62
63 /** assigns partition to a given node*/
64 virtual void setPartition(int i, int nodeid) = 0;
65
66 /** writes the graph to the given file.
67 * The format is graph dependent
68 */
70 int fd, /**< filename where the graph should be written to */
71 SCIP_Bool writeweights /**< whether to write weights */
72 ) = 0;
73
74
75 /**
76 * reads the partition from the given file.
77 * The format is graph dependent. The default is a file with one line for each node a
78 */
80 const char* filename /**< filename where the partition is stored */
81 ) = 0;
82
83
84 /** create decomposition based on the read in partition */
86 GCG_DECOMP** decomp /**< decomposition structure to generate */
87 )
88 { /*lint -e715*/
89 return SCIP_ERROR;
90 }
91
92 virtual SCIP_RETCODE flush() = 0;
93
94};
95
96}
97
98#endif
virtual SCIP_RETCODE flush()=0
virtual SCIP_RETCODE readPartition(const char *filename)=0
virtual void setPartition(int i, int nodeid)=0
virtual SCIP_RETCODE createDecompFromPartition(GCG_DECOMP **decomp)
std::vector< int > partition
virtual std::vector< int > getPartition() const
virtual SCIP_RETCODE writeToFile(int fd, SCIP_Bool writeweights)=0
#define SCIP_Bool
int i
struct GCG_Decomp GCG_DECOMP
Definition type_decomp.h:45
SCIP_ERROR
enum SCIP_Retcode SCIP_RETCODE
weight class for graphs