GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
hypercolgraph.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 hypercolgraph.h
30 * @brief Column hypergraph
31 * @author Martin Bergner
32 */
33
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35
36#ifndef GCG_HYPERCOLGRAPH_H_
37#define GCG_HYPERCOLGRAPH_H_
38
39#include "graph/matrixgraph.h"
40#include "graph/hypergraph.h"
43
44namespace gcg
45{
46template <class T>
48{
49
50private:
51 Hypergraph<T> graph;
52protected:
53 class function {
54 int diff;
55 public:
56 function(int i):diff(i) {}
57 int operator()(int i) { return i-diff;}
58 };
59
60public:
62 GCG* gcg, /**< GCG data structure */
63 Weights w /**< weights for the given graph */
64 );
65
66 virtual ~HypercolGraph();
67
68 /** writes the graph to the given file.
69 * The format is graph dependent
70 */
72 int fd, /**< filename where the graph should be written to */
73 SCIP_Bool edgeweights /**< whether to write edgeweights */
74 );
75
76 /** return the number of nodes */
77 virtual int getNNodes();
78
79 /** return the number of edges (or hyperedges) */
80 virtual int getNEdges();
81
82 virtual std::vector<int> getNeighbors(
83 int i
84 )
85 {
86 return this->graph.getNeighbors(i);
87 }
88
89 virtual std::vector<int> getHyperedgeNodes(
90 int i
91 );
92
93 /**
94 * reads the partition from the given file.
95 * The format is graph dependent. The default is a file with one line for each node a
96 */
98 const char* filename /**< filename where the partition is stored */
99 )
100 {
101 SCIP_CALL( this->graph.readPartition(filename) );
102 return SCIP_OKAY;
103 }
104
106 SCIP_CONS** conss, /**< constraints for which graph should be created */
107 SCIP_VAR** vars, /**< variables for which graph should be created */
108 int nconss_, /**< number of constraints */
109 int nvars_ /**< number of variables */
110 );
111
112 /** creates a graph with open constraints and open variables of the partialdec */
114 DETPROBDATA* detprobdata, /**< detection process information and data */
115 PARTIALDECOMP* partialdec /**< partial decomposition to use for graph */
116 );
117
119 GCG_DECOMP** decomp /**< decomposition structure to generate */
120 );
121
122 /** creates a new partialdec by dint of a graph created with all constraints and variables */
124 PARTIALDECOMP** firstpartialdec, /**< pointer to buffer the new partialdec created by dint of the graph (can be NULL) */
125 PARTIALDECOMP** secondpartialdec, /**< pointer to buffer the new partialdec whose border is amplified by dint of the graph (can be NULL) */
126 DETPROBDATA* detprobdata /**< detection process information and data */
127 );
128
129 /** amplifies a partialdec by dint of a graph created with open constraints and open variables of the partialdec */
131 PARTIALDECOMP* oldpartialdec, /**< partialdec which should be amplifies */
132 PARTIALDECOMP** firstpartialdec, /**< pointer to buffer the new partialdec amplified by dint of the graph (can be NULL) */
133 PARTIALDECOMP** secondpartialdec, /**< pinter to buffer the new partialdec whose border is amplified by dint of the graph (can be NULL) */
134 DETPROBDATA* detprobdata /**< detection process information and data */
135 );
136};
137
138} /* namespace gcg */
139#endif /* GCG_HYPERCOLGRAPH_H_ */
SCIP_VAR * w
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
virtual std::vector< int > getNeighbors(int i)
virtual SCIP_RETCODE createPartialdecFromPartition(PARTIALDECOMP **firstpartialdec, PARTIALDECOMP **secondpartialdec, DETPROBDATA *detprobdata)
virtual std::vector< int > getHyperedgeNodes(int i)
SCIP_RETCODE writeToFile(int fd, SCIP_Bool edgeweights)
HypercolGraph(GCG *gcg, Weights w)
virtual SCIP_RETCODE createDecompFromPartition(GCG_DECOMP **decomp)
virtual SCIP_RETCODE createFromPartialMatrix(DETPROBDATA *detprobdata, PARTIALDECOMP *partialdec)
virtual SCIP_RETCODE readPartition(const char *filename)
virtual SCIP_RETCODE createFromMatrix(SCIP_CONS **conss, SCIP_VAR **vars, int nconss_, int nvars_)
std::vector< int > getNeighbors(int i)
SCIP_RETCODE readPartition(const char *filename)
class to manage partial decompositions
#define SCIP_Bool
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIP_VAR ** vars
int i
miscellaneous hypergraph methods for structure detection
miscellaneous matrixgraph methods for structure detection
struct SCIP_Cons SCIP_CONS
struct GCG_Decomp GCG_DECOMP
Definition type_decomp.h:45
struct Gcg GCG
Definition type_gcg.h:44
enum SCIP_Retcode SCIP_RETCODE
struct SCIP_Var SCIP_VAR