Bonmin  1.7
BonFilterWarmStart.hpp
Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation, 2006
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // Pierre Bonami, International Business Machines Corporation
00007 //
00008 // Date : 11/21/2006
00009 
00010 
00011 
00012 
00013 #ifndef BonFilterWarmStart_H
00014 #define BonFilterWarmStart_H
00015 
00016 #include "CoinWarmStartBasis.hpp"
00017 #include "CoinWarmStartPrimalDual.hpp"
00018 #include "BonFilterTypes.hpp" /* for types */
00019 #include "CoinSmartPtr.hpp"
00020 
00021 #include <vector>
00022 
00023 namespace Bonmin
00024 {
00025 
00033   class FilterWarmStart :
00034     public virtual CoinWarmStartPrimalDual, public virtual CoinWarmStartBasis,
00035     public Coin::ReferencedObject
00036   {
00037     typedef FilterTypes::fint fint;
00038     typedef FilterTypes::real real;
00039 
00040   public:
00042     static fint def_istat[14];
00044     FilterWarmStart(const fint xSize = 0,
00045         const real* xArray = NULL,
00046         const fint lamSize = 0,
00047         const real* lamArray = NULL,
00048         const fint lwsSize = 0,
00049         const fint *lwsArray = NULL,
00050         const fint istat[14] = def_istat);
00051 
00053     FilterWarmStart(const FilterWarmStart & other);
00054 
00056     virtual CoinWarmStart * clone() const
00057     {
00058       return new FilterWarmStart(*this);
00059     }
00060 
00062     virtual ~FilterWarmStart();
00063 
00065     virtual CoinWarmStartDiff* generateDiff(const CoinWarmStart * const other) const;
00066 
00068     virtual void applyDiff(const CoinWarmStartDiff * const cswDiff);
00069 
00071     const fint *lwsArray() const
00072     {
00073       return lwsArray_;
00074     }
00075 
00077     fint lwsSize() const
00078     {
00079       return lwsSize_;
00080     }
00081 
00082     const fint* istat()const
00083     {
00084       return istat_;
00085     }
00086 
00088     void flushPoint();
00089 
00091     bool empty() const
00092     {
00093       return empty_;
00094     }
00095   private:
00097     fint lwsSize_;
00098 
00100     fint* lwsArray_;
00101 
00103     fint istat_[14];
00104 
00106     bool empty_;
00107   };
00108 
00109   class FilterWarmStartDiff : public CoinWarmStartPrimalDualDiff
00110   {
00111     typedef FilterTypes::fint fint;
00112     typedef FilterTypes::real real;
00113 
00114     friend class FilterWarmStart;
00115 
00116   public:
00117     FilterWarmStartDiff(CoinWarmStartPrimalDualDiff * diff,
00118                         fint capacity);
00119 
00120     virtual ~FilterWarmStartDiff() {}
00121 
00122     virtual CoinWarmStartDiff * clone() const
00123     {
00124       return new FilterWarmStartDiff(*this);
00125     }
00126 
00127     void flushPoint();
00128   private:
00130     typedef std::pair<fint, fint> OneDiff;
00132     std::vector<OneDiff> differences;
00134     fint istat_[14];
00135   };
00136 
00137 } /* end namespace Bonmin */
00138 #endif
00139