matrixgraph.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
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-2018 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 
37 #ifndef GCG_MATRIXGRAPH_H_
38 #define GCG_MATRIXGRAPH_H_
39 #include "objscip/objscip.h"
40 #include "tclique/tclique.h"
41 #include "weights.h"
42 #include "pub_decomp.h"
43 #include "bridge.h"
44 #include "graph_interface.h"
45 #include "class_seeed.h"
46 #include "class_seeedpool.h"
47 #include <exception>
48 #include <vector>
49 #include <string>
50 
51 namespace gcg {
52 
53 template <class T>
54 class MatrixGraph {
55 public:
56  std::string name;
57 protected:
58  SCIP* scip_;
59  int nconss;
60  int nvars;
65 
66 public:
69  SCIP* scip,
70  Weights w
71  );
72 
74  virtual ~MatrixGraph();
75 
79  virtual SCIP_RETCODE writeToFile(
80  int fd,
81  SCIP_Bool writeweights
82  )
83  {
84  SCIP_CALL(graphiface->writeToFile(fd, writeweights) );
85  return SCIP_OKAY;
86  }
87 
88 
89  virtual SCIP_RETCODE createDecompFromPartition(
90  DEC_DECOMP** decomp
91  )
92  {
93  return SCIP_ERROR;
94  }
95 
96 
97 
99  virtual SCIP_RETCODE createSeeedFromPartition(
100  Seeed* oldSeeed,
101  Seeed** firstSeeed,
102  Seeed** secondSeeed,
103  Seeedpool* seeedpool
104  )
105  {
106  return SCIP_ERROR;
107  }
108 
113  virtual SCIP_RETCODE readPartition(
114  const char* filename
115  )
116  {
117  SCIP_CALL( graphiface->readPartition(filename) );
118  return SCIP_OKAY;
119  }
120 
122  void setDummynodes(int dummynodes_)
123  {
124  dummynodes = dummynodes_;
125  }
126 
127  int getDummynodes() const
128  {
129  return dummynodes;
130  }
131 
133  virtual std::vector<int> getPartition()
134  {
135  return graphiface->getPartition();
136  }
137 
138  virtual SCIP_RETCODE createFromMatrix(
139  SCIP_CONS** conss,
140  SCIP_VAR** vars,
141  int nconss_,
142  int nvars_
143  ) { return SCIP_ERROR; }
144 
146  virtual SCIP_RETCODE createFromPartialMatrix(
147  Seeedpool* seeedpool,
148  Seeed* seeed
149  ) { return SCIP_ERROR; }
150 
151 
152  virtual int getNNonzeroes() const
153  {
154  return nnonzeroes;
155  }
156 };
157 
158 }
159 
160 #endif
std::string name
Definition: matrixgraph.h:56
virtual ~MatrixGraph()
virtual std::vector< int > getPartition() const
virtual SCIP_RETCODE writeToFile(int fd, SCIP_Bool writeweights)
Definition: matrixgraph.h:79
GraphInterface * graphiface
Definition: matrixgraph.h:63
virtual std::vector< int > getPartition()
Definition: matrixgraph.h:133
virtual int getNNonzeroes() const
Definition: matrixgraph.h:152
virtual SCIP_RETCODE createFromPartialMatrix(Seeedpool *seeedpool, Seeed *seeed)
Definition: matrixgraph.h:146
weight class for graphs
int getDummynodes() const
Definition: matrixgraph.h:127
class to manage partial decompositions (aka seeed), each seeed corresponds to one seeedpool which con...
Definition: class_seeed.h:71
virtual SCIP_RETCODE createDecompFromPartition(DEC_DECOMP **decomp)
Definition: matrixgraph.h:89
void setDummynodes(int dummynodes_)
Definition: matrixgraph.h:122
virtual SCIP_RETCODE createFromMatrix(SCIP_CONS **conss, SCIP_VAR **vars, int nconss_, int nvars_)
Definition: matrixgraph.h:138
virtual SCIP_RETCODE createSeeedFromPartition(Seeed *oldSeeed, Seeed **firstSeeed, Seeed **secondSeeed, Seeedpool *seeedpool)
Definition: matrixgraph.h:99
miscellaneous graph interface methods
MatrixGraph(SCIP *scip, Weights w)
virtual SCIP_RETCODE readPartition(const char *filename)
Definition: matrixgraph.h:113
class with functions for seeed pool where a seeed is a (potentially incomplete) description of a deco...
bridge
struct DecDecomp DEC_DECOMP
Definition: type_decomp.h:43
virtual SCIP_RETCODE readPartition(const char *filename)=0
public methods for working with decomposition structures
virtual SCIP_RETCODE writeToFile(int fd, SCIP_Bool writeweights)=0