Changeset 1364:ee5959aa4410 in lemon0.x for src/lemon/lp_base.h
 Timestamp:
 04/17/05 20:57:22 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1809
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

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 }
Note: See TracChangeset
for help on using the changeset viewer.