COIN-OR::LEMON - Graph Library

Changeset 462:9b082b3fb33f in lemon-1.2 for lemon/clp.cc


Ignore:
Timestamp:
01/12/09 13:26:02 (15 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/clp.cc

    r461 r462  
    2222namespace lemon {
    2323
    24   LpClp::LpClp() {
     24  ClpLp::ClpLp() {
    2525    _prob = new ClpSimplex();
    2626    _init_temporals();
     
    2828  }
    2929
    30   LpClp::LpClp(const LpClp& other) {
     30  ClpLp::ClpLp(const ClpLp& other) {
    3131    _prob = new ClpSimplex(*other._prob);
    3232    rows = other.rows;
     
    3636  }
    3737
    38   LpClp::~LpClp() {
     38  ClpLp::~ClpLp() {
    3939    delete _prob;
    4040    _clear_temporals();
    4141  }
    4242
    43   void LpClp::_init_temporals() {
     43  void ClpLp::_init_temporals() {
    4444    _primal_ray = 0;
    4545    _dual_ray = 0;
    4646  }
    4747
    48   void LpClp::_clear_temporals() {
     48  void ClpLp::_clear_temporals() {
    4949    if (_primal_ray) {
    5050      delete[] _primal_ray;
     
    5757  }
    5858
    59   LpClp* LpClp::_newSolver() const {
    60     LpClp* newlp = new LpClp;
     59  ClpLp* ClpLp::_newSolver() const {
     60    ClpLp* newlp = new ClpLp;
    6161    return newlp;
    6262  }
    6363
    64   LpClp* LpClp::_cloneSolver() const {
    65     LpClp* copylp = new LpClp(*this);
     64  ClpLp* ClpLp::_cloneSolver() const {
     65    ClpLp* copylp = new ClpLp(*this);
    6666    return copylp;
    6767  }
    6868
    69   const char* LpClp::_solverName() const { return "LpClp"; }
    70 
    71   int LpClp::_addCol() {
     69  const char* ClpLp::_solverName() const { return "ClpLp"; }
     70
     71  int ClpLp::_addCol() {
    7272    _prob->addColumn(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX, 0.0);
    7373    return _prob->numberColumns() - 1;
    7474  }
    7575
    76   int LpClp::_addRow() {
     76  int ClpLp::_addRow() {
    7777    _prob->addRow(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX);
    7878    return _prob->numberRows() - 1;
     
    8080
    8181
    82   void LpClp::_eraseCol(int c) {
     82  void ClpLp::_eraseCol(int c) {
    8383    _col_names_ref.erase(_prob->getColumnName(c));
    8484    _prob->deleteColumns(1, &c);
    8585  }
    8686
    87   void LpClp::_eraseRow(int r) {
     87  void ClpLp::_eraseRow(int r) {
    8888    _row_names_ref.erase(_prob->getRowName(r));
    8989    _prob->deleteRows(1, &r);
    9090  }
    9191
    92   void LpClp::_eraseColId(int i) {
     92  void ClpLp::_eraseColId(int i) {
    9393    cols.eraseIndex(i);
    9494    cols.shiftIndices(i);
    9595  }
    9696
    97   void LpClp::_eraseRowId(int i) {
     97  void ClpLp::_eraseRowId(int i) {
    9898    rows.eraseIndex(i);
    9999    rows.shiftIndices(i);
    100100  }
    101101
    102   void LpClp::_getColName(int c, std::string& name) const {
     102  void ClpLp::_getColName(int c, std::string& name) const {
    103103    name = _prob->getColumnName(c);
    104104  }
    105105
    106   void LpClp::_setColName(int c, const std::string& name) {
     106  void ClpLp::_setColName(int c, const std::string& name) {
    107107    _prob->setColumnName(c, const_cast<std::string&>(name));
    108108    _col_names_ref[name] = c;
    109109  }
    110110
    111   int LpClp::_colByName(const std::string& name) const {
     111  int ClpLp::_colByName(const std::string& name) const {
    112112    std::map<std::string, int>::const_iterator it = _col_names_ref.find(name);
    113113    return it != _col_names_ref.end() ? it->second : -1;
    114114  }
    115115
    116   void LpClp::_getRowName(int r, std::string& name) const {
     116  void ClpLp::_getRowName(int r, std::string& name) const {
    117117    name = _prob->getRowName(r);
    118118  }
    119119
    120   void LpClp::_setRowName(int r, const std::string& name) {
     120  void ClpLp::_setRowName(int r, const std::string& name) {
    121121    _prob->setRowName(r, const_cast<std::string&>(name));
    122122    _row_names_ref[name] = r;
    123123  }
    124124
    125   int LpClp::_rowByName(const std::string& name) const {
     125  int ClpLp::_rowByName(const std::string& name) const {
    126126    std::map<std::string, int>::const_iterator it = _row_names_ref.find(name);
    127127    return it != _row_names_ref.end() ? it->second : -1;
     
    129129
    130130
    131   void LpClp::_setRowCoeffs(int ix, ExprIterator b, ExprIterator e) {
     131  void ClpLp::_setRowCoeffs(int ix, ExprIterator b, ExprIterator e) {
    132132    std::map<int, Value> coeffs;
    133133
     
    157157  }
    158158
    159   void LpClp::_getRowCoeffs(int ix, InsertIterator b) const {
     159  void ClpLp::_getRowCoeffs(int ix, InsertIterator b) const {
    160160    int n = _prob->clpMatrix()->getNumCols();
    161161
     
    174174  }
    175175
    176   void LpClp::_setColCoeffs(int ix, ExprIterator b, ExprIterator e) {
     176  void ClpLp::_setColCoeffs(int ix, ExprIterator b, ExprIterator e) {
    177177    std::map<int, Value> coeffs;
    178178
     
    197197  }
    198198
    199   void LpClp::_getColCoeffs(int ix, InsertIterator b) const {
     199  void ClpLp::_getColCoeffs(int ix, InsertIterator b) const {
    200200    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix];
    201201    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix];
     
    210210  }
    211211
    212   void LpClp::_setCoeff(int ix, int jx, Value value) {
     212  void ClpLp::_setCoeff(int ix, int jx, Value value) {
    213213    _prob->modifyCoefficient(ix, jx, value);
    214214  }
    215215
    216   LpClp::Value LpClp::_getCoeff(int ix, int jx) const {
     216  ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const {
    217217    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix];
    218218    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix];
     
    229229  }
    230230
    231   void LpClp::_setColLowerBound(int i, Value lo) {
     231  void ClpLp::_setColLowerBound(int i, Value lo) {
    232232    _prob->setColumnLower(i, lo == - INF ? - COIN_DBL_MAX : lo);
    233233  }
    234234
    235   LpClp::Value LpClp::_getColLowerBound(int i) const {
     235  ClpLp::Value ClpLp::_getColLowerBound(int i) const {
    236236    double val = _prob->getColLower()[i];
    237237    return val == - COIN_DBL_MAX ? - INF : val;
    238238  }
    239239
    240   void LpClp::_setColUpperBound(int i, Value up) {
     240  void ClpLp::_setColUpperBound(int i, Value up) {
    241241    _prob->setColumnUpper(i, up == INF ? COIN_DBL_MAX : up);
    242242  }
    243243
    244   LpClp::Value LpClp::_getColUpperBound(int i) const {
     244  ClpLp::Value ClpLp::_getColUpperBound(int i) const {
    245245    double val = _prob->getColUpper()[i];
    246246    return val == COIN_DBL_MAX ? INF : val;
    247247  }
    248248
    249   void LpClp::_setRowLowerBound(int i, Value lo) {
     249  void ClpLp::_setRowLowerBound(int i, Value lo) {
    250250    _prob->setRowLower(i, lo == - INF ? - COIN_DBL_MAX : lo);
    251251  }
    252252
    253   LpClp::Value LpClp::_getRowLowerBound(int i) const {
     253  ClpLp::Value ClpLp::_getRowLowerBound(int i) const {
    254254    double val = _prob->getRowLower()[i];
    255255    return val == - COIN_DBL_MAX ? - INF : val;
    256256  }
    257257
    258   void LpClp::_setRowUpperBound(int i, Value up) {
     258  void ClpLp::_setRowUpperBound(int i, Value up) {
    259259    _prob->setRowUpper(i, up == INF ? COIN_DBL_MAX : up);
    260260  }
    261261
    262   LpClp::Value LpClp::_getRowUpperBound(int i) const {
     262  ClpLp::Value ClpLp::_getRowUpperBound(int i) const {
    263263    double val = _prob->getRowUpper()[i];
    264264    return val == COIN_DBL_MAX ? INF : val;
    265265  }
    266266
    267   void LpClp::_setObjCoeffs(ExprIterator b, ExprIterator e) {
     267  void ClpLp::_setObjCoeffs(ExprIterator b, ExprIterator e) {
    268268    int num = _prob->clpMatrix()->getNumCols();
    269269    for (int i = 0; i < num; ++i) {
     
    275275  }
    276276
    277   void LpClp::_getObjCoeffs(InsertIterator b) const {
     277  void ClpLp::_getObjCoeffs(InsertIterator b) const {
    278278    int num = _prob->clpMatrix()->getNumCols();
    279279    for (int i = 0; i < num; ++i) {
     
    286286  }
    287287
    288   void LpClp::_setObjCoeff(int i, Value obj_coef) {
     288  void ClpLp::_setObjCoeff(int i, Value obj_coef) {
    289289    _prob->setObjectiveCoefficient(i, obj_coef);
    290290  }
    291291
    292   LpClp::Value LpClp::_getObjCoeff(int i) const {
     292  ClpLp::Value ClpLp::_getObjCoeff(int i) const {
    293293    return _prob->getObjCoefficients()[i];
    294294  }
    295295
    296   LpClp::SolveExitStatus LpClp::_solve() {
     296  ClpLp::SolveExitStatus ClpLp::_solve() {
    297297    return _prob->primal() >= 0 ? SOLVED : UNSOLVED;
    298298  }
    299299
    300   LpClp::SolveExitStatus LpClp::solvePrimal() {
     300  ClpLp::SolveExitStatus ClpLp::solvePrimal() {
    301301    return _prob->primal() >= 0 ? SOLVED : UNSOLVED;
    302302  }
    303303
    304   LpClp::SolveExitStatus LpClp::solveDual() {
     304  ClpLp::SolveExitStatus ClpLp::solveDual() {
    305305    return _prob->dual() >= 0 ? SOLVED : UNSOLVED;
    306306  }
    307307
    308   LpClp::SolveExitStatus LpClp::solveBarrier() {
     308  ClpLp::SolveExitStatus ClpLp::solveBarrier() {
    309309    return _prob->barrier() >= 0 ? SOLVED : UNSOLVED;
    310310  }
    311311
    312   LpClp::Value LpClp::_getPrimal(int i) const {
     312  ClpLp::Value ClpLp::_getPrimal(int i) const {
    313313    return _prob->primalColumnSolution()[i];
    314314  }
    315   LpClp::Value LpClp::_getPrimalValue() const {
     315  ClpLp::Value ClpLp::_getPrimalValue() const {
    316316    return _prob->objectiveValue();
    317317  }
    318318
    319   LpClp::Value LpClp::_getDual(int i) const {
     319  ClpLp::Value ClpLp::_getDual(int i) const {
    320320    return _prob->dualRowSolution()[i];
    321321  }
    322322
    323   LpClp::Value LpClp::_getPrimalRay(int i) const {
     323  ClpLp::Value ClpLp::_getPrimalRay(int i) const {
    324324    if (!_primal_ray) {
    325325      _primal_ray = _prob->unboundedRay();
     
    329329  }
    330330
    331   LpClp::Value LpClp::_getDualRay(int i) const {
     331  ClpLp::Value ClpLp::_getDualRay(int i) const {
    332332    if (!_dual_ray) {
    333333      _dual_ray = _prob->infeasibilityRay();
     
    337337  }
    338338
    339   LpClp::VarStatus LpClp::_getColStatus(int i) const {
     339  ClpLp::VarStatus ClpLp::_getColStatus(int i) const {
    340340    switch (_prob->getColumnStatus(i)) {
    341341    case ClpSimplex::basic:
     
    357357  }
    358358
    359   LpClp::VarStatus LpClp::_getRowStatus(int i) const {
     359  ClpLp::VarStatus ClpLp::_getRowStatus(int i) const {
    360360    switch (_prob->getColumnStatus(i)) {
    361361    case ClpSimplex::basic:
     
    378378
    379379
    380   LpClp::ProblemType LpClp::_getPrimalType() const {
     380  ClpLp::ProblemType ClpLp::_getPrimalType() const {
    381381    if (_prob->isProvenOptimal()) {
    382382      return OPTIMAL;
     
    390390  }
    391391
    392   LpClp::ProblemType LpClp::_getDualType() const {
     392  ClpLp::ProblemType ClpLp::_getDualType() const {
    393393    if (_prob->isProvenOptimal()) {
    394394      return OPTIMAL;
     
    402402  }
    403403
    404   void LpClp::_setSense(LpClp::Sense sense) {
     404  void ClpLp::_setSense(ClpLp::Sense sense) {
    405405    switch (sense) {
    406406    case MIN:
     
    413413  }
    414414
    415   LpClp::Sense LpClp::_getSense() const {
     415  ClpLp::Sense ClpLp::_getSense() const {
    416416    double dir = _prob->optimizationDirection();
    417417    if (dir > 0.0) {
     
    422422  }
    423423
    424   void LpClp::_clear() {
     424  void ClpLp::_clear() {
    425425    delete _prob;
    426426    _prob = new ClpSimplex();
     
    431431  }
    432432
    433   void LpClp::messageLevel(MessageLevel m) {
     433  void ClpLp::messageLevel(MessageLevel m) {
    434434    _prob->setLogLevel(static_cast<int>(m));
    435435  }
Note: See TracChangeset for help on using the changeset viewer.