- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

BlisNodeDesc.h
Go to the documentation of this file.
1 /*===========================================================================*
2 * This file is part of the Bcps Linear Solver (BLIS). *
3 * *
4 * BLIS is distributed under the Eclipse Public License as part of the *
5 * COIN-OR repository (http://www.coin-or.org). *
6 * *
7 * Authors: *
8 * *
9 * Yan Xu, Lehigh University *
10 * Ted Ralphs, Lehigh University *
11 * *
12 * Conceptual Design: *
13 * *
14 * Yan Xu, Lehigh University *
15 * Ted Ralphs, Lehigh University *
16 * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17 * Matthew Saltzman, Clemson University *
18 * *
19 * *
20 * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21 * All Rights Reserved. *
22 *===========================================================================*/
23
24 #ifndef BlisNodeDesc_h_
25 #define BlisNodeDesc_h_
26
27 //#############################################################################
28
29 #include "CoinWarmStartBasis.hpp"
30
31 #include "AlpsNodeDesc.h"
32 #include "BcpsNodeDesc.h"
33
34 #include "BlisHelp.h"
35 #include "BlisModel.h"
36
37 //#############################################################################
38
39
40 class BlisNodeDesc : public BcpsNodeDesc {
41
42 private:
43
45 int branchedDir_;
46
48 int branchedInd_;
49
51 double branchedVal_;
52
54 CoinWarmStartBasis *basis_;
55
56 public:
57
59 BlisNodeDesc() :
60 BcpsNodeDesc(),
61 branchedDir_(0),
62 branchedInd_(-1),
63 branchedVal_(0.0),
64 basis_(NULL)
65 {}
66
68 BlisNodeDesc(BlisModel* m)
69 :
70 BcpsNodeDesc(m),
71 branchedDir_(0),
72 branchedInd_(-1),
73 branchedVal_(0.0),
74 basis_(NULL)
75 {}
76
78 virtual ~BlisNodeDesc() { delete basis_; }
79
81 void setBasis(CoinWarmStartBasis *&ws) {
82 if (basis_) { delete basis_; }
83 basis_= ws;
84 ws = NULL;
85 }
86
88 CoinWarmStartBasis * getBasis() const { return basis_; }
89
91 void setBranchedDir(int d) { branchedDir_ = d; }
92
94 int getBranchedDir() const { return branchedDir_; }
95
97 void setBranchedInd(int d) { branchedInd_ = d; }
98
100 int getBranchedInd() const { return branchedInd_; }
101
103 void setBranchedVal(double d) { branchedVal_ = d; }
104
106 double getBranchedVal() const { return branchedVal_; }
107
108 protected:
109
111 AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const {
112 AlpsReturnStatus status = AlpsReturnStatusOk;
113
114 encoded->writeRep(branchedDir_);
115 encoded->writeRep(branchedInd_);
116 encoded->writeRep(branchedVal_);
117
118 // Basis
119 int ava = 0;
120 if (basis_) {
121 ava = 1;
122 encoded->writeRep(ava);
123 BlisEncodeWarmStart(encoded, basis_);
124 }
125 else {
126 encoded->writeRep(ava);
127 }
128
129 return status;
130 }
131
133 AlpsReturnStatus decodeBlis(AlpsEncoded &encoded) {
134 AlpsReturnStatus status = AlpsReturnStatusOk;
135
136 encoded.readRep(branchedDir_);
137 encoded.readRep(branchedInd_);
138 encoded.readRep(branchedVal_);
139
140 // Basis
141 int ava;
142 encoded.readRep(ava);
143 if (ava == 1) {
144 basis_ = BlisDecodeWarmStart(encoded, &status);
145 }
146 else {
147 basis_ = NULL;
148 }
149
150 return status;
151 }
152
153 public:
154
156 virtual AlpsReturnStatus encode(AlpsEncoded *encoded) const {
157 AlpsReturnStatus status = AlpsReturnStatusOk;
158
159 status = encodeBcps(encoded);
160 status = encodeBlis(encoded);
161
162 return status;
163 }
164
166 virtual AlpsReturnStatus decode(AlpsEncoded &encoded) {
167
168 AlpsReturnStatus status = AlpsReturnStatusOk;
169
170 status = decodeBcps(encoded);
171 status = decodeBlis(encoded);
172
173 return status;
174 }
175
176 };
177 #endif
BcpsNodeDesc
For a given type, the objectVecStorage_ structure holds the description.
Definition: BcpsNodeDesc.h:128
BlisModel
Definition: BlisModel.h:60
BlisModel.h
AlpsNodeDesc.h
BlisNodeDesc::getBranchedInd
int getBranchedInd() const
Get branching object index.
Definition: BlisNodeDesc.h:100
AlpsEncoded::readRep
AlpsEncoded & readRep(T &value)
Read a single object of type T from repsentation_ .
Definition: AlpsEncoded.h:173
AlpsEncoded::writeRep
AlpsEncoded & writeRep(const T &value)
Write a single object of type T in repsentation_ .
Definition: AlpsEncoded.h:163
BlisNodeDesc::branchedInd_
int branchedInd_
Branched object index to create it.
Definition: BlisNodeDesc.h:48
BlisHelp.h
BlisNodeDesc::getBasis
CoinWarmStartBasis * getBasis() const
Get warm start basis.
Definition: BlisNodeDesc.h:88
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:118
BlisEncodeWarmStart
int BlisEncodeWarmStart(AlpsEncoded *encoded, const CoinWarmStartBasis *ws)
Pack coin warm start into an encoded object.
BlisNodeDesc::getBranchedVal
double getBranchedVal() const
Get branching direction.
Definition: BlisNodeDesc.h:106
BlisNodeDesc::decodeBlis
AlpsReturnStatus decodeBlis(AlpsEncoded &encoded)
Unpack blis portion of node description from an encoded.
Definition: BlisNodeDesc.h:133
BlisNodeDesc::branchedVal_
double branchedVal_
Branched value to create it.
Definition: BlisNodeDesc.h:51
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
BlisNodeDesc::setBranchedInd
void setBranchedInd(int d)
Set branching object index.
Definition: BlisNodeDesc.h:97
BlisNodeDesc::decode
virtual AlpsReturnStatus decode(AlpsEncoded &encoded)
Unpack a node description from an encoded.
Definition: BlisNodeDesc.h:166
AlpsReturnStatusOk
Definition: Alps.h:119
BlisNodeDesc::~BlisNodeDesc
virtual ~BlisNodeDesc()
Destructor.
Definition: BlisNodeDesc.h:78
BlisNodeDesc::setBranchedDir
void setBranchedDir(int d)
Set branching direction.
Definition: BlisNodeDesc.h:91
BlisNodeDesc::BlisNodeDesc
BlisNodeDesc()
Default constructor.
Definition: BlisNodeDesc.h:59
BlisNodeDesc::getBranchedDir
int getBranchedDir() const
Get branching direction.
Definition: BlisNodeDesc.h:94
BcpsNodeDesc::decodeBcps
AlpsReturnStatus decodeBcps(AlpsEncoded &encoded)
Unpack bcps node description into an encoded.
CoinWarmStartBasis.hpp
BlisNodeDesc::encode
virtual AlpsReturnStatus encode(AlpsEncoded *encoded) const
Pack node description into an encoded.
Definition: BlisNodeDesc.h:156
BlisNodeDesc::branchedDir_
int branchedDir_
Branched direction to create it.
Definition: BlisNodeDesc.h:45
BlisNodeDesc::BlisNodeDesc
BlisNodeDesc(BlisModel *m)
Useful constructor.
Definition: BlisNodeDesc.h:68
BlisNodeDesc
Definition: BlisNodeDesc.h:40
BlisNodeDesc::setBranchedVal
void setBranchedVal(double d)
Set branching value.
Definition: BlisNodeDesc.h:103
BlisNodeDesc::setBasis
void setBasis(CoinWarmStartBasis *&ws)
Set basis.
Definition: BlisNodeDesc.h:81
BlisDecodeWarmStart
CoinWarmStartBasis * BlisDecodeWarmStart(AlpsEncoded &encoded, AlpsReturnStatus *rc)
Unpack coin warm start from an encoded object.
BcpsNodeDesc.h
BlisNodeDesc::basis_
CoinWarmStartBasis * basis_
Warm start.
Definition: BlisNodeDesc.h:54
BlisNodeDesc::encodeBlis
AlpsReturnStatus encodeBlis(AlpsEncoded *encoded) const
Pack blis portion of node description into an encoded.
Definition: BlisNodeDesc.h:111
BcpsNodeDesc::encodeBcps
AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const
Pack bcps node description into an encoded.
CoinWarmStartBasis
The default COIN simplex (basis-oriented) warm start class.
Definition: CoinWarmStartBasis.hpp:40