Changeset 485:9b082b3fb33f in lemon for lemon/cplex.cc
 Timestamp:
 01/12/09 13:26:02 (12 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/cplex.cc
r484 r485 439 439 } 440 440 441 // LpCplexmembers442 443 LpCplex::LpCplex()441 // CplexLp members 442 443 CplexLp::CplexLp() 444 444 : LpBase(), CplexBase(), LpSolver() {} 445 445 446 LpCplex::LpCplex(const CplexEnv& env)446 CplexLp::CplexLp(const CplexEnv& env) 447 447 : LpBase(), CplexBase(env), LpSolver() {} 448 448 449 LpCplex::LpCplex(const LpCplex& other)449 CplexLp::CplexLp(const CplexLp& other) 450 450 : LpBase(), CplexBase(other), LpSolver() {} 451 451 452 LpCplex::~LpCplex() {}453 454 LpCplex* LpCplex::_newSolver() const { return new LpCplex; }455 LpCplex* LpCplex::_cloneSolver() const {return new LpCplex(*this); }456 457 const char* LpCplex::_solverName() const { return "LpCplex"; }458 459 void LpCplex::_clear_temporals() {452 CplexLp::~CplexLp() {} 453 454 CplexLp* CplexLp::_newSolver() const { return new CplexLp; } 455 CplexLp* CplexLp::_cloneSolver() const {return new CplexLp(*this); } 456 457 const char* CplexLp::_solverName() const { return "CplexLp"; } 458 459 void CplexLp::_clear_temporals() { 460 460 _col_status.clear(); 461 461 _row_status.clear(); … … 473 473 // routines CPXsolninfo, CPXgetstat, and CPXsolution to obtain 474 474 // further information about the status of the optimization. 475 LpCplex::SolveExitStatus LpCplex::convertStatus(int status) {475 CplexLp::SolveExitStatus CplexLp::convertStatus(int status) { 476 476 #if CPX_VERSION >= 800 477 477 if (status == 0) { … … 506 506 } 507 507 508 LpCplex::SolveExitStatus LpCplex::_solve() {508 CplexLp::SolveExitStatus CplexLp::_solve() { 509 509 _clear_temporals(); 510 510 return convertStatus(CPXlpopt(cplexEnv(), _prob)); 511 511 } 512 512 513 LpCplex::SolveExitStatus LpCplex::solvePrimal() {513 CplexLp::SolveExitStatus CplexLp::solvePrimal() { 514 514 _clear_temporals(); 515 515 return convertStatus(CPXprimopt(cplexEnv(), _prob)); 516 516 } 517 517 518 LpCplex::SolveExitStatus LpCplex::solveDual() {518 CplexLp::SolveExitStatus CplexLp::solveDual() { 519 519 _clear_temporals(); 520 520 return convertStatus(CPXdualopt(cplexEnv(), _prob)); 521 521 } 522 522 523 LpCplex::SolveExitStatus LpCplex::solveBarrier() {523 CplexLp::SolveExitStatus CplexLp::solveBarrier() { 524 524 _clear_temporals(); 525 525 return convertStatus(CPXbaropt(cplexEnv(), _prob)); 526 526 } 527 527 528 LpCplex::Value LpCplex::_getPrimal(int i) const {528 CplexLp::Value CplexLp::_getPrimal(int i) const { 529 529 Value x; 530 530 CPXgetx(cplexEnv(), _prob, &x, i, i); … … 532 532 } 533 533 534 LpCplex::Value LpCplex::_getDual(int i) const {534 CplexLp::Value CplexLp::_getDual(int i) const { 535 535 Value y; 536 536 CPXgetpi(cplexEnv(), _prob, &y, i, i); … … 538 538 } 539 539 540 LpCplex::Value LpCplex::_getPrimalValue() const {540 CplexLp::Value CplexLp::_getPrimalValue() const { 541 541 Value objval; 542 542 CPXgetobjval(cplexEnv(), _prob, &objval); … … 544 544 } 545 545 546 LpCplex::VarStatus LpCplex::_getColStatus(int i) const {546 CplexLp::VarStatus CplexLp::_getColStatus(int i) const { 547 547 if (_col_status.empty()) { 548 548 _col_status.resize(CPXgetnumcols(cplexEnv(), _prob)); … … 560 560 default: 561 561 LEMON_ASSERT(false, "Wrong column status"); 562 return LpCplex::VarStatus();563 } 564 } 565 566 LpCplex::VarStatus LpCplex::_getRowStatus(int i) const {562 return CplexLp::VarStatus(); 563 } 564 } 565 566 CplexLp::VarStatus CplexLp::_getRowStatus(int i) const { 567 567 if (_row_status.empty()) { 568 568 _row_status.resize(CPXgetnumrows(cplexEnv(), _prob)); … … 582 582 default: 583 583 LEMON_ASSERT(false, "Wrong row status"); 584 return LpCplex::VarStatus();585 } 586 } 587 588 LpCplex::Value LpCplex::_getPrimalRay(int i) const {584 return CplexLp::VarStatus(); 585 } 586 } 587 588 CplexLp::Value CplexLp::_getPrimalRay(int i) const { 589 589 if (_primal_ray.empty()) { 590 590 _primal_ray.resize(CPXgetnumcols(cplexEnv(), _prob)); … … 594 594 } 595 595 596 LpCplex::Value LpCplex::_getDualRay(int i) const {596 CplexLp::Value CplexLp::_getDualRay(int i) const { 597 597 if (_dual_ray.empty()) { 598 598 … … 687 687 #endif 688 688 689 LpCplex::ProblemType LpCplex::_getPrimalType() const {689 CplexLp::ProblemType CplexLp::_getPrimalType() const { 690 690 // Unboundedness not treated well: the following is from cplex 9.0 doc 691 691 // About Unboundedness … … 769 769 // CPX_STAT_UNBOUNDED 770 770 771 LpCplex::ProblemType LpCplex::_getDualType() const {771 CplexLp::ProblemType CplexLp::_getDualType() const { 772 772 int stat = CPXgetstat(cplexEnv(), _prob); 773 773 #if CPX_VERSION >= 800 … … 796 796 } 797 797 798 // MipCplexmembers799 800 MipCplex::MipCplex()798 // CplexMip members 799 800 CplexMip::CplexMip() 801 801 : LpBase(), CplexBase(), MipSolver() { 802 802 … … 808 808 } 809 809 810 MipCplex::MipCplex(const CplexEnv& env)810 CplexMip::CplexMip(const CplexEnv& env) 811 811 : LpBase(), CplexBase(env), MipSolver() { 812 812 … … 819 819 } 820 820 821 MipCplex::MipCplex(const MipCplex& other)821 CplexMip::CplexMip(const CplexMip& other) 822 822 : LpBase(), CplexBase(other), MipSolver() {} 823 823 824 MipCplex::~MipCplex() {}825 826 MipCplex* MipCplex::_newSolver() const { return new MipCplex; }827 MipCplex* MipCplex::_cloneSolver() const {return new MipCplex(*this); }828 829 const char* MipCplex::_solverName() const { return "MipCplex"; }830 831 void MipCplex::_setColType(int i, MipCplex::ColTypes col_type) {824 CplexMip::~CplexMip() {} 825 826 CplexMip* CplexMip::_newSolver() const { return new CplexMip; } 827 CplexMip* CplexMip::_cloneSolver() const {return new CplexMip(*this); } 828 829 const char* CplexMip::_solverName() const { return "CplexMip"; } 830 831 void CplexMip::_setColType(int i, CplexMip::ColTypes col_type) { 832 832 833 833 // Note If a variable is to be changed to binary, a call to CPXchgbds … … 848 848 } 849 849 850 MipCplex::ColTypes MipCplex::_getColType(int i) const {850 CplexMip::ColTypes CplexMip::_getColType(int i) const { 851 851 char t; 852 852 CPXgetctype (cplexEnv(), _prob, &t, i, i); … … 863 863 } 864 864 865 MipCplex::SolveExitStatus MipCplex::_solve() {865 CplexMip::SolveExitStatus CplexMip::_solve() { 866 866 int status; 867 867 status = CPXmipopt (cplexEnv(), _prob); … … 874 874 875 875 876 MipCplex::ProblemType MipCplex::_getType() const {876 CplexMip::ProblemType CplexMip::_getType() const { 877 877 878 878 int stat = CPXgetstat(cplexEnv(), _prob); … … 910 910 } 911 911 912 MipCplex::Value MipCplex::_getSol(int i) const {912 CplexMip::Value CplexMip::_getSol(int i) const { 913 913 Value x; 914 914 CPXgetmipx(cplexEnv(), _prob, &x, i, i); … … 916 916 } 917 917 918 MipCplex::Value MipCplex::_getSolValue() const {918 CplexMip::Value CplexMip::_getSolValue() const { 919 919 Value objval; 920 920 CPXgetmipobjval(cplexEnv(), _prob, &objval);
Note: See TracChangeset
for help on using the changeset viewer.