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

- File List
- File Members

# /home/coin/svn-release/Blis-0.94.1/CoinUtils/src/CoinWarmStartPrimalDual.hpp

Go to the documentation of this file.

    00001 /* $Id: CoinWarmStartPrimalDual.hpp 1372 2011-01-03 23:31:00Z lou $ */
    00002 // Copyright (C) 2000, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 #ifndef CoinWarmStartPrimalDual_H
    00007 #define CoinWarmStartPrimalDual_H
    00008
    00009 #include "CoinHelperFunctions.hpp"
    00010 #include "CoinWarmStart.hpp"
    00011 #include "CoinWarmStartVector.hpp"
    00012
    00013
    00014 //#############################################################################
    00015
    00018 class CoinWarmStartPrimalDual : public virtual CoinWarmStart {
    00019 public:
    00021   inline int dualSize() const { return dual_.size(); }
    00023   inline const double * dual() const { return dual_.values(); }
    00024
    00026   inline int primalSize() const { return primal_.size(); }
    00028   inline const double * primal() const { return primal_.values(); }
    00029
    00039   void assign(int primalSize, int dualSize, double*& primal, double *& dual) {
    00040     primal_.assignVector(primalSize, primal);
    00041     dual_.assignVector(dualSize, dual);
    00042   }
    00043
    00044   CoinWarmStartPrimalDual() : primal_(), dual_() {}
    00045
    00046   CoinWarmStartPrimalDual(int primalSize, int dualSize,
    00047                           const double* primal, const double * dual) :
    00048     primal_(primalSize, primal), dual_(dualSize, dual) {}
    00049
    00050   CoinWarmStartPrimalDual(const CoinWarmStartPrimalDual& rhs) :
    00051     primal_(rhs.primal_), dual_(rhs.dual_) {}
    00052
    00053   CoinWarmStartPrimalDual& operator=(const CoinWarmStartPrimalDual& rhs) {
    00054     if (this != &rhs) {
    00055       primal_ = rhs.primal_;
    00056       dual_ = rhs.dual_;
    00057     }
    00058     return *this;
    00059   }
    00060
    00066   inline void clear() {
    00067     primal_.clear();
    00068     dual_.clear();
    00069   }
    00070
    00071   inline void swap(CoinWarmStartPrimalDual& rhs) {
    00072     if (this != &rhs) {
    00073       primal_.swap(rhs.primal_);
    00074       dual_.swap(rhs.dual_);
    00075     }
    00076   }
    00077
    00079   virtual CoinWarmStart *clone() const {
    00080     return new CoinWarmStartPrimalDual(*this);
    00081   }
    00082
    00083   virtual ~CoinWarmStartPrimalDual() {}
    00084
    00087
    00095   virtual CoinWarmStartDiff*
    00096   generateDiff (const CoinWarmStart *const oldCWS) const ;
    00097
    00104   virtual void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
    00105
    00107
    00108 #if 0
    00109 protected:
    00110   inline const CoinWarmStartVector<double>& primalWarmStartVector() const
    00111   { return primal_; }
    00112   inline const CoinWarmStartVector<double>& dualWarmStartVector() const
    00113   { return dual_; }
    00114 #endif
    00115
    00116 private:
    00118
    00119   CoinWarmStartVector<double> primal_;
    00120   CoinWarmStartVector<double> dual_;
    00122 };
    00123
    00124 //#############################################################################
    00125
    00142 class CoinWarmStartPrimalDualDiff : public virtual CoinWarmStartDiff
    00143 {
    00144   friend CoinWarmStartDiff*
    00145   CoinWarmStartPrimalDual::generateDiff(const CoinWarmStart *const oldCWS) const;
    00146   friend void
    00147   CoinWarmStartPrimalDual::applyDiff(const CoinWarmStartDiff *const diff) ;
    00148
    00149 public:
    00150
    00153   virtual CoinWarmStartDiff *clone() const
    00154   {
    00155     return new CoinWarmStartPrimalDualDiff(*this);
    00156   }
    00157
    00159   virtual ~CoinWarmStartPrimalDualDiff() {}
    00160
    00161 protected:
    00162
    00169   CoinWarmStartPrimalDualDiff () : primalDiff_(), dualDiff_() {}
    00170
    00181   CoinWarmStartPrimalDualDiff (const CoinWarmStartPrimalDualDiff &rhs) :
    00182     primalDiff_(rhs.primalDiff_), dualDiff_(rhs.dualDiff_) {}
    00183
    00189   inline void clear() {
    00190     primalDiff_.clear();
    00191     dualDiff_.clear();
    00192   }
    00193
    00194   inline void swap(CoinWarmStartPrimalDualDiff& rhs) {
    00195     if (this != &rhs) {
    00196       primalDiff_.swap(rhs.primalDiff_);
    00197       dualDiff_.swap(rhs.dualDiff_);
    00198     }
    00199   }
    00200
    00201 private:
    00202
    00207   CoinWarmStartVectorDiff<double> primalDiff_;
    00208   CoinWarmStartVectorDiff<double> dualDiff_;
    00209 } ;
    00210
    00211 #endif