Clp  1.17.6
 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 
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 
45  : primal_()
46  , dual_()
47  {
48  }
49 
51  const double *primal, const double *dual)
52  : primal_(primalSize, primal)
53  , dual_(dualSize, dual)
54  {
55  }
56 
58  : primal_(rhs.primal_)
59  , dual_(rhs.dual_)
60  {
61  }
62 
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 
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 
136 };
137 
138 //#############################################################################
139 
157  friend CoinWarmStartDiff *
158  CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
159  friend void
161 
162 public:
165  virtual CoinWarmStartDiff *clone() const
166  {
167  return new CoinWarmStartPrimalDualDiff(*this);
168  }
169 
172 
173 protected:
181  : primalDiff_()
182  , dualDiff_()
183  {
184  }
185 
197  : primalDiff_(rhs.primalDiff_)
198  , dualDiff_(rhs.dualDiff_)
199  {
200  }
201 
207  inline void clear()
208  {
209  primalDiff_.clear();
210  dualDiff_.clear();
211  }
212 
214  {
215  if (this != &rhs) {
217  dualDiff_.swap(rhs.dualDiff_);
218  }
219  }
220 
221 private:
228 };
229 
230 #endif
231 
232 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
233 */
void assign(int primalSize, int dualSize, double *&primal, double *&dual)
Assign the primal/dual vectors to be the warmstart information.
virtual CoinWarmStartDiff * clone() const
`Virtual constructor&#39;.
CoinWarmStartPrimalDual(int primalSize, int dualSize, const double *primal, const double *dual)
CoinWarmStartVectorDiff< double > primalDiff_
These two differences describe the differences in the primal and in the dual vector.
CoinWarmStartVector< double > dual_
CoinWarmStartVectorDiff< double > dualDiff_
void assignVector(int size, T *&vec)
Assign the vector to be the warmstart information.
void clear()
Clear the data.
void clear()
Clear the data.
void swap(CoinWarmStartPrimalDual &rhs)
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...
int primalSize() const
return the size of the primal vector
CoinWarmStartVector< double > primal_
virtual void applyDiff(const CoinWarmStartDiff *const cwsdDiff)
Apply diff to this warm start.
virtual ~CoinWarmStartPrimalDualDiff()
Destructor.
A `diff&#39; between two CoinWarmStartPrimalDual objects.
const double * primal() const
return a pointer to the array of primals
void swap(CoinWarmStartPrimalDualDiff &rhs)
const double * dual() const
return a pointer to the array of duals
Copyright (C) 2000 – 2003, International Business Machines Corporation and others.
void swap(CoinWarmStartVectorDiff &rhs)
void clear()
Clear the data.
Abstract base class for warm start `diff&#39; objects.
CoinWarmStartPrimalDualDiff(const CoinWarmStartPrimalDualDiff &rhs)
Copy constructor.
CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual &rhs)
int size() const
return the size of the vector
WarmStart information that is only a dual vector.
void swap(CoinWarmStartVector &rhs)
const T * values() const
return a pointer to the array of vectors
CoinWarmStartPrimalDualDiff()
Default constructor.
virtual CoinWarmStart * clone() const
`Virtual constructor&#39;
Abstract base class for warm start information.
CoinWarmStartPrimalDual & operator=(const CoinWarmStartPrimalDual &rhs)
int dualSize() const
return the size of the dual vector