Changeset 2345:bfcaad2b84e8 in lemon-0.x
- Timestamp:
- 01/12/07 17:29:06 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3137
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_base.h
r2328 r2345 19 19 #ifndef LEMON_LP_BASE_H 20 20 #define LEMON_LP_BASE_H 21 22 #include<iostream> 23 21 24 22 25 #include<vector> … … 270 273 ///Linear expression of variables and a constant component 271 274 272 ///This data structure st rores a linear expression of the variables275 ///This data structure stores a linear expression of the variables 273 276 ///(\ref Col "Col"s) and also has a constant component. 274 277 /// … … 328 331 329 332 Value const_comp; 330 public:333 public: 331 334 typedef True IsLinExpression; 332 335 ///\e … … 405 408 return *this; 406 409 } 410 411 //std::ostream & 412 void prettyPrint(std::ostream &os) { 413 //std::fmtflags os.flags(); 414 //os.setf(std::ios::showpos); 415 Base::iterator j=Base::begin(); 416 if (j!=Base::end()) 417 os<<j->second<<"*x["<<id(j->first)<<"]"; 418 ++j; 419 for (; j!=Base::end(); ++j){ 420 if (j->second>=0) 421 os<<"+"; 422 os<<j->second<<"*x["<<id(j->first)<<"]"; 423 } 424 //Nem valami korrekt, de nem talaltam meg, hogy kell 425 //os.unsetf(std::ios::showpos); 426 427 //return os; 428 } 429 407 430 }; 408 431 … … 497 520 return finite(_ub); 498 521 } 522 523 void prettyPrint(std::ostream &os) { 524 if (_lb==-LpSolverBase::INF||isNaN(_lb)) 525 os<<"-infty<="; 526 else 527 os<<_lb<<"<="; 528 _expr.prettyPrint(os); 529 if (_ub==LpSolverBase::INF) 530 os<<"<=infty"; 531 else 532 os<<"<="<<_ub; 533 //return os; 534 } 535 499 536 }; 500 537 … … 1491 1528 1492 1529 ///\e 1530 1531 ///\relates LpSolverBase::Constr 1532 /// 1533 inline LpSolverBase::Constr operator==(const LpSolverBase::Expr &e, 1534 const LpSolverBase::Value &f) 1535 { 1536 return LpSolverBase::Constr(f,e,f); 1537 } 1538 1539 ///\e 1493 1540 1494 1541 ///\relates LpSolverBase::Constr -
lemon/lp_glpk.cc
r2328 r2345 527 527 LpGlpk::SolveExitStatus LpGlpk::_solve() 528 528 { 529 // A way to check the problem to be solved 530 //lpx_write_cpxlp(lp,"naittvan.cpx"); 531 529 532 int i = lpx_simplex(lp); 530 533 switch (i) { -
test/lp_test.cc
r2328 r2345 195 195 // std::cout<<e[p1]<<e[p2]<<e[p3]<<std::endl; 196 196 check(e.find(p2)==e.end(), buf.str()); 197 197 198 198 199 199 200 200 201 201 e=((p1+p2)+(p1-0.99*p2)); 202 //e.prettyPrint(std::cout); 203 //(e<=2).prettyPrint(std::cout); 202 204 double tolerance=0.001; 203 205 e.simplify(tolerance);
Note: See TracChangeset
for help on using the changeset viewer.