CoinUtils 2.10.15

- 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 1372 2011-01-03 23:31:00Z lou $ */
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 //#############################################################################
15
18 class CoinWarmStartPrimalDual : public virtual CoinWarmStart {
19 public:
21 inline int dualSize() const { return dual_.size(); }
23 inline const double * dual() const { return dual_.values(); }
24
26 inline int primalSize() const { return primal_.size(); }
28 inline const double * primal() const { return primal_.values(); }
29
39 void assign(int primalSize, int dualSize, double*& primal, double *& dual) {
40 primal_.assignVector(primalSize, primal);
41 dual_.assignVector(dualSize, dual);
42 }
43
44 CoinWarmStartPrimalDual() : primal_(), dual_() {}
45
46 CoinWarmStartPrimalDual(int primalSize, int dualSize,
47 const double* primal, const double * dual) :
48 primal_(primalSize, primal), dual_(dualSize, dual) {}
49
50 CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual& rhs) :
51 primal_(rhs.primal_), dual_(rhs.dual_) {}
52
53 CoinWarmStartPrimalDual& operator=(const CoinWarmStartPrimalDual& rhs) {
54 if (this != &rhs) {
55 primal_ = rhs.primal_;
56 dual_ = rhs.dual_;
57 }
58 return *this;
59 }
60
66 inline void clear() {
67 primal_.clear();
68 dual_.clear();
69 }
70
71 inline void swap(CoinWarmStartPrimalDual& rhs) {
72 if (this != &rhs) {
73 primal_.swap(rhs.primal_);
74 dual_.swap(rhs.dual_);
75 }
76 }
77
79 virtual CoinWarmStart *clone() const {
80 return new CoinWarmStartPrimalDual(*this);
81 }
82
83 virtual ~CoinWarmStartPrimalDual() {}
84
87
95 virtual CoinWarmStartDiff*
96 generateDiff (const CoinWarmStart *const oldCWS) const ;
97
104 virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
105
107
108 #if 0
109 protected:
110 inline const CoinWarmStartVector<double>& primalWarmStartVector() const
111 { return primal_; }
112 inline const CoinWarmStartVector<double>& dualWarmStartVector() const
113 { return dual_; }
114 #endif
115
116 private:
118
119 CoinWarmStartVector<double> primal_;
120 CoinWarmStartVector<double> dual_;
122 };
123
124 //#############################################################################
125
142 class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff
143 {
144 friend CoinWarmStartDiff*
145 CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
146 friend void
147 CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff) ;
148
149 public:
150
153 virtual CoinWarmStartDiff *clone() const
154 {
155 return new CoinWarmStartPrimalDualDiff(*this);
156 }
157
159 virtual ~CoinWarmStartPrimalDualDiff() {}
160
161 protected:
162
169 CoinWarmStartPrimalDualDiff () : primalDiff_(), dualDiff_() {}
170
181 CoinWarmStartPrimalDualDiff (const CoinWarmStartPrimalDualDiff &rhs) :
182 primalDiff_(rhs.primalDiff_), dualDiff_(rhs.dualDiff_) {}
183
189 inline void clear() {
190 primalDiff_.clear();
191 dualDiff_.clear();
192 }
193
194 inline void swap(CoinWarmStartPrimalDualDiff& rhs) {
195 if (this != &rhs) {
196 primalDiff_.swap(rhs.primalDiff_);
197 dualDiff_.swap(rhs.dualDiff_);
198 }
199 }
200
201 private:
202
207 CoinWarmStartVectorDiff<double> primalDiff_;
208 CoinWarmStartVectorDiff<double> dualDiff_;
209 } ;
210
211 #endif
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:39
CoinWarmStartPrimalDual::dual_
CoinWarmStartVector< double > dual_
Definition: CoinWarmStartPrimalDual.hpp:120
CoinWarmStartPrimalDual::~CoinWarmStartPrimalDual
virtual ~CoinWarmStartPrimalDual()
Definition: CoinWarmStartPrimalDual.hpp:83
CoinWarmStartPrimalDualDiff::dualDiff_
CoinWarmStartVectorDiff< double > dualDiff_
Definition: CoinWarmStartPrimalDual.hpp:208
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual()
Definition: CoinWarmStartPrimalDual.hpp:44
CoinWarmStartPrimalDualDiff::clone
virtual CoinWarmStartDiff * clone() const
`Virtual constructor&#39;.
Definition: CoinWarmStartPrimalDual.hpp:153
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual(int primalSize, int dualSize, const double *primal, const double *dual)
Definition: CoinWarmStartPrimalDual.hpp:46
CoinWarmStartPrimalDualDiff::primalDiff_
CoinWarmStartVectorDiff< double > primalDiff_
These two differences describe the differences in the primal and in the dual vector.
Definition: CoinWarmStartPrimalDual.hpp:207
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:204
CoinWarmStartPrimalDualDiff::clear
void clear()
Clear the data.
Definition: CoinWarmStartPrimalDual.hpp:189
CoinWarmStartPrimalDual::clear
void clear()
Clear the data.
Definition: CoinWarmStartPrimalDual.hpp:66
CoinWarmStartPrimalDual::swap
void swap(CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:71
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:26
CoinWarmStartPrimalDual::applyDiff
virtual void applyDiff(const CoinWarmStartDiff *const cwsdDiff)
Apply diff to this warm start.
CoinWarmStartPrimalDualDiff::~CoinWarmStartPrimalDualDiff
virtual ~CoinWarmStartPrimalDualDiff()
Destructor.
Definition: CoinWarmStartPrimalDual.hpp:159
CoinWarmStartPrimalDualDiff
A `diff&#39; between two CoinWarmStartPrimalDual objects.
Definition: CoinWarmStartPrimalDual.hpp:142
CoinWarmStartPrimalDual::primal
const double * primal() const
return a pointer to the array of primals
Definition: CoinWarmStartPrimalDual.hpp:28
CoinWarmStartVector.hpp
CoinWarmStartPrimalDualDiff::swap
void swap(CoinWarmStartPrimalDualDiff &rhs)
Definition: CoinWarmStartPrimalDual.hpp:194
CoinWarmStartPrimalDual::dual
const double * dual() const
return a pointer to the array of duals
Definition: CoinWarmStartPrimalDual.hpp:23
CoinWarmStart.hpp
Copyright (C) 2000 – 2003, International Business Machines Corporation and others.
CoinWarmStartVectorDiff::swap
void swap(CoinWarmStartVectorDiff &rhs)
Definition: CoinWarmStartVector.hpp:175
CoinWarmStartVector::clear
void clear()
Clear the data.
Definition: CoinWarmStartVector.hpp:94
CoinWarmStartDiff
Abstract base class for warm start `diff&#39; objects.
Definition: CoinWarmStart.hpp:48
CoinWarmStartPrimalDualDiff::CoinWarmStartPrimalDualDiff
CoinWarmStartPrimalDualDiff(const CoinWarmStartPrimalDualDiff &rhs)
Copy constructor.
Definition: CoinWarmStartPrimalDual.hpp:181
CoinWarmStartVector< double >
CoinWarmStartPrimalDual::CoinWarmStartPrimalDual
CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:50
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:18
CoinWarmStartVector::swap
void swap(CoinWarmStartVector &rhs)
Definition: CoinWarmStartVector.hpp:73
CoinWarmStartPrimalDual::primal_
CoinWarmStartVector< double > primal_
Definition: CoinWarmStartPrimalDual.hpp:119
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:169
CoinWarmStartPrimalDual::clone
virtual CoinWarmStart * clone() const
`Virtual constructor&#39;
Definition: CoinWarmStartPrimalDual.hpp:79
CoinWarmStart
Abstract base class for warm start information.
Definition: CoinWarmStart.hpp:21
CoinWarmStartPrimalDual::operator=
CoinWarmStartPrimalDual & operator=(const CoinWarmStartPrimalDual &rhs)
Definition: CoinWarmStartPrimalDual.hpp:53
CoinWarmStartPrimalDual::dualSize
int dualSize() const
return the size of the dual vector
Definition: CoinWarmStartPrimalDual.hpp:21