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

- File List
- File Members

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

Go to the documentation of this file.

    00001 /* $Id: CoinWarmStartPrimalDual.hpp 1191 2009-07-25 08:38:12Z forrest $ */
    00002 // Copyright (C) 2000, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004
    00005 #ifndef CoinWarmStartPrimalDual_H
    00006 #define CoinWarmStartPrimalDual_H
    00007
    00008 #include "CoinHelperFunctions.hpp"
    00009 #include "CoinWarmStart.hpp"
    00010 #include "CoinWarmStartVector.hpp"
    00011
    00012
    00013 //#############################################################################
    00014
    00017 class CoinWarmStartPrimalDual : public virtual CoinWarmStart {
    00018 public:
    00020   inline int dualSize() const { return dual_.size(); }
    00022   inline const double * dual() const { return dual_.values(); }
    00023
    00025   inline int primalSize() const { return primal_.size(); }
    00027   inline const double * primal() const { return primal_.values(); }
    00028
    00038   void assign(int primalSize, int dualSize, double*& primal, double *& dual) {
    00039     primal_.assignVector(primalSize, primal);
    00040     dual_.assignVector(dualSize, dual);
    00041   }
    00042
    00043   CoinWarmStartPrimalDual() : primal_(), dual_() {}
    00044
    00045   CoinWarmStartPrimalDual(int primalSize, int dualSize,
    00046                           const double* primal, const double * dual) :
    00047     primal_(primalSize, primal), dual_(dualSize, dual) {}
    00048
    00049   CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual& rhs) :
    00050     primal_(rhs.primal_), dual_(rhs.dual_) {}
    00051
    00052   CoinWarmStartPrimalDual& operator=(const CoinWarmStartPrimalDual& rhs) {
    00053     if (this != &rhs) {
    00054       primal_ = rhs.primal_;
    00055       dual_ = rhs.dual_;
    00056     }
    00057     return *this;
    00058   }
    00059
    00065   inline void clear() {
    00066     primal_.clear();
    00067     dual_.clear();
    00068   }
    00069
    00070   inline void swap(CoinWarmStartPrimalDual& rhs) {
    00071     if (this != &rhs) {
    00072       primal_.swap(rhs.primal_);
    00073       dual_.swap(rhs.dual_);
    00074     }
    00075   }
    00076
    00078   virtual CoinWarmStart *clone() const {
    00079     return new CoinWarmStartPrimalDual(*this);
    00080   }
    00081
    00082   virtual ~CoinWarmStartPrimalDual() {}
    00083
    00086
    00094   virtual CoinWarmStartDiff*
    00095   generateDiff (const CoinWarmStart *const oldCWS) const ;
    00096
    00103   virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
    00104
    00106
    00107 #if 0
    00108 protected:
    00109   inline const CoinWarmStartVector<double>& primalWarmStartVector() const
    00110   { return primal_; }
    00111   inline const CoinWarmStartVector<double>& dualWarmStartVector() const
    00112   { return dual_; }
    00113 #endif
    00114
    00115 private:
    00117
    00118   CoinWarmStartVector<double> primal_;
    00119   CoinWarmStartVector<double> dual_;
    00121 };
    00122
    00123 //#############################################################################
    00124
    00141 class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff
    00142 {
    00143   friend CoinWarmStartDiff*
    00144   CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
    00145   friend void
    00146   CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff) ;
    00147
    00148 public:
    00149
    00152   virtual CoinWarmStartDiff *clone() const
    00153   {
    00154     return new CoinWarmStartPrimalDualDiff(*this);
    00155   }
    00156
    00158   virtual ~CoinWarmStartPrimalDualDiff() {}
    00159
    00160 protected:
    00161
    00168   CoinWarmStartPrimalDualDiff () : primalDiff_(), dualDiff_() {}
    00169
    00180   CoinWarmStartPrimalDualDiff (const CoinWarmStartPrimalDualDiff &rhs) :
    00181     primalDiff_(rhs.primalDiff_), dualDiff_(rhs.dualDiff_) {}
    00182
    00188   inline void clear() {
    00189     primalDiff_.clear();
    00190     dualDiff_.clear();
    00191   }
    00192
    00193   inline void swap(CoinWarmStartPrimalDualDiff& rhs) {
    00194     if (this != &rhs) {
    00195       primalDiff_.swap(rhs.primalDiff_);
    00196       dualDiff_.swap(rhs.dualDiff_);
    00197     }
    00198   }
    00199
    00200 private:
    00201
    00206   CoinWarmStartVectorDiff<double> primalDiff_;
    00207   CoinWarmStartVectorDiff<double> dualDiff_;
    00208 } ;
    00209
    00210 #endif