Dip
0.92.4
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
tmp
Dip-0.92.4
Dip
examples
VRP
VRP_GSECCut.h
Go to the documentation of this file.
1
// $Id: VRP_GSECCut.hpp,v 1.2 2004/06/16 22:26:37 magh Exp $
2
3
/*-------------------------------------------------------------------------
4
Author: Matthew Galati (magh@lehigh.edu)
5
6
(c) Copyright 2004 Lehigh University. All Rights Reserved.
7
8
This software is licensed under the Common Public License. Please see
9
accompanying file for terms.
10
---------------------------------------------------------------------------*/
11
12
#ifndef VRP_SUBTOUR_CUT
13
#define VRP_SUBTOUR_CUT
14
/*----------------------------------------------------------------------
15
Type 1: VRP_GSEC_cut
16
17
Generalized Subtour Elimination Constraints:
18
19
(i) ACROSS:
20
sum{e in delta(S)} x_e >= 2 * ceil( sum{i in S} d_i / C )
21
22
(ii) SIDE:
23
sum{e in E(S) } x_e <= |S| - ceil( sum{i in S} d_i / C )
24
25
(iii) SIDE_COMPL:
26
sum{e in E(Shat)} + 0.5 x({0} : Shat) - 0.5 x({0} : S) <= |Shat| - k(S)
27
28
if(|S| <= n/2) use (ii), else use (iii) for sparsest form
29
30
Shat = V \ S (note, V does not include depot here)
31
i.e., customers that are not in the set S
32
---------------------------------------------------------------------- */
33
34
#include "
Decomp.h
"
35
#include "DecompCut.h"
36
37
#include <vector>
38
using namespace
std;
39
40
//TODO: switch to just use bool vector?
41
#include <boost/dynamic_bitset.hpp>
42
using namespace
boost;
43
44
/*---------------------------------------------------------------------- */
45
class
VRP_GSECCut
:
public
DecompCut
{
46
public
:
47
enum
storageType
{
VECTOR
, BITSET,
BOTH
,
NONE
};
48
enum
cutType
{ACROSS, SIDE, SIDE_COMPL};
49
50
private
:
52
const
string
m_classTag
;
53
54
55
vector<int>
m_S
;
56
dynamic_bitset<>
m_inS
;
57
cutType
m_type
;
58
storageType
m_storage
;
59
int
m_nverts
;
60
int
m_demandS
;
61
int
m_capacity
;
62
63
public
:
64
//these (pure virutal) methods are inherited from DecompCut
65
virtual
void
expandCutToRow(
CoinPackedVector
* row);
66
virtual
void
setBounds(
double
infinity);
67
68
//these (virutal) methods are inherited from DecompCut
69
virtual
void
print(ostream * os = &cout)
const
;
70
virtual
bool
isSame(
const
DecompCut
*
cut
)
const
;
71
72
public
:
73
void
setStorage();
74
void
create_bitset();
75
void
create_vector();
76
void
setCutType();
77
void
setDemand(
const
int
* vertex_wt);
78
const
int
getSize();
79
80
public
:
81
VRP_GSECCut
(
const
dynamic_bitset<> & inS,
82
const
int
* vertex_wt,
83
const
int
capacity,
84
const
double
infinity,
85
const
int
demandS = 0) :
86
m_classTag(
"VRP-GSEC"
),
87
m_inS (inS),
88
m_storage (BITSET),
89
m_nverts (m_inS.size()),
90
m_demandS (demandS),
91
m_capacity(capacity)
92
{
93
setStorage();
94
setCutType();
95
setDemand(vertex_wt);
96
setBounds(infinity);
97
}
98
99
virtual
~VRP_GSECCut
() {}
100
};
101
102
#endif
VRP_GSECCut::m_type
cutType m_type
Definition:
VRP_GSECCut.h:57
VRP_GSECCut::cutType
cutType
Definition:
VRP_GSECCut.h:48
DecompCut
Definition:
DecompCut.h:34
Decomp.h
VRP_GSECCut::VRP_GSECCut
VRP_GSECCut(const dynamic_bitset<> &inS, const int *vertex_wt, const int capacity, const double infinity, const int demandS=0)
Definition:
VRP_GSECCut.h:81
VRP_GSECCut::~VRP_GSECCut
virtual ~VRP_GSECCut()
Definition:
VRP_GSECCut.h:99
VRP_GSECCut::VECTOR
Definition:
VRP_GSECCut.h:47
VRP_GSECCut::m_storage
storageType m_storage
Definition:
VRP_GSECCut.h:58
VRP_GSECCut::m_classTag
const string m_classTag
Class id tag (for log / debugging).
Definition:
VRP_GSECCut.h:52
cut
Definition:
Cgl012cut.hpp:153
VRP_GSECCut::m_S
vector< int > m_S
Definition:
VRP_GSECCut.h:55
VRP_GSECCut
Definition:
VRP_GSECCut.h:45
NONE
#define NONE
Definition:
cnrp_const.h:30
CoinPackedVector
Sparse Vector.
Definition:
CoinPackedVector.hpp:123
VRP_GSECCut::m_capacity
int m_capacity
Definition:
VRP_GSECCut.h:61
VRP_GSECCut::m_nverts
int m_nverts
Definition:
VRP_GSECCut.h:59
VRP_GSECCut::m_demandS
int m_demandS
Definition:
VRP_GSECCut.h:60
BOTH
#define BOTH
Definition:
cnrp_cg_params.h:22
VRP_GSECCut::storageType
storageType
Definition:
VRP_GSECCut.h:47
VRP_GSECCut::m_inS
dynamic_bitset m_inS
Definition:
VRP_GSECCut.h:56
Generated by
1.8.5