Changeset 1431:ad44b1dd8013 in lemon-0.x
- Timestamp:
- 05/20/05 11:31:25 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1905
- Location:
- src/lemon
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/lp_base.h
r1405 r1431 430 430 int const * indices, 431 431 Value const * values ) = 0; 432 virtual void _setCoeff(int row, int col, Value value) = 0; 432 433 virtual void _setColLowerBound(int i, Value value) = 0; 433 434 virtual void _setColUpperBound(int i, Value value) = 0; -
src/lemon/lp_cplex.cc
r1407 r1431 132 132 } 133 133 134 void LpCplex::_setCoeff(int row, int col, Value value) 135 { 136 CPXchgcoef (env, lp, row, col, value); 137 } 138 134 139 void LpCplex::_setColLowerBound(int i, Value value) 135 140 { -
src/lemon/lp_cplex.h
r1405 r1431 64 64 const int * indices, 65 65 const Value * values); 66 virtual void _setCoeff(int row, int col, Value value); 66 67 virtual void _setColLowerBound(int i, Value value); 67 68 virtual void _setColUpperBound(int i, Value value); -
src/lemon/lp_glpk.cc
r1405 r1431 88 88 const_cast<Value * >(values)); 89 89 } 90 90 91 92 void LpGlpk::_setCoeff(int row, int col, Value value) 93 { 94 ///FIXME Of course this is not efficient at all, but GLPK knows not more. 95 // First approach: get one row, apply changes and set it again 96 //(one idea to improve this: maybe it is better to do this with 1 coloumn) 97 98 int mem_length=2+lpx_get_num_cols(lp); 99 int* indices = new int[mem_length]; 100 Value* values = new Value[mem_length]; 101 102 103 int length=lpx_get_mat_row(lp, row, indices, values); 104 105 //The following code does not suppose that the elements of the array indices are sorted 106 int i=1; 107 bool found=false; 108 while (i <= length && !found){ 109 if (indices[i]==col){ 110 found = true; 111 values[i]=value; 112 } 113 ++i; 114 } 115 if (!found){ 116 ++length; 117 indices[length]=col; 118 values[length]=value; 119 } 120 121 lpx_set_mat_row(lp, row, length, indices, values); 122 delete [] indices; 123 delete [] values; 124 125 } 126 91 127 void LpGlpk::_setColLowerBound(int i, Value lo) 92 128 { -
src/lemon/lp_glpk.h
r1405 r1431 59 59 const int * indices, 60 60 const Value * values); 61 virtual void _setCoeff(int row, int col, Value value); 61 62 virtual void _setColLowerBound(int i, Value value); 62 63 virtual void _setColUpperBound(int i, Value value); -
src/lemon/lp_skeleton.cc
r1405 r1431 57 57 { 58 58 } 59 59 60 void LpSkeleton::_setCoeff(int, int, Value ) 61 { 62 } 63 64 60 65 void LpSkeleton::_setColLowerBound(int, Value) 61 66 { -
src/lemon/lp_skeleton.h
r1405 r1431 55 55 Value const * values ); 56 56 57 /// \e 57 /// Set one element of the coefficient matrix 58 virtual void _setCoeff(int row, int col, Value value); 58 59 59 60 /// The lower bound of a variable (column) have to be given by an
Note: See TracChangeset
for help on using the changeset viewer.