Changeset 1364:ee5959aa4410 in lemon-0.x
- Timestamp:
- 04/17/05 20:57:22 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1809
- Location:
- src/lemon
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/lp_base.cc
r1359 r1364 26 26 LpSolverBase::NaN = std::numeric_limits<Value>::quiet_NaN(); 27 27 28 const LpSolverBase::Constr::Value29 LpSolverBase::Constr::INF = std::numeric_limits<Value>::infinity();30 const LpSolverBase::Constr::Value31 LpSolverBase::Constr::NaN = std::numeric_limits<Value>::quiet_NaN();28 // const LpSolverBase::Constr::Value 29 // LpSolverBase::Constr::INF = std::numeric_limits<Value>::infinity(); 30 // const LpSolverBase::Constr::Value 31 // LpSolverBase::Constr::NaN = std::numeric_limits<Value>::quiet_NaN(); 32 32 33 33 } //namespace lemon -
src/lemon/lp_base.h
r1359 r1364 199 199 ///container. 200 200 ///- Its it fully compatible with \c std::map<Col,double>, so for expamle 201 ///if \c e is an Expr and \c v and \c w are of type \ref Col then you can201 ///if \c e is an Expr and \c v and \c w are of type \ref Col, then you can 202 202 ///read and modify the coefficients like 203 203 ///these. … … 319 319 ///Linear constraint 320 320 321 ///\todo document please 322 /// 321 ///This data stucture represents a linear constraint in the LP. 322 ///Basically it is a linear expression with a lower or an upper bound 323 ///(or both). These parts of the constraint can be obtained by the member 324 ///functions \ref expr(), \ref lowerBound() and \ref upperBound(), 325 ///respectively. 326 ///There are two ways to construct a constraint. 327 ///- You can set the linear expression and the bounds directly 328 /// by the functions above. 329 ///- The operators <tt>\<=</tt>, <tt>==</tt> and <tt>\>=</tt> 330 /// are defined between expressions, or even between constraints whenever 331 /// it makes sense. Therefore if \c e and \c f are linear expressions and 332 /// \c s and \c t are numbers, then the followings are valid expressions 333 /// and thus they can be used directly e.g. in \ref addRow() whenever 334 /// it makes sense. 335 /// \code 336 /// e<=s 337 /// e<=f 338 /// s<=e<=t 339 /// e>=t 340 /// \endcode 341 ///\warning The validity of a constraint is checked only at run time, so 342 ///e.g. \ref addRow(<tt>x[1]\<=x[2]<=5</tt>) will compile, but will throw a 343 ///\ref LogicError exception. 323 344 class Constr 324 345 { … … 328 349 typedef Expr::Value Value; 329 350 330 static const Value INF; 331 static const Value NaN; 332 // static const Value INF=0; 333 // static const Value NaN=1; 334 351 // static const Value INF; 352 // static const Value NaN; 353 335 354 protected: 336 355 Expr _expr; … … 357 376 _lb=_ub=NaN; 358 377 } 359 ///\e 378 379 ///Reference to the linear expression 360 380 Expr &expr() { return _expr; } 361 /// \e381 ///Cont reference to the linear expression 362 382 const Expr &expr() const { return _expr; } 363 ///\e 383 ///Reference to the lower bound. 384 385 ///\return 386 ///- -\ref INF: the constraint is lower unbounded. 387 ///- -\ref NaN: lower bound has not been set. 388 ///- finite number: the lower bound 364 389 Value &lowerBound() { return _lb; } 365 /// \e390 ///The const version of \ref lowerBound() 366 391 const Value &lowerBound() const { return _lb; } 367 ///\e 392 ///Reference to the upper bound. 393 394 ///\return 395 ///- -\ref INF: the constraint is upper unbounded. 396 ///- -\ref NaN: upper bound has not been set. 397 ///- finite number: the upper bound 368 398 Value &upperBound() { return _ub; } 369 /// \e399 ///The const version of \ref upperBound() 370 400 const Value &upperBound() const { return _ub; } 371 /// \e401 ///Is the constraint lower bounded? 372 402 bool lowerBounded() const { 373 403 using namespace std; 374 404 return isfinite(_lb); 375 405 } 376 /// \e406 ///Is the constraint upper bounded? 377 407 bool upperBounded() const { 378 408 using namespace std; … … 387 417 388 418 //Abstract virtual functions 419 virtual LpSolverBase &_newLp() = 0; 420 virtual LpSolverBase &_copyLp() = 0; 421 389 422 virtual int _addCol() = 0; 390 423 virtual int _addRow() = 0; … … 427 460 virtual ~LpSolverBase() {} 428 461 462 ///Creates a new LP problem 463 LpSolverBase &newLp() {return _newLp();} 464 ///Make a copy of the LP problem 465 LpSolverBase ©Lp() {return _copyLp();} 466 429 467 ///\name Build up and modify of the LP 430 468 … … 452 490 ///like 453 491 ///\code 454 ///std::map<Any Status,LpSolverBase::Col>492 ///std::map<AnyType,LpSolverBase::Col> 455 493 ///\endcode 456 494 ///- an iterable lemon \ref concept::WriteMap "write map" like … … 460 498 ///\endcode 461 499 ///\return The number of the created column. 462 ///\bug Iterable nodemap hasn't been implemented yet.463 500 #ifdef DOXYGEN 464 501 template<class T> … … 669 706 ///- \ref INF or -\ref INF means either infeasibility or unboundedness 670 707 /// of the primal problem, depending on whether we minimize or maximize. 671 ///- \ref N AN if no primal solution is found.708 ///- \ref NaN if no primal solution is found. 672 709 ///- The (finite) objective value if an optimal solution is found. 673 710 Value primalValue() { return _getPrimalValue()+obj_const_comp;} … … 684 721 { 685 722 LpSolverBase::Expr tmp(a); 686 tmp+=b; ///\todo Do n't STL have some special 'merge' algorithm?723 tmp+=b; ///\todo Doesn't STL have some special 'merge' algorithm? 687 724 return tmp; 688 725 } … … 695 732 { 696 733 LpSolverBase::Expr tmp(a); 697 tmp-=b; ///\todo Do n't STL have some special 'merge' algorithm?734 tmp-=b; ///\todo Doesn't STL have some special 'merge' algorithm? 698 735 return tmp; 699 736 } … … 706 743 { 707 744 LpSolverBase::Expr tmp(a); 708 tmp*=b; ///\todo Do n't STL have some special 'merge' algorithm?745 tmp*=b; ///\todo Doesn't STL have some special 'merge' algorithm? 709 746 return tmp; 710 747 } … … 718 755 { 719 756 LpSolverBase::Expr tmp(b); 720 tmp*=a; ///\todo Do n't STL have some special 'merge' algorithm?757 tmp*=a; ///\todo Doesn't STL have some special 'merge' algorithm? 721 758 return tmp; 722 759 } … … 729 766 { 730 767 LpSolverBase::Expr tmp(a); 731 tmp/=b; ///\todo Do n't STL have some special 'merge' algorithm?768 tmp/=b; ///\todo Doesn't STL have some special 'merge' algorithm? 732 769 return tmp; 733 770 } -
src/lemon/lp_glpk.cc
r1359 r1364 25 25 namespace lemon { 26 26 27 ///\e 28 29 ///\bug Unimplemented! 30 /// 31 LpSolverBase &LpGlpk::_newLp() 32 { 33 return *((LpSolverBase *)0); 34 } 35 36 ///\e 37 38 ///\bug Unimplemented! 39 /// 40 LpSolverBase &LpGlpk::_copyLp() 41 { 42 return *((LpSolverBase *)0); 43 } 44 27 45 LpGlpk::LpGlpk() : Parent(), 28 46 lp(lpx_create_prob()) { -
src/lemon/lp_glpk.h
r1359 r1364 32 32 /// \brief Wrapper for GLPK solver 33 33 /// 34 /// This class implements a lemon wrapperfor GLPK.34 /// This class implements an interface for GLPK. 35 35 ///\ingroup gen_opt_group 36 36 class LpGlpk : public LpSolverBase { … … 46 46 47 47 protected: 48 virtual LpSolverBase &_newLp(); 49 virtual LpSolverBase &_copyLp(); 50 48 51 virtual int _addCol(); 49 52 virtual int _addRow(); -
src/lemon/lp_skeleton.cc
r1362 r1364 22 22 namespace lemon { 23 23 24 LpSolverBase &LpSkeleton::_newLp() 25 { 26 return *((LpSolverBase *)0); 27 } 28 29 LpSolverBase &LpSkeleton::_copyLp() 30 { 31 return *((LpSolverBase *)0); 32 } 33 24 34 int LpSkeleton::_addCol() 25 35 { -
src/lemon/lp_skeleton.h
r1359 r1364 30 30 31 31 protected: 32 ///\e 33 virtual LpSolverBase &_newLp(); 34 ///\e 35 virtual LpSolverBase &_copyLp(); 32 36 /// \e 33 37 virtual int _addCol();
Note: See TracChangeset
for help on using the changeset viewer.