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

- File List
- File Members

# /home/coin/SVN-release/DyLP-1.5.0/CoinUtils/src/CoinWarmStartPrimalDual.hpp

Go to the documentation of this file.

    00001 // Copyright (C) 2000, International Business Machines
    00002 // Corporation and others.  All Rights Reserved.
    00003
    00004 #ifndef CoinWarmStartPrimalDual_H
    00005 #define CoinWarmStartPrimalDual_H
    00006
    00007 #include "CoinHelperFunctions.hpp"
    00008 #include "CoinWarmStart.hpp"
    00009 #include "CoinWarmStartVector.hpp"
    00010
    00011
    00012 //#############################################################################
    00013
    00016 class CoinWarmStartPrimalDual : public virtual CoinWarmStart {
    00017 public:
    00019   inline int dualSize() const { return dual_.size(); }
    00021   inline const double * dual() const { return dual_.values(); }
    00022
    00024   inline int primalSize() const { return primal_.size(); }
    00026   inline const double * primal() const { return primal_.values(); }
    00027
    00037   void assign(int primalSize, int dualSize, double*& primal, double *& dual) {
    00038     primal_.assignVector(primalSize, primal);
    00039     dual_.assignVector(dualSize, dual);
    00040   }
    00041
    00042   CoinWarmStartPrimalDual() : primal_(), dual_() {}
    00043
    00044   CoinWarmStartPrimalDual(int primalSize, int dualSize,
    00045                           const double* primal, const double * dual) :
    00046     primal_(primalSize, primal), dual_(dualSize, dual) {}
    00047
    00048   CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual& rhs) :
    00049     primal_(rhs.primal_), dual_(rhs.dual_) {}
    00050
    00051   CoinWarmStartPrimalDual& operator=(const CoinWarmStartPrimalDual& rhs) {
    00052     if (this != &rhs) {
    00053       primal_ = rhs.primal_;
    00054       dual_ = rhs.dual_;
    00055     }
    00056     return *this;
    00057   }
    00058
    00064   inline void clear() {
    00065     primal_.clear();
    00066     dual_.clear();
    00067   }
    00068
    00069   inline void swap(CoinWarmStartPrimalDual& rhs) {
    00070     if (this != &rhs) {
    00071       primal_.swap(rhs.primal_);
    00072       dual_.swap(rhs.dual_);
    00073     }
    00074   }
    00075
    00077   virtual CoinWarmStart *clone() const {
    00078     return new CoinWarmStartPrimalDual(*this);
    00079   }
    00080
    00081   virtual ~CoinWarmStartPrimalDual() {}
    00082
    00085
    00093   virtual CoinWarmStartDiff*
    00094   generateDiff (const CoinWarmStart *const oldCWS) const ;
    00095
    00102   virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
    00103
    00105
    00106 #if 0
    00107 protected:
    00108   inline const CoinWarmStartVector<double>& primalWarmStartVector() const
    00109   { return primal_; }
    00110   inline const CoinWarmStartVector<double>& dualWarmStartVector() const
    00111   { return dual_; }
    00112 #endif
    00113
    00114 private:
    00116
    00117   CoinWarmStartVector<double> primal_;
    00118   CoinWarmStartVector<double> dual_;
    00120 };
    00121
    00122 //#############################################################################
    00123
    00140 class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff
    00141 {
    00142   friend CoinWarmStartDiff*
    00143   CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
    00144   friend void
    00145   CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff) ;
    00146
    00147 public:
    00148
    00151   virtual CoinWarmStartDiff *clone() const
    00152   {
    00153     return new CoinWarmStartPrimalDualDiff(*this);
    00154   }
    00155
    00157   virtual ~CoinWarmStartPrimalDualDiff() {}
    00158
    00159 protected:
    00160
    00167   CoinWarmStartPrimalDualDiff () : primalDiff_(), dualDiff_() {}
    00168
    00179   CoinWarmStartPrimalDualDiff (const CoinWarmStartPrimalDualDiff &rhs) :
    00180     primalDiff_(rhs.primalDiff_), dualDiff_(rhs.dualDiff_) {}
    00181
    00187   inline void clear() {
    00188     primalDiff_.clear();
    00189     dualDiff_.clear();
    00190   }
    00191
    00192   inline void swap(CoinWarmStartPrimalDualDiff& rhs) {
    00193     if (this != &rhs) {
    00194       primalDiff_.swap(rhs.primalDiff_);
    00195       dualDiff_.swap(rhs.dualDiff_);
    00196     }
    00197   }
    00198
    00199 private:
    00200
    00205   CoinWarmStartVectorDiff<double> primalDiff_;
    00206   CoinWarmStartVectorDiff<double> dualDiff_;
    00207 } ;
    00208
    00209 #endif