Cbc  2.9.9
 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 
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 
45 
47  const double* primal, const double * dual) :
48  primal_(primalSize, primal), dual_(dualSize, dual) {}
49 
51  primal_(rhs.primal_), dual_(rhs.dual_) {}
52 
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 
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 
122 };
123 
124 //#############################################################################
125 
143 {
144  friend CoinWarmStartDiff*
145  CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
146  friend void
148 
149 public:
150 
153  virtual CoinWarmStartDiff *clone() const
154  {
155  return new CoinWarmStartPrimalDualDiff(*this);
156  }
157 
160 
161 protected:
162 
170 
183 
189  inline void clear() {
190  primalDiff_.clear();
191  dualDiff_.clear();
192  }
193 
194  inline void swap(CoinWarmStartPrimalDualDiff& rhs) {
195  if (this != &rhs) {
197  dualDiff_.swap(rhs.dualDiff_);
198  }
199  }
200 
201 private:
202 
209 } ;
210 
211 #endif
void assign(int primalSize, int dualSize, double *&primal, double *&dual)
Assign the primal/dual vectors to be the warmstart information.
CoinWarmStartVector< double > dual_
CoinWarmStartVectorDiff< double > dualDiff_
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.
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
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)
CoinWarmStartVector< double > primal_
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