CoinUtils trunk
|
00001 /* $Id$ */ 00002 // Copyright (C) 2002, 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 CoinPresolveFixed_H 00007 #define CoinPresolveFixed_H 00008 #define FIXED_VARIABLE 1 00009 00025 class remove_fixed_action : public CoinPresolveAction { 00026 public: 00030 struct action { 00031 int col; 00032 int start; 00033 double sol; 00034 }; 00036 int *colrows_; 00038 double *colels_; 00040 int nactions_; 00042 action *actions_; 00043 00044 private: 00046 remove_fixed_action(int nactions, 00047 action *actions, 00048 double * colels, 00049 int * colrows, 00050 const CoinPresolveAction *next); 00051 00052 public: 00054 const char *name() const; 00055 00063 static const remove_fixed_action *presolve(CoinPresolveMatrix *prob, 00064 int *fcols, 00065 int nfcols, 00066 const CoinPresolveAction *next); 00067 00068 void postsolve(CoinPostsolveMatrix *prob) const; 00069 00071 ~remove_fixed_action(); 00072 }; 00073 00074 00082 const CoinPresolveAction *remove_fixed(CoinPresolveMatrix *prob, 00083 const CoinPresolveAction *next); 00084 00085 00095 class make_fixed_action : public CoinPresolveAction { 00096 00098 struct action { 00099 double bound; 00100 int col ; 00101 }; 00102 00104 int nactions_; 00106 const action *actions_; 00107 00112 const bool fix_to_lower_; 00113 00115 const remove_fixed_action *faction_; 00116 00118 make_fixed_action(int nactions, 00119 const action *actions, 00120 bool fix_to_lower, 00121 const remove_fixed_action *faction, 00122 const CoinPresolveAction *next) : 00123 CoinPresolveAction(next), 00124 nactions_(nactions), actions_(actions), 00125 fix_to_lower_(fix_to_lower), 00126 faction_(faction) 00127 {} 00128 00129 public: 00131 const char *name() const; 00132 00140 static const CoinPresolveAction *presolve(CoinPresolveMatrix *prob, 00141 int *fcols, 00142 int nfcols, 00143 bool fix_to_lower, 00144 const CoinPresolveAction *next); 00145 00150 void postsolve(CoinPostsolveMatrix *prob) const; 00151 00153 ~make_fixed_action() { 00154 deleteAction(actions_,action*); 00155 delete faction_; 00156 } 00157 }; 00158 00166 const CoinPresolveAction *make_fixed(CoinPresolveMatrix *prob, 00167 const CoinPresolveAction *next); 00169 void transferCosts(CoinPresolveMatrix * prob); 00170 #endif