COIN-OR::LEMON - Graph Library

Changeset 485:9b082b3fb33f in lemon for lemon/glpk.cc


Ignore:
Timestamp:
01/12/09 13:26:02 (10 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Rename Lp*/Mip* to *Lp/*Mip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/glpk.cc

    r484 r485  
    523523  }
    524524
    525   // LpGlpk members
    526 
    527   LpGlpk::LpGlpk()
     525  // GlpkLp members
     526
     527  GlpkLp::GlpkLp()
    528528    : LpBase(), GlpkBase(), LpSolver() {
    529529    messageLevel(MESSAGE_NO_OUTPUT);
    530530  }
    531531
    532   LpGlpk::LpGlpk(const LpGlpk& other)
     532  GlpkLp::GlpkLp(const GlpkLp& other)
    533533    : LpBase(other), GlpkBase(other), LpSolver(other) {
    534534    messageLevel(MESSAGE_NO_OUTPUT);
    535535  }
    536536
    537   LpGlpk* LpGlpk::_newSolver() const { return new LpGlpk; }
    538   LpGlpk* LpGlpk::_cloneSolver() const { return new LpGlpk(*this); }
    539 
    540   const char* LpGlpk::_solverName() const { return "LpGlpk"; }
    541 
    542   void LpGlpk::_clear_temporals() {
     537  GlpkLp* GlpkLp::_newSolver() const { return new GlpkLp; }
     538  GlpkLp* GlpkLp::_cloneSolver() const { return new GlpkLp(*this); }
     539
     540  const char* GlpkLp::_solverName() const { return "GlpkLp"; }
     541
     542  void GlpkLp::_clear_temporals() {
    543543    _primal_ray.clear();
    544544    _dual_ray.clear();
    545545  }
    546546
    547   LpGlpk::SolveExitStatus LpGlpk::_solve() {
     547  GlpkLp::SolveExitStatus GlpkLp::_solve() {
    548548    return solvePrimal();
    549549  }
    550550
    551   LpGlpk::SolveExitStatus LpGlpk::solvePrimal() {
     551  GlpkLp::SolveExitStatus GlpkLp::solvePrimal() {
    552552    _clear_temporals();
    553553
     
    574574  }
    575575
    576   LpGlpk::SolveExitStatus LpGlpk::solveDual() {
     576  GlpkLp::SolveExitStatus GlpkLp::solveDual() {
    577577    _clear_temporals();
    578578
     
    600600  }
    601601
    602   LpGlpk::Value LpGlpk::_getPrimal(int i) const {
     602  GlpkLp::Value GlpkLp::_getPrimal(int i) const {
    603603    return glp_get_col_prim(lp, i);
    604604  }
    605605
    606   LpGlpk::Value LpGlpk::_getDual(int i) const {
     606  GlpkLp::Value GlpkLp::_getDual(int i) const {
    607607    return glp_get_row_dual(lp, i);
    608608  }
    609609
    610   LpGlpk::Value LpGlpk::_getPrimalValue() const {
     610  GlpkLp::Value GlpkLp::_getPrimalValue() const {
    611611    return glp_get_obj_val(lp);
    612612  }
    613613
    614   LpGlpk::VarStatus LpGlpk::_getColStatus(int i) const {
     614  GlpkLp::VarStatus GlpkLp::_getColStatus(int i) const {
    615615    switch (glp_get_col_stat(lp, i)) {
    616616    case GLP_BS:
     
    626626    default:
    627627      LEMON_ASSERT(false, "Wrong column status");
    628       return LpGlpk::VarStatus();
    629     }
    630   }
    631 
    632   LpGlpk::VarStatus LpGlpk::_getRowStatus(int i) const {
     628      return GlpkLp::VarStatus();
     629    }
     630  }
     631
     632  GlpkLp::VarStatus GlpkLp::_getRowStatus(int i) const {
    633633    switch (glp_get_row_stat(lp, i)) {
    634634    case GLP_BS:
     
    644644    default:
    645645      LEMON_ASSERT(false, "Wrong row status");
    646       return LpGlpk::VarStatus();
    647     }
    648   }
    649 
    650   LpGlpk::Value LpGlpk::_getPrimalRay(int i) const {
     646      return GlpkLp::VarStatus();
     647    }
     648  }
     649
     650  GlpkLp::Value GlpkLp::_getPrimalRay(int i) const {
    651651    if (_primal_ray.empty()) {
    652652      int row_num = glp_get_num_rows(lp);
     
    700700  }
    701701
    702   LpGlpk::Value LpGlpk::_getDualRay(int i) const {
     702  GlpkLp::Value GlpkLp::_getDualRay(int i) const {
    703703    if (_dual_ray.empty()) {
    704704      int row_num = glp_get_num_rows(lp);
     
    772772  }
    773773
    774   LpGlpk::ProblemType LpGlpk::_getPrimalType() const {
     774  GlpkLp::ProblemType GlpkLp::_getPrimalType() const {
    775775    if (glp_get_status(lp) == GLP_OPT)
    776776      return OPTIMAL;
     
    789789    default:
    790790      LEMON_ASSERT(false, "Wrong primal type");
    791       return  LpGlpk::ProblemType();
    792     }
    793   }
    794 
    795   LpGlpk::ProblemType LpGlpk::_getDualType() const {
     791      return  GlpkLp::ProblemType();
     792    }
     793  }
     794
     795  GlpkLp::ProblemType GlpkLp::_getDualType() const {
    796796    if (glp_get_status(lp) == GLP_OPT)
    797797      return OPTIMAL;
     
    810810    default:
    811811      LEMON_ASSERT(false, "Wrong primal type");
    812       return  LpGlpk::ProblemType();
    813     }
    814   }
    815 
    816   void LpGlpk::presolver(bool b) {
     812      return  GlpkLp::ProblemType();
     813    }
     814  }
     815
     816  void GlpkLp::presolver(bool b) {
    817817    lpx_set_int_parm(lp, LPX_K_PRESOL, b ? 1 : 0);
    818818  }
    819819
    820   void LpGlpk::messageLevel(MessageLevel m) {
     820  void GlpkLp::messageLevel(MessageLevel m) {
    821821    _message_level = m;
    822822  }
    823823
    824   // MipGlpk members
    825 
    826   MipGlpk::MipGlpk()
     824  // GlpkMip members
     825
     826  GlpkMip::GlpkMip()
    827827    : LpBase(), GlpkBase(), MipSolver() {
    828828    messageLevel(MESSAGE_NO_OUTPUT);
    829829  }
    830830
    831   MipGlpk::MipGlpk(const MipGlpk& other)
     831  GlpkMip::GlpkMip(const GlpkMip& other)
    832832    : LpBase(), GlpkBase(other), MipSolver() {
    833833    messageLevel(MESSAGE_NO_OUTPUT);
    834834  }
    835835
    836   void MipGlpk::_setColType(int i, MipGlpk::ColTypes col_type) {
     836  void GlpkMip::_setColType(int i, GlpkMip::ColTypes col_type) {
    837837    switch (col_type) {
    838838    case INTEGER:
     
    845845  }
    846846
    847   MipGlpk::ColTypes MipGlpk::_getColType(int i) const {
     847  GlpkMip::ColTypes GlpkMip::_getColType(int i) const {
    848848    switch (glp_get_col_kind(lp, i)) {
    849849    case GLP_IV:
     
    856856  }
    857857
    858   MipGlpk::SolveExitStatus MipGlpk::_solve() {
     858  GlpkMip::SolveExitStatus GlpkMip::_solve() {
    859859    glp_smcp smcp;
    860860    glp_init_smcp(&smcp);
     
    902902
    903903
    904   MipGlpk::ProblemType MipGlpk::_getType() const {
     904  GlpkMip::ProblemType GlpkMip::_getType() const {
    905905    switch (glp_get_status(lp)) {
    906906    case GLP_OPT:
     
    916916      default:
    917917        LEMON_ASSERT(false, "Wrong problem type.");
    918         return MipGlpk::ProblemType();
     918        return GlpkMip::ProblemType();
    919919      }
    920920    case GLP_NOFEAS:
     
    929929    default:
    930930      LEMON_ASSERT(false, "Wrong problem type.");
    931       return MipGlpk::ProblemType();
    932     }
    933   }
    934 
    935   MipGlpk::Value MipGlpk::_getSol(int i) const {
     931      return GlpkMip::ProblemType();
     932    }
     933  }
     934
     935  GlpkMip::Value GlpkMip::_getSol(int i) const {
    936936    return glp_mip_col_val(lp, i);
    937937  }
    938938
    939   MipGlpk::Value MipGlpk::_getSolValue() const {
     939  GlpkMip::Value GlpkMip::_getSolValue() const {
    940940    return glp_mip_obj_val(lp);
    941941  }
    942942
    943   MipGlpk* MipGlpk::_newSolver() const { return new MipGlpk; }
    944   MipGlpk* MipGlpk::_cloneSolver() const {return new MipGlpk(*this); }
    945 
    946   const char* MipGlpk::_solverName() const { return "MipGlpk"; }
    947 
    948   void MipGlpk::messageLevel(MessageLevel m) {
     943  GlpkMip* GlpkMip::_newSolver() const { return new GlpkMip; }
     944  GlpkMip* GlpkMip::_cloneSolver() const {return new GlpkMip(*this); }
     945
     946  const char* GlpkMip::_solverName() const { return "GlpkMip"; }
     947
     948  void GlpkMip::messageLevel(MessageLevel m) {
    949949    _message_level = m;
    950950  }
Note: See TracChangeset for help on using the changeset viewer.