# OsiDylpWarmStartBasis.hpp

Go to the documentation of this file.

    00001 #ifndef OsiDylpWarmStartBasis_H
    00002 #define OsiDylpWarmStartBasis_H
    00003
    00017 /*
    00018   sccs: @(#)OsiDylpWarmStartBasis.hpp   1.5     09/16/04
    00019   cvs: $Id: OsiDylpWarmStartBasis.hpp 1408 2009-10-04 10:27:59Z stefan $
    00020 */
    00021
    00022 #include "CoinWarmStartBasis.hpp"
    00023
    00024 class CoinMessageHandler;
    00025
    00026 #define DYLP_INTERNAL
    00027 extern "C" {
    00028 #include "dylp.h"
    00029 }
    00030
    00031
    00032
    00044 class OsiDylpWarmStartBasis : public CoinWarmStartBasis
    00045
    00046 { public:
    00047
    00056
    00059   int numberActiveConstraints() const ;
    00060
    00061
    00064   inline Status getConStatus (int i) const
    00065
    00066   { const int st = (constraintStatus_[i>>2] >> ((i&3)<<1)) & 3 ;
    00067     return (static_cast<CoinWarmStartBasis::Status>(st)) ; }
    00068
    00069
    00072   inline void setConStatus (int i, Status st)
    00073
    00074   { char &st_byte = constraintStatus_[i>>2] ;
    00075     st_byte = static_cast<char>(st_byte & ~(3 << ((i&3)<<1))) ;
    00076     st_byte = static_cast<char>(st_byte | (st << ((i&3)<<1))) ; }
    00077
    00078
    00081   inline char *getConstraintStatus () { return (constraintStatus_) ; }
    00082
    00089   inline const char *getConstraintStatus () const
    00090
    00091   { return (constraintStatus_) ; }
    00092
    00093
    00096   inline void setPhase (dyphase_enum phase) { phase_ = phase ; }
    00097
    00100   inline dyphase_enum getPhase () const { return (phase_) ; }
    00101
    00103
    00106
    00109   CoinWarmStartDiff *generateDiff (const CoinWarmStart *const oldCWS) const ;
    00110
    00113   void applyDiff (const CoinWarmStartDiff *const cwsdDiff) ;
    00114
    00116
    00119
    00122   void setSize (int ns, int na) ;
    00123
    00126   void resize (int numRows, int numCols) ;
    00127
    00140   void compressRows (int tgtCnt, const int *tgts) ;
    00141
    00149   void deleteRows (int number, const int *which) ;
    00150
    00164   virtual void mergeBasis(const CoinWarmStartBasis *src,
    00165                           const XferVec *xferRows,
    00166                           const XferVec *xferCols) ;
    00167
    00169
    00172
    00175   OsiDylpWarmStartBasis () ;
    00176
    00179   OsiDylpWarmStartBasis (int ns, int na, const char *sStat,
    00180                          const char *aStat, const char *cStat = 0) ;
    00181
    00184   OsiDylpWarmStartBasis (const CoinWarmStartBasis &cwsb) ;
    00185
    00188   OsiDylpWarmStartBasis (const OsiDylpWarmStartBasis &ws) ;
    00189
    00192   CoinWarmStart *clone () const ;
    00193
    00196   ~OsiDylpWarmStartBasis () ;
    00197
    00200   OsiDylpWarmStartBasis& operator= (const OsiDylpWarmStartBasis &rhs) ;
    00201
    00204   void assignBasisStatus
    00205     (int ns, int na, char *&sStat, char *&aStat, char *&cStat) ;
    00206
    00209   void assignBasisStatus
    00210     (int ns, int na, char *&sStat, char *&aStat) ;
    00211
    00212
    00214
    00217
    00220   void print () const ;
    00221
    00224   void checkBasis (CoinMessageHandler* msghandler = NULL) const ;
    00225
    00227
    00228   private:
    00229
    00232
    00233   dyphase_enum phase_ ;
    00234
    00235   char *constraintStatus_ ;
    00236
    00238
    00239 } ;
    00240
    00241
    00242
    00266 class OsiDylpWarmStartBasisDiff : public CoinWarmStartBasisDiff
    00267 { public:
    00268
    00270   virtual CoinWarmStartDiff *clone() const
    00271   { OsiDylpWarmStartBasisDiff *odwsbd =  new OsiDylpWarmStartBasisDiff(*this) ;
    00272     return (dynamic_cast<CoinWarmStartDiff *>(odwsbd)) ; }
    00273
    00275   virtual
    00276   OsiDylpWarmStartBasisDiff &operator= (const OsiDylpWarmStartBasisDiff &rhs) ;
    00277
    00279   virtual ~OsiDylpWarmStartBasisDiff()
    00280   { delete[] condiffNdxs_ ;
    00281     delete[] condiffVals_ ; }
    00282
    00283   private:
    00284
    00285   friend CoinWarmStartDiff *OsiDylpWarmStartBasis::generateDiff
    00286     (const CoinWarmStart *const oldCWS) const ;
    00287   friend void OsiDylpWarmStartBasis::applyDiff
    00288     (const CoinWarmStartDiff *const diff) ;
    00289
    00291   OsiDylpWarmStartBasisDiff (int sze, const unsigned int *const diffNdxs,
    00292                              const unsigned int *const diffVals,
    00293                              const CoinWarmStartBasisDiff *const cwsbd) ;
    00294
    00296   OsiDylpWarmStartBasisDiff ()
    00297     : CoinWarmStartBasisDiff(),
    00298       consze_(0),
    00299       condiffNdxs_(0),
    00300       condiffVals_(0)
    00301   { /* intentionally left blank */ }
    00302
    00309   OsiDylpWarmStartBasisDiff (const OsiDylpWarmStartBasisDiff &odwsbd) ;
    00310
    00311   /* Data members */
    00312
    00314   int consze_ ;
    00315
    00318   unsigned int *condiffNdxs_ ;
    00319
    00322   unsigned int *condiffVals_ ;
    00323
    00324 } ;
    00325
    00326
    00327
    00328 #endif // OsiDylpWarmStartBasis_H

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines