00001 /* $Id: AbcDualRowSteepest.hpp 1910 2013-01-27 02:00:13Z stefan $ */ 00002 // Copyright (C) 2002, International Business Machines 00003 // Corporation and others, Copyright (C) 2012, FasterCoin. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 #ifndef AbcDualRowSteepest_H 00007 #define AbcDualRowSteepest_H 00008 00009 #include "AbcDualRowPivot.hpp" 00010 class CoinIndexedVector; 00011 00012 00013 //############################################################################# 00014 00021 class AbcDualRowSteepest : public AbcDualRowPivot { 00022 00023 public: 00024 00026 00027 00029 virtual int pivotRow(); 00030 00033 virtual double updateWeights(CoinIndexedVector & input,CoinIndexedVector & updatedColumn); 00034 virtual double updateWeights1(CoinIndexedVector & input,CoinIndexedVector & updateColumn); 00035 virtual void updateWeightsOnly(CoinIndexedVector & input); 00037 virtual void updateWeights2(CoinIndexedVector & input,CoinIndexedVector & updateColumn); 00038 00042 virtual void updatePrimalSolution(CoinIndexedVector & input, 00043 double theta); 00044 00045 virtual void updatePrimalSolutionAndWeights(CoinIndexedVector & weightsVector, 00046 CoinIndexedVector & updateColumn, 00047 double theta); 00058 virtual void saveWeights(AbcSimplex * model, int mode); 00060 virtual void recomputeInfeasibilities(); 00062 virtual void clearArrays(); 00064 virtual bool looksOptimal() const; 00066 00069 enum Persistence { 00070 normal = 0x00, // create (if necessary) and destroy 00071 keep = 0x01 // create (if necessary) and leave 00072 }; 00073 00075 00076 00083 AbcDualRowSteepest(int mode = 3); 00084 00086 AbcDualRowSteepest(const AbcDualRowSteepest &); 00087 00089 AbcDualRowSteepest & operator=(const AbcDualRowSteepest& rhs); 00090 00092 void fill(const AbcDualRowSteepest& rhs); 00093 00095 virtual ~AbcDualRowSteepest (); 00096 00098 virtual AbcDualRowPivot * clone(bool copyData = true) const; 00099 00101 00103 00104 inline int mode() const { 00105 return mode_; 00106 } 00108 inline void setPersistence(Persistence life) { 00109 persistence_ = life; 00110 } 00111 inline Persistence persistence() const { 00112 return persistence_ ; 00113 } 00115 inline CoinIndexedVector * infeasible() const 00116 { return infeasible_;} 00118 inline CoinIndexedVector * weights() const 00119 { return weights_;} 00121 inline AbcSimplex * model() const 00122 { return model_;} 00124 00125 //--------------------------------------------------------------------------- 00126 00127 private: 00130 double norm_; 00132 double factorizationRatio_; 00138 int state_; 00141 int mode_; 00143 Persistence persistence_; 00145 CoinIndexedVector * weights_; 00147 CoinIndexedVector * infeasible_; 00149 CoinIndexedVector * savedWeights_; 00151 }; 00152 00153 // For Devex stuff 00154 #undef DEVEX_TRY_NORM 00155 #define DEVEX_TRY_NORM 1.0e-8 00156 #define DEVEX_ADD_ONE 1.0 00157 #endif