Changeset 1460:7c58aabb9eea in lemon-0.x
- Timestamp:
- 06/09/05 17:03:58 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1940
- Location:
- lemon
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lp_base.h
r1458 r1460 119 119 }; 120 120 121 ///\e121 ///\e 122 122 enum SolutionStatus { 123 123 ///Feasible solution has'n been found (but may exist). … … 138 138 INFINITE = 4 139 139 }; 140 141 ///\e The type of the investigated LP problem 142 enum Problemtypes { 143 ///Primal-dual feasible 144 PRIMAL_DUAL_FEASIBLE = 0, 145 ///Primal feasible dual infeasible 146 PRIMAL_FEASIBLE_DUAL_INFEASIBLE = 1, 147 ///Primal infeasible dual feasible 148 PRIMAL_INFEASIBLE_DUAL_FEASIBLE = 2, 149 ///Primal-dual infeasible 150 PRIMAL_DUAL_INFEASIBLE = 3, 151 ///Could not determine so far 152 UNKNOWN = 4 153 }; 140 154 141 155 ///The floating point type used by the solver … … 564 578 virtual Value _getPrimalValue() = 0; 565 579 virtual SolutionStatus _getPrimalStatus() = 0; 580 virtual SolutionStatus _getDualStatus() = 0; 581 ///\todo This could be implemented here, too, using _getPrimalStatus() and 582 ///_getDualStatus() 583 virtual ProblemTypes _getProblemType() = 0; 584 566 585 virtual void _setMax() = 0; 567 586 virtual void _setMin() = 0; … … 931 950 ///@{ 932 951 933 /// \e952 /// The status of the primal problem (the original LP problem) 934 953 SolutionStatus primalStatus() { 935 954 return _getPrimalStatus(); 955 } 956 957 /// The status of the dual (of the original LP) problem 958 SolutionStatus dualStatus() { 959 return _getDualStatus(); 960 } 961 962 ///The type of the original LP problem 963 Problemtypes problemType() { 964 return _getProblemType(); 936 965 } 937 966 -
lemon/lp_cplex.cc
r1458 r1460 261 261 } 262 262 263 LpCplex::Value LpCplex::_getPrimal(int i) 264 { 265 Value x; 266 CPXgetx (env, lp, &x, i, i); 267 return x; 268 } 269 270 LpCplex::Value LpCplex::_getPrimalValue() 271 { 272 Value objval; 273 //method = CPXgetmethod (env, lp); 274 status = CPXgetobjval (env, lp, &objval); 275 return objval; 276 } 277 263 278 264 279 //7.5-os cplex statusai (Vigyazat: a 9.0-asei masok!) … … 378 393 } 379 394 380 LpCplex::Value LpCplex::_getPrimal(int i)381 {382 Value x;383 CPXgetx (env, lp, &x, i, i);384 return x;385 }386 387 LpCplex::Value LpCplex::_getPrimalValue()388 {389 Value objval;390 //method = CPXgetmethod (env, lp);391 status = CPXgetobjval (env, lp, &objval);392 return objval;393 }394 395 395 396 LpCplex::ProblemTypes LpCplex::_getProblemType() 397 { 398 int stat = CPXgetstat (env, lp); 399 switch (stat) { 400 case CPX_OPTIMAL://Optimal 401 return PRIMAL_DUAL_FEASIBLE; 402 case CPX_UNBOUNDED: 403 return PRIMAL_FEASIBLE_DUAL_INFEASIBLE; 404 // return PRIMAL_INFEASIBLE_DUAL_FEASIBLE; 405 // return PRIMAL_DUAL_INFEASIBLE; 406 407 //Seems to be that this is all we can say for sure 408 default: 409 //In all other cases 410 return UNKNOWN; 411 //FIXME error 412 } 396 413 397 414 -
lemon/lp_cplex.h
r1435 r1460 76 76 ///\e 77 77 78 ///\bug Unimplemented79 ///80 78 virtual SolveExitStatus _solve(); 81 ///\e82 79 83 ///\bug Unimplemented84 ///85 80 virtual Value _getPrimal(int i); 86 ///\e 81 87 82 88 ///\bug Unimplemented89 ///90 83 virtual Value _getPrimalValue(); 91 ///\e92 84 93 ///\bug Unimplemented94 ///95 85 virtual SolutionStatus _getPrimalStatus(); 86 virtual SolutionStatus _getDualStatus(); 87 virtual ProblemTypes _getProblemType(); 96 88 97 ///\e98 89 99 ///\bug Unimplemented100 ///101 90 virtual void _setMax(); 102 ///\e103 104 ///\bug Unimplemented105 ///106 91 virtual void _setMin(); 107 92 -
lemon/lp_glpk.cc
r1458 r1460 445 445 return UNDEFINED; 446 446 case LPX_D_NOFEAS://There is no feasible solution (primal, I guess) 447 case LPX_D_INFEAS://Infeasible447 // case LPX_D_INFEAS://Infeasible 448 448 return INFEASIBLE; 449 449 case LPX_FEAS://Feasible … … 465 465 LpGlpk::ProblemTypes LpGlpk::_problemType() 466 466 { 467 int stat= lpx_get_status(lp);467 //int stat= lpx_get_status(lp); 468 468 int statp= lpx_get_prim_stat(lp); 469 469 int statd= lpx_get_dual_stat(lp); 470 switch (stat) { 471 case LPX_UNDEF://Undefined (no solve has been run yet) 472 return UNDEFINED; 473 break; 474 case LPX_NOFEAS://There is no feasible solution (primal, I guess) 475 case LPX_INFEAS://Infeasible 476 return INFEASIBLE; 477 break; 478 case LPX_UNBND://Unbounded 479 return INFINITE; 480 break; 481 case LPX_FEAS://Feasible 482 return FEASIBLE; 483 break; 484 case LPX_OPT://Feasible 485 return OPTIMAL; 486 break; 487 default: 488 return UNDEFINED; //to avoid gcc warning 489 //FIXME error 490 } 470 if (statp==LP_P_FEAS && statd==LP_D_FEAS) 471 return PRIMAL_DUAL_FEASIBLE; 472 if (statp==LP_P_FEAS && statd==LP_D_NOFEAS) 473 return PRIMAL_FEASIBLE_DUAL_INFEASIBLE; 474 if (statp==LP_P_NOFEAS && statd==LP_D_FEAS) 475 return PRIMAL_INFEASIBLE_DUAL_FEASIBLE; 476 if (statp==LP_P_NOFEAS && statd==LP_D_NOFEAS) 477 return PRIMAL_DUAL_INFEASIBLE; 478 //In all other cases 479 return UNKNOWN; 491 480 } 492 481 -
lemon/lp_glpk.h
r1435 r1460 86 86 /// 87 87 virtual SolutionStatus _getPrimalStatus(); 88 virtual SolutionStatus _getDualStatus(); 89 virtual ProblemTypes _getProblemType(); 90 88 91 virtual void _setMax(); 89 92 virtual void _setMin(); -
lemon/lp_skeleton.cc
r1435 r1460 121 121 LpSkeleton::SolutionStatus LpSkeleton::_getPrimalStatus() 122 122 { 123 return OPTIMAL; 123 return UNDEFINED; 124 } 125 126 LpSkeleton::SolutionStatus LpSkeleton::_getDualStatus() 127 { 128 return UNDEFINED; 129 } 130 131 LpSkeleton::ProblemTypes LpSkeleton::_getProblemType() 132 { 133 return UNKNOWN; 124 134 } 125 135 -
lemon/lp_skeleton.h
r1435 r1460 119 119 virtual SolutionStatus _getPrimalStatus(); 120 120 121 ////e 122 virtual SolutionStatus _getDualStatus(); 123 124 125 ///\e 126 virtual ProblemTypes _getProblemType(); 127 121 128 ///\e 122 129 virtual void _setMax();
Note: See TracChangeset
for help on using the changeset viewer.