Clp 1.17.6

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinWarmStartPrimalDual.hpp
Go to the documentation of this file.
1 /* $Id: CoinWarmStartPrimalDual.hpp 2083 2019-01-06 19:38:09Z unxusr $ */
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #ifndef CoinWarmStartPrimalDual_H
7 #define CoinWarmStartPrimalDual_H
8
9 #include "CoinHelperFunctions.hpp"
10 #include "CoinWarmStart.hpp"
11 #include "CoinWarmStartVector.hpp"
12
13 //#############################################################################
14
17 class CoinWarmStartPrimalDual : public virtual CoinWarmStart {
18 public:
20 inline int dualSize() const { return dual_.size(); }
22 inline const double *dual() const { return dual_.values(); }
23
25 inline int primalSize() const { return primal_.size(); }
27 inline const double *primal() const { return primal_.values(); }
28
38 void assign(int primalSize, int dualSize, double *&primal, double *&dual)
39 {
40 primal_.assignVector(primalSize, primal);
41 dual_.assignVector(dualSize, dual);
42 }
43
44 CoinWarmStartPrimalDual()
45 : primal_()
46 , dual_()
47 {
48 }
49
50 CoinWarmStartPrimalDual(int primalSize, int dualSize,
51 const double *primal, const double *dual)
52 : primal_(primalSize, primal)
53 , dual_(dualSize, dual)
54 {
55 }
56
57 CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual &rhs)
58 : primal_(rhs.primal_)
59 , dual_(rhs.dual_)
60 {
61 }
62
63 CoinWarmStartPrimalDual &operator=(const CoinWarmStartPrimalDual &rhs)
64 {
65 if (this != &rhs) {
66 primal_ = rhs.primal_;
67 dual_ = rhs.dual_;
68 }
69 return *this;
70 }
71
77 inline void clear()
78 {
79 primal_.clear();
80 dual_.clear();
81 }
82
83 inline void swap(CoinWarmStartPrimalDual &rhs)
84 {
85 if (this != &rhs) {
86 primal_.swap(rhs.primal_);
87 dual_.swap(rhs.dual_);
88 }
89 }
90
92 virtual CoinWarmStart *clone() const
93 {
94 return new CoinWarmStartPrimalDual(*this);
95 }
96
97 virtual ~CoinWarmStartPrimalDual() {}
98
101
109 virtual CoinWarmStartDiff *
110 generateDiff(const CoinWarmStart *const oldCWS) const;
111
118 virtual void applyDiff(const CoinWarmStartDiff *const cwsdDiff);
119
121
122 #if 0
123 protected:
124 inline const CoinWarmStartVector<double>& primalWarmStartVector() const
125 { return primal_; }
126 inline const CoinWarmStartVector<double>& dualWarmStartVector() const
127 { return dual_; }
128 #endif
129
130 private:
132
133 CoinWarmStartVector< double > primal_;
134 CoinWarmStartVector< double > dual_;
136 };
137
138 //#############################################################################
139
156 class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff {
157 friend CoinWarmStartDiff *
158 CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
159 friend void
160 CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff);
161
162 public:
165 virtual CoinWarmStartDiff *clone() const
166 {
167 return new CoinWarmStartPrimalDualDiff(*this);
168 }
169
171 virtual ~CoinWarmStartPrimalDualDiff() {}
172
173 protected:
180 CoinWarmStartPrimalDualDiff()
181 : primalDiff_()
182 , dualDiff_()
183 {
184 }
185
196 CoinWarmStartPrimalDualDiff(const CoinWarmStartPrimalDualDiff &rhs)
197 : primalDiff_(rhs.primalDiff_)
198 , dualDiff_(rhs.dualDiff_)
199 {
200 }
201
207 inline void clear()
208 {
209 primalDiff_.clear();
210 dualDiff_.clear();
211 }
212
213 inline void swap(CoinWarmStartPrimalDualDiff &rhs)
214 {
215 if (this != &rhs) {
216 primalDiff_.swap(rhs.primalDiff_);
217 dualDiff_.swap(rhs.dualDiff_);
218 }
219 }
220
221 private:
226 CoinWarmStartVectorDiff< double > primalDiff_;
227 CoinWarmStartVectorDiff< double > dualDiff_;
228 };
229
230 #endif
231
232 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
233 */
CoinHelperFunctions.hpp
CoinWarmStartVectorDiff< double >
CoinWarmStartPrimalDual::assign
void assign(int primalSize, int dualSize, double *&primal, double *&dual)
Assign the primal/dual vectors to be the warmstart information.
Definition: CoinWarmStartPrimalDual.hpp:38
CoinWarmStartPrimalDual::~CoinWarmStartPrimalDual
virtual ~CoinWarmStartPrimalDual()
Definition: CoinWarmStartPrimalDual.hpp:97
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual()
Definition: CoinWarmStartPrimalDual.hpp:44
CoinWarmStartPrimalDualDiff::clone
virtual CoinWarmStartDiff * clone() const
`Virtual constructor&#39;.
Definition: CoinWarmStartPrimalDual.hpp:165
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual(int primalSize, int dualSize, const double *primal, const double *dual)
Definition: CoinWarmStartPrimalDual.hpp:50
CoinWarmStartPrimalDualDiff::primalDiff_
CoinWarmStartVectorDiff< double > primalDiff_
These two differences describe the differences in the primal and in the dual vector.
Definition: CoinWarmStartPrimalDual.hpp:226
CoinWarmStartPrimalDual::dual_
CoinWarmStartVector< double > dual_
Definition: CoinWarmStartPrimalDual.hpp:134
CoinWarmStartPrimalDualDiff::dualDiff_
CoinWarmStartVectorDiff< double > dualDiff_
Definition: CoinWarmStartPrimalDual.hpp:227
CoinWarmStartVector::assignVector
void assignVector(int size, T *&vec)
Assign the vector to be the warmstart information.
Definition: CoinWarmStartVector.hpp:47
CoinWarmStartVectorDiff::clear
void clear()
Clear the data.
Definition: CoinWarmStartVector.hpp:223
CoinWarmStartPrimalDualDiff::clear
void clear()
Clear the data.
Definition: CoinWarmStartPrimalDual.hpp:207
CoinWarmStartPrimalDual::clear
void clear()
Clear the data.
Definition: CoinWarmStartPrimalDual.hpp:77
CoinWarmStartPrimalDual::swap
void swap(CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:83
CoinWarmStartPrimalDual::generateDiff
virtual CoinWarmStartDiff * generateDiff(const CoinWarmStart *const oldCWS) const
Generate a `diff&#39; that can convert the warm start passed as a parameter to the warm start specified b...
CoinWarmStartPrimalDual::primalSize
int primalSize() const
return the size of the primal vector
Definition: CoinWarmStartPrimalDual.hpp:25
CoinWarmStartPrimalDual::primal_
CoinWarmStartVector< double > primal_
Definition: CoinWarmStartPrimalDual.hpp:133
CoinWarmStartPrimalDual::applyDiff
virtual void applyDiff(const CoinWarmStartDiff *const cwsdDiff)
Apply diff to this warm start.
CoinWarmStartPrimalDualDiff::~CoinWarmStartPrimalDualDiff
virtual ~CoinWarmStartPrimalDualDiff()
Destructor.
Definition: CoinWarmStartPrimalDual.hpp:171
CoinWarmStartPrimalDualDiff
A `diff&#39; between two CoinWarmStartPrimalDual objects.
Definition: CoinWarmStartPrimalDual.hpp:156
CoinWarmStartPrimalDual::primal
const double * primal() const
return a pointer to the array of primals
Definition: CoinWarmStartPrimalDual.hpp:27
CoinWarmStartVector.hpp
CoinWarmStartPrimalDualDiff::swap
void swap(CoinWarmStartPrimalDualDiff &rhs)
Definition: CoinWarmStartPrimalDual.hpp:213
CoinWarmStartPrimalDual::dual
const double * dual() const
return a pointer to the array of duals
Definition: CoinWarmStartPrimalDual.hpp:22
CoinWarmStart.hpp
Copyright (C) 2000 – 2003, International Business Machines Corporation and others.
CoinWarmStartVectorDiff::swap
void swap(CoinWarmStartVectorDiff &rhs)
Definition: CoinWarmStartVector.hpp:188
CoinWarmStartVector::clear
void clear()
Clear the data.
Definition: CoinWarmStartVector.hpp:106
CoinWarmStartDiff
Abstract base class for warm start `diff&#39; objects.
Definition: CoinWarmStart.hpp:44
CoinWarmStartPrimalDualDiff::CoinWarmStartPrimalDualDiff
CoinWarmStartPrimalDualDiff(const CoinWarmStartPrimalDualDiff &rhs)
Copy constructor.
Definition: CoinWarmStartPrimalDual.hpp:196
CoinWarmStartVector< double >
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:57
CoinWarmStartVector::size
int size() const
return the size of the vector
Definition: CoinWarmStartVector.hpp:40
CoinWarmStartPrimalDual
WarmStart information that is only a dual vector.
Definition: CoinWarmStartPrimalDual.hpp:17
CoinWarmStartVector::swap
void swap(CoinWarmStartVector &rhs)
Definition: CoinWarmStartVector.hpp:82
CoinWarmStartVector::values
const T * values() const
return a pointer to the array of vectors
Definition: CoinWarmStartVector.hpp:42
CoinWarmStartPrimalDualDiff::CoinWarmStartPrimalDualDiff
CoinWarmStartPrimalDualDiff()
Default constructor.
Definition: CoinWarmStartPrimalDual.hpp:180
CoinWarmStartPrimalDual::clone
virtual CoinWarmStart * clone() const
`Virtual constructor&#39;
Definition: CoinWarmStartPrimalDual.hpp:92
CoinWarmStart
Abstract base class for warm start information.
Definition: CoinWarmStart.hpp:21
CoinWarmStartPrimalDual::operator=
CoinWarmStartPrimalDual & operator=(const CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:63
CoinWarmStartPrimalDual::dualSize
int dualSize() const
return the size of the dual vector
Definition: CoinWarmStartPrimalDual.hpp:20