Changeset 2605:852361980706 in lemon-0.x for lemon/lp_base.h
- Timestamp:
- 04/08/08 18:01:28 (16 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3488
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_base.h
r2569 r2605 372 372 } 373 373 374 //std::ostream &375 void prettyPrint(std::ostream &os) {376 //std::fmtflags os.flags();377 //os.setf(std::ios::showpos);378 Base::iterator j=Base::begin();379 if (j!=Base::end())380 os<<j->second<<"*x["<<id(j->first)<<"]";381 ++j;382 for (; j!=Base::end(); ++j){383 if (j->second>=0)384 os<<"+";385 os<<j->second<<"*x["<<id(j->first)<<"]";386 }387 //Nem valami korrekt, de nem talaltam meg, hogy kell388 //os.unsetf(std::ios::showpos);389 390 //return os;391 }392 393 374 }; 394 375 … … 482 463 } 483 464 484 void prettyPrint(std::ostream &os) {485 if (_lb==-LpSolverBase::INF||isNaN(_lb))486 os<<"-infty<=";487 else488 os<<_lb<<"<=";489 _expr.prettyPrint(os);490 if (_ub==LpSolverBase::INF)491 os<<"<=infty";492 else493 os<<"<="<<_ub;494 //return os;495 }496 497 465 }; 498 466 … … 736 704 737 705 //Abstract virtual functions 738 virtual LpSolverBase &_newLp() = 0; 739 virtual LpSolverBase &_copyLp(){ 740 ///\todo This should be implemented here, too, when we have 741 ///problem retrieving routines. It can be overriden. 742 743 //Starting: 744 LpSolverBase & newlp(_newLp()); 706 virtual LpSolverBase* _newLp() = 0; 707 virtual LpSolverBase* _copyLp(){ 708 LpSolverBase* newlp = _newLp(); 709 710 std::map<Col, Col> ref; 711 for (LpSolverBase::ColIt it(*this); it != INVALID; ++it) { 712 Col ccol = newlp->addCol(); 713 ref[it] = ccol; 714 newlp->colName(ccol, colName(it)); 715 newlp->colLowerBound(ccol, colLowerBound(it)); 716 newlp->colUpperBound(ccol, colUpperBound(it)); 717 } 718 719 for (LpSolverBase::RowIt it(*this); it != INVALID; ++it) { 720 Expr e = row(it), ce; 721 for (Expr::iterator jt = e.begin(); jt != e.end(); ++jt) { 722 ce[ref[jt->first]] = jt->second; 723 } 724 ce += e.constComp(); 725 Row r = newlp->addRow(ce); 726 727 double lower, upper; 728 getRowBounds(it, lower, upper); 729 newlp->rowBounds(r, lower, upper); 730 } 731 745 732 return newlp; 746 //return *(LpSolverBase*)0;747 733 }; 748 734 … … 805 791 806 792 ///Creates a new LP problem 807 LpSolverBase &newLp() {return _newLp();}793 LpSolverBase* newLp() {return _newLp();} 808 794 ///Makes a copy of the LP problem 809 LpSolverBase ©Lp() {return _copyLp();}795 LpSolverBase* copyLp() {return _copyLp();} 810 796 811 797 ///\name Build up and modify the LP
Note: See TracChangeset
for help on using the changeset viewer.