COIN-OR::LEMON - Graph Library

Changeset 1016:97975184f4aa in lemon-main


Ignore:
Timestamp:
02/22/13 16:49:41 (12 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
1014:bc726f4892c7 (diff), 1015:d32e4453b48c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge bugfix #445

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/cplex.cc

    r989 r1016  
    4141    int status;
    4242    _cnt = new int;
     43    (*_cnt) = 1;
    4344    _env = CPXopenCPLEX(&status);
    4445    if (_env == 0) {
  • lemon/cplex.cc

    r1015 r1016  
    33 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    5  * Copyright (C) 2003-2009
     5 * Copyright (C) 2003-2010
    66 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    77 * (Egervary Research Group on Combinatorial Optimization, EGRES).
     
    113113  }
    114114
     115  int CplexBase::_addRow(Value lb, ExprIterator b,
     116                         ExprIterator e, Value ub) {
     117    int i = CPXgetnumrows(cplexEnv(), _prob);
     118    if (lb == -INF) {
     119      const char s = 'L';
     120      CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0);
     121    } else if (ub == INF) {
     122      const char s = 'G';
     123      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     124    } else if (lb == ub){
     125      const char s = 'E';
     126      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0);
     127    } else {
     128      const char s = 'R';
     129      double len = ub - lb;
     130      CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, &len, 0);
     131    }
     132
     133    std::vector<int> indices;
     134    std::vector<int> rowlist;
     135    std::vector<Value> values;
     136
     137    for(ExprIterator it=b; it!=e; ++it) {
     138      indices.push_back(it->first);
     139      values.push_back(it->second);
     140      rowlist.push_back(i);
     141    }
     142
     143    CPXchgcoeflist(cplexEnv(), _prob, values.size(),
     144                   &rowlist.front(), &indices.front(), &values.front());
     145
     146    return i;
     147  }
    115148
    116149  void CplexBase::_eraseCol(int i) {
     
    456489
    457490  void CplexBase::_applyMessageLevel() {
    458     CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND, 
     491    CPXsetintparam(cplexEnv(), CPX_PARAM_SCRIND,
    459492                   _message_enabled ? CPX_ON : CPX_OFF);
    460493  }
Note: See TracChangeset for help on using the changeset viewer.