Changeset 1094:140facbd1d7c in lemon
 Timestamp:
 11/01/11 13:53:06 (8 years ago)
 Branch:
 1.2
 Parents:
 1090:c1a959df3b2c (diff), 1092:2eebc8f7dca5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.  Phase:
 public
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

lemon/lp_base.h
r956 r1094 1619 1619 inline LpBase::Constr operator<=(const LpBase::Expr &e, 1620 1620 const LpBase::Expr &f) { 1621 return LpBase::Constr(0, f  e, LpBase:: INF);1621 return LpBase::Constr(0, f  e, LpBase::NaN); 1622 1622 } 1623 1623 … … 1637 1637 inline LpBase::Constr operator<=(const LpBase::Expr &e, 1638 1638 const LpBase::Value &f) { 1639 return LpBase::Constr(  LpBase::INF, e, f);1639 return LpBase::Constr(LpBase::NaN, e, f); 1640 1640 } 1641 1641 … … 1646 1646 inline LpBase::Constr operator>=(const LpBase::Expr &e, 1647 1647 const LpBase::Expr &f) { 1648 return LpBase::Constr(0, e  f, LpBase:: INF);1648 return LpBase::Constr(0, e  f, LpBase::NaN); 1649 1649 } 1650 1650 … … 1666 1666 inline LpBase::Constr operator>=(const LpBase::Expr &e, 1667 1667 const LpBase::Value &f) { 1668 return LpBase::Constr(f, e, LpBase:: INF);1668 return LpBase::Constr(f, e, LpBase::NaN); 1669 1669 } 1670 1670 
lemon/lp_base.h
r1092 r1094 3 3 * This file is a part of LEMON, a generic C++ optimization library. 4 4 * 5 * Copyright (C) 200320 085 * Copyright (C) 20032010 6 6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 7 7 * (Egervary Research Group on Combinatorial Optimization, EGRES). … … 83 83 MESSAGE_VERBOSE 84 84 }; 85 85 86 86 87 87 ///The floating point type used by the solver … … 115 115 typedef True LpCol; 116 116 /// Default constructor 117 117 118 118 /// \warning The default constructor sets the Col to an 119 119 /// undefined value. 120 120 Col() {} 121 121 /// Invalid constructor \& conversion. 122 122 123 123 /// This constructor initializes the Col to be invalid. 124 /// \sa Invalid for more details. 124 /// \sa Invalid for more details. 125 125 Col(const Invalid&) : _id(1) {} 126 126 /// Equality operator … … 147 147 ///Iterator for iterate over the columns of an LP problem 148 148 149 /// Its usage is quite simple, for example you can count the number149 /// Its usage is quite simple, for example, you can count the number 150 150 /// of columns in an LP \c lp: 151 151 ///\code … … 157 157 public: 158 158 /// Default constructor 159 159 160 160 /// \warning The default constructor sets the iterator 161 161 /// to an undefined value. 162 162 ColIt() {} 163 163 /// Sets the iterator to the first Col 164 164 165 165 /// Sets the iterator to the first Col. 166 166 /// … … 170 170 } 171 171 /// Invalid constructor \& conversion 172 172 173 173 /// Initialize the iterator to be invalid. 174 174 /// \sa Invalid for more details. 175 175 ColIt(const Invalid&) : Col(INVALID) {} 176 176 /// Next column 177 177 178 178 /// Assign the iterator to the next column. 179 179 /// … … 210 210 typedef True LpRow; 211 211 /// Default constructor 212 212 213 213 /// \warning The default constructor sets the Row to an 214 214 /// undefined value. 215 215 Row() {} 216 216 /// Invalid constructor \& conversion. 217 217 218 218 /// This constructor initializes the Row to be invalid. 219 /// \sa Invalid for more details. 219 /// \sa Invalid for more details. 220 220 Row(const Invalid&) : _id(1) {} 221 221 /// Equality operator … … 225 225 bool operator==(Row r) const {return _id == r._id;} 226 226 /// Inequality operator 227 227 228 228 /// \sa operator==(Row r) 229 229 /// … … 242 242 ///Iterator for iterate over the rows of an LP problem 243 243 244 /// Its usage is quite simple, for example you can count the number244 /// Its usage is quite simple, for example, you can count the number 245 245 /// of rows in an LP \c lp: 246 246 ///\code … … 252 252 public: 253 253 /// Default constructor 254 254 255 255 /// \warning The default constructor sets the iterator 256 256 /// to an undefined value. 257 257 RowIt() {} 258 258 /// Sets the iterator to the first Row 259 259 260 260 /// Sets the iterator to the first Row. 261 261 /// … … 265 265 } 266 266 /// Invalid constructor \& conversion 267 267 268 268 /// Initialize the iterator to be invalid. 269 269 /// \sa Invalid for more details. 270 270 RowIt(const Invalid&) : Row(INVALID) {} 271 271 /// Next row 272 272 273 273 /// Assign the iterator to the next row. 274 274 /// … … 348 348 typedef True SolverExpr; 349 349 /// Default constructor 350 350 351 351 /// Construct an empty expression, the coefficients and 352 352 /// the constant component are initialized to zero. … … 449 449 450 450 ///Iterator over the expression 451 452 ///The iterator iterates over the terms of the expression. 453 /// 451 452 ///The iterator iterates over the terms of the expression. 453 /// 454 454 ///\code 455 455 ///double s=0; … … 465 465 466 466 /// Sets the iterator to the first term 467 467 468 468 /// Sets the iterator to the first term of the expression. 469 469 /// … … 482 482 const Value& operator*() const { return _it>second; } 483 483 /// Next term 484 484 485 485 /// Assign the iterator to the next term. 486 486 /// … … 494 494 495 495 /// Const iterator over the expression 496 497 ///The iterator iterates over the terms of the expression. 498 /// 496 497 ///The iterator iterates over the terms of the expression. 498 /// 499 499 ///\code 500 500 ///double s=0; … … 510 510 511 511 /// Sets the iterator to the first term 512 512 513 513 /// Sets the iterator to the first term of the expression. 514 514 /// … … 525 525 526 526 /// Next term 527 527 528 528 /// Assign the iterator to the next term. 529 529 /// … … 674 674 typedef True SolverExpr; 675 675 /// Default constructor 676 676 677 677 /// Construct an empty expression, the coefficients are 678 678 /// initialized to zero. … … 709 709 } 710 710 /// \brief Removes the coefficients which's absolute value does 711 /// not exceed \c epsilon. 711 /// not exceed \c epsilon. 712 712 void simplify(Value epsilon = 0.0) { 713 713 std::map<int, Value>::iterator it=comps.begin(); … … 758 758 759 759 ///Iterator over the expression 760 761 ///The iterator iterates over the terms of the expression. 762 /// 760 761 ///The iterator iterates over the terms of the expression. 762 /// 763 763 ///\code 764 764 ///double s=0; … … 774 774 775 775 /// Sets the iterator to the first term 776 776 777 777 /// Sets the iterator to the first term of the expression. 778 778 /// … … 792 792 793 793 /// Next term 794 794 795 795 /// Assign the iterator to the next term. 796 796 /// … … 804 804 805 805 ///Iterator over the expression 806 807 ///The iterator iterates over the terms of the expression. 808 /// 806 807 ///The iterator iterates over the terms of the expression. 808 /// 809 809 ///\code 810 810 ///double s=0; … … 820 820 821 821 /// Sets the iterator to the first term 822 822 823 823 /// Sets the iterator to the first term of the expression. 824 824 /// … … 835 835 836 836 /// Next term 837 837 838 838 /// Assign the iterator to the next term. 839 839 /// … … 943 943 virtual int _addCol() = 0; 944 944 virtual int _addRow() = 0; 945 946 virtual int _addRow(Value l, ExprIterator b, ExprIterator e, Value u) { 947 int row = _addRow(); 948 _setRowCoeffs(row, b, e); 949 _setRowLowerBound(row, l); 950 _setRowUpperBound(row, u); 951 return row; 952 } 945 953 946 954 virtual void _eraseCol(int col) = 0; … … 1208 1216 ///\return The created row. 1209 1217 Row addRow(Value l,const Expr &e, Value u) { 1210 Row r=addRow(); 1211 row(r,l,e,u); 1218 Row r; 1219 e.simplify(); 1220 r._id = _addRowId(_addRow(l  *e, ExprIterator(e.comps.begin(), cols), 1221 ExprIterator(e.comps.end(), cols), u  *e)); 1212 1222 return r; 1213 1223 } … … 1218 1228 ///\return The created row. 1219 1229 Row addRow(const Constr &c) { 1220 Row r=addRow(); 1221 row(r,c); 1230 Row r; 1231 c.expr().simplify(); 1232 r._id = _addRowId(_addRow(c.lowerBounded()?c.lowerBound()*c.expr():INF, 1233 ExprIterator(c.expr().comps.begin(), cols), 1234 ExprIterator(c.expr().comps.end(), cols), 1235 c.upperBounded()?c.upperBound()*c.expr():INF)); 1222 1236 return r; 1223 1237 } … … 1804 1818 enum VarStatus { 1805 1819 /// The variable is in the basis 1806 BASIC, 1820 BASIC, 1807 1821 /// The variable is free, but not basic 1808 1822 FREE, 1809 /// The variable has active lower bound 1823 /// The variable has active lower bound 1810 1824 LOWER, 1811 1825 /// The variable has active upper bound … … 1886 1900 } 1887 1901 /// Returns a component of the primal ray 1888 1902 1889 1903 /// The primal ray is solution of the modified primal problem, 1890 1904 /// where we change each finite bound to 0, and we looking for a … … 1920 1934 1921 1935 /// Returns a component of the dual ray 1922 1936 1923 1937 /// The dual ray is solution of the modified primal problem, where 1924 1938 /// we change each finite bound to 0 (i.e. the objective function … … 2062 2076 } 2063 2077 ///The value of the objective function 2064 2078 2065 2079 ///\return 2066 2080 /// \ref INF or \ref INF means either infeasibility or unboundedness
Note: See TracChangeset
for help on using the changeset viewer.