Changeset 1319:6e277ba3fc76 in lemon0.x for src/work/athos/lp/lp_cplex.cc
 Timestamp:
 04/07/05 17:22:03 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1758
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/work/athos/lp/lp_cplex.cc
r1303 r1319 25 25 { 26 26 int i = CPXgetnumcols (env, lp); 27 intlb[1],ub[1];27 Value lb[1],ub[1]; 28 28 lb[0]=INF;//CPX_INFBOUND; 29 29 ub[0]=INF;//CPX_INFBOUND; … … 34 34 int LpCplex::_addRow() 35 35 { 36 //We want a ranged row 37 char sense[1]; 38 sense[0]='R'; 39 36 40 int i = CPXgetnumrows (env, lp); 37 status = CPXnewrows (env, lp, 1, NULL, NULL, NULL, NULL, NULL);41 status = CPXnewrows (env, lp, 1, NULL, sense, NULL, NULL); 38 42 return i; 39 43 } … … 46 50 { 47 51 int rowlist[length+1]; 52 int* p=rowlist; 48 53 for (int k=1;k<=length;++k){ 49 54 rowlist[k]=i; … … 51 56 status = CPXchgcoeflist(env, lp, 52 57 length, 53 rowlist++,54 inices++,55 values++);58 p++, 59 const_cast<int * >(indices++), 60 const_cast<Value * >(values++)); 56 61 } 57 62 … … 62 67 { 63 68 int collist[length+1]; 69 int* p=collist; 64 70 for (int k=1;k<=length;++k){ 65 71 collist[k]=i; … … 67 73 status = CPXchgcoeflist(env, lp, 68 74 length, 69 inices++,70 collist++,71 values++);75 const_cast<int * >(indices++), 76 p++, 77 const_cast<Value * >(values++)); 72 78 } 73 79 74 80 void LpCplex::_setColLowerBound(int i, Value value) 75 81 { 82 int indices[1]; 83 indices[0]=i; 84 char lu[1]; 85 lu[0]='L'; 86 Value bd[1]; 87 bd[0]=value; 88 status = CPXchgbds (env, lp, 1, indices, lu, bd); 89 76 90 } 77 91 78 92 void LpCplex::_setColUpperBound(int i, Value value) 79 93 { 94 int indices[1]; 95 indices[0]=i; 96 char lu[1]; 97 lu[0]='U'; 98 Value bd[1]; 99 bd[0]=value; 100 status = CPXchgbds (env, lp, 1, indices, lu, bd); 80 101 } 81 102 82 103 void LpCplex::_setRowLowerBound(int i, Value value) 83 104 { 105 status = CPXchgcoef (env, lp, i, 1, value); 106 84 107 } 85 108 86 109 void LpCplex::_setRowUpperBound(int i, Value value) 87 110 { 111 //TODO Ezt kell meg megirni 112 // Value lo=CPX 88 113 } 89 114 90 115 void LpCplex::_setObjCoeff(int i, Value obj_coef) 91 116 { 117 status = CPXchgcoef (env, lp, 1, i, obj_coef); 118 } 119 120 LpCplex::SolveExitStatus LpCplex::_solve() 121 { 122 return SOLVED; 123 // int i= lpx_simplex(lp); 124 // switch (i) { 125 // case LPX_E_OK: 126 // return SOLVED; 127 // break; 128 // default: 129 // return UNSOLVED; 130 // } 92 131 } 93 132 94 LpCplex::SolutionStatus LpCplex::_solve() 95 { 96 return OPTIMAL; 97 } 98 99 LpCplex::Value LpCplex::_getSolution(int i) 133 LpCplex::Value LpCplex::_getPrimal(int i) 100 134 { 101 135 return 0; 102 136 } 103 137 138 LpCplex::Value LpCplex::_getPrimalValue() 139 { 140 return 0; 141 } 142 143 144 LpCplex::SolutionStatus LpCplex::_getPrimalStatus() 145 { 146 return OPTIMAL; 147 // int stat= lpx_get_status(lp); 148 // switch (stat) { 149 // case LPX_UNDEF://Undefined (no solve has been run yet) 150 // return UNDEFINED; 151 // break; 152 // case LPX_NOFEAS://There is no feasible solution (primal, I guess) 153 // case LPX_INFEAS://Infeasible 154 // return INFEASIBLE; 155 // break; 156 // case LPX_UNBND://Unbounded 157 // return INFINITE; 158 // break; 159 // case LPX_FEAS://Feasible 160 // return FEASIBLE; 161 // break; 162 // case LPX_OPT://Feasible 163 // return OPTIMAL; 164 // break; 165 // default: 166 // return UNDEFINED; //to avoid gcc warning 167 // //FIXME error 168 // } 169 } 170 171 172 void LpCplex::_setMax() 173 { 174 CPXchgobjsen (env, lp, CPX_MAX); 175 } 176 void LpCplex::_setMin() 177 { 178 CPXchgobjsen (env, lp, CPX_MIN); 179 } 180 104 181 } //namespace lemon 105 182
Note: See TracChangeset
for help on using the changeset viewer.