Changeset 1125:1ad592289f93 in lemon-main
- Timestamp:
- 11/12/14 14:11:20 (10 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/cplex.cc
r1092 r1125 116 116 ExprIterator e, Value ub) { 117 117 int i = CPXgetnumrows(cplexEnv(), _prob); 118 119 int rmatbeg = 0; 120 121 std::vector<int> indices; 122 std::vector<Value> values; 123 124 for(ExprIterator it=b; it!=e; ++it) { 125 indices.push_back(it->first); 126 values.push_back(it->second); 127 } 128 118 129 if (lb == -INF) { 119 130 const char s = 'L'; 120 CPXnewrows(cplexEnv(), _prob, 1, &ub, &s, 0, 0); 131 CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s, 132 &rmatbeg, &indices.front(), &values.front(), 0, 0); 121 133 } else if (ub == INF) { 122 134 const char s = 'G'; 123 CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0); 135 CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s, 136 &rmatbeg, &indices.front(), &values.front(), 0, 0); 124 137 } else if (lb == ub){ 125 138 const char s = 'E'; 126 CPXnewrows(cplexEnv(), _prob, 1, &lb, &s, 0, 0); 139 CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s, 140 &rmatbeg, &indices.front(), &values.front(), 0, 0); 127 141 } else { 128 142 const char s = 'R'; 129 143 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 144 CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s, 145 &rmatbeg, &indices.front(), &values.front(), 0, 0); 146 CPXchgrngval(cplexEnv(), _prob, 1, &i, &len); 147 } 148 146 149 return i; 147 150 }
Note: See TracChangeset
for help on using the changeset viewer.