Scippy

GCG

Branch-and-Price & Column Generation for Everyone

weights.cpp
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-2021 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 
28 /**@file weights.cpp
29  * @brief weight class for graphs
30  * @author Martin Bergner
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include "weights.h"
36 
37 namespace gcg {
38 
40  int varweight_,
41  int vbinary_,
42  int vcontinous_,
43  int vinteger_,
44  int vimplint_,
45  int consweight_
46  ): varweight(varweight_),
47  vbinary(vbinary_),
48  vcontinous(vcontinous_),
49  vinteger(vinteger_),
50  vimplint(vimplint_),
51  consweight(consweight_)
52 {
53  // TODO Auto-generated constructor stub
54 
55 }
56 
58 : varweight(1),
59  vbinary(1),
60  vcontinous(1),
61  vinteger(1),
62  vimplint(1),
63  consweight(1)
64 {
65 
66 }
67 
69 {
70  // TODO Auto-generated destructor stub
71 }
72 
73 int Weights::calculate(SCIP_CONS* cons) const
74 { /*lint -e715*/
75  return consweight;
76 }
77 int Weights::calculate(SCIP_VAR* var) const
78 
79 {
80  int weight;
81 
82  assert(var != NULL);
83 
84  switch ( SCIPvarGetType(var) ) {
85  case SCIP_VARTYPE_CONTINUOUS:
86  weight = vcontinous;
87  break;
88  case SCIP_VARTYPE_INTEGER:
89  weight = vinteger;
90  break;
91  case SCIP_VARTYPE_IMPLINT:
92  weight = vimplint;
93  break;
94  case SCIP_VARTYPE_BINARY:
95  weight = vbinary;
96  break;
97  default:
98  weight = varweight;
99  break;
100  }
101 
102  return weight;
103 }
104 } /* namespace gcg */
int vcontinous
Definition: weights.h:46
weight class for graphs
virtual ~Weights()
Definition: weights.cpp:68
int calculate(SCIP_CONS *cons) const
Definition: weights.cpp:73
int varweight
Definition: weights.h:44
int consweight
Definition: weights.h:49
int vimplint
Definition: weights.h:48
int vbinary
Definition: weights.h:45
int vinteger
Definition: weights.h:47