Changeset 2303:005b3f927287 in lemon-0.x
- Timestamp:
- 11/14/06 10:49:26 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3076
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_base.h
r2268 r2303 40 40 { 41 41 protected: 42 int _first_index; 43 int first_free; 44 public: 42 45 std::vector<int> index; 43 46 std::vector<int> cross; 44 int first_free; 45 public: 46 _FixId() : first_free(-1) {}; 47 _FixId() : _first_index(-1), first_free(-1) {}; 47 48 ///Convert a floating id to a fix one 48 49 … … 62 63 int insert(int n) 63 64 { 65 if(cross.empty()) _first_index=n; 64 66 if(n>=int(cross.size())) { 65 67 cross.resize(n+1); … … 102 104 std::size_t maxFixId() { return cross.size()-1; } 103 105 106 ///Returns the first (smallest) inserted index 107 108 ///Returns the first (smallest) inserted index 109 ///or -1 if no index has been inserted before. 110 int firstIndex() {return _first_index;} 104 111 }; 105 112 … … 109 116 ///\ingroup gen_opt_group 110 117 class LpSolverBase { 118 119 protected: 120 _FixId rows; 121 _FixId cols; 111 122 112 123 public: … … 164 175 165 176 static inline bool isNaN(const Value& v) { return v!=v; } 177 178 friend class Col; 179 friend class ColIt; 180 friend class Row; 166 181 167 182 ///Refer to a column of the LP. … … 190 205 }; 191 206 207 class ColIt : public Col { 208 LpSolverBase *_lp; 209 ColIt() {} 210 ColIt(LpSolverBase &lp) : _lp(&lp) 211 { 212 id = _lp->cols.cross.empty()?-1: 213 _lp->cols.fixId(_lp->cols.firstIndex()); 214 } 215 ColIt(const Invalid&) : Col(INVALID) {} 216 ColIt &operator++() 217 { 218 int fid = _lp->cols.floatingId(id)+1; 219 id = unsigned(fid)<_lp->cols.cross.size() ? _lp->cols.fixId(fid) : -1; 220 return *this; 221 } 222 }; 223 192 224 ///Refer to a row of the LP. 193 225 … … 565 597 566 598 protected: 567 _FixId rows;568 _FixId cols;569 599 570 600 //Abstract virtual functions … … 580 610 581 611 virtual int _addCol() = 0; 582 virtual int _addRow() = 0; 612 virtual int _addRow() = 0; 583 613 virtual void _eraseCol(int col) = 0; 584 614 virtual void _eraseRow(int row) = 0;
Note: See TracChangeset
for help on using the changeset viewer.