1.1 --- a/lemon/lp_base.h Tue Jun 21 14:57:17 2005 +0000
1.2 +++ b/lemon/lp_base.h Tue Jun 21 15:58:57 2005 +0000
1.3 @@ -151,7 +151,7 @@
1.4 ///Could not determine so far
1.5 UNKNOWN = 4
1.6 };
1.7 -
1.8 +
1.9 ///The floating point type used by the solver
1.10 typedef double Value;
1.11 ///The infinity constant
2.1 --- a/lemon/lp_cplex.cc Tue Jun 21 14:57:17 2005 +0000
2.2 +++ b/lemon/lp_cplex.cc Tue Jun 21 15:58:57 2005 +0000
2.3 @@ -45,17 +45,17 @@
2.4 //The routine CPXcloneprob can be used to create a new CPLEX problem
2.5 //object and copy all the problem data from an existing problem
2.6 //object to it. Solution and starting information is not copied.
2.7 - newlp->lp = CPXcloneprob (env, lp, &status);
2.8 + newlp->lp = CPXcloneprob(env, lp, &status);
2.9 return *newlp;
2.10 }
2.11
2.12 int LpCplex::_addCol()
2.13 {
2.14 - int i = CPXgetnumcols (env, lp);
2.15 + int i = CPXgetnumcols(env, lp);
2.16 Value lb[1],ub[1];
2.17 lb[0]=-INF;//-CPX_INFBOUND;
2.18 ub[0]=INF;//CPX_INFBOUND;
2.19 - status = CPXnewcols (env, lp, 1, NULL, lb, ub, NULL, NULL);
2.20 + status = CPXnewcols(env, lp, 1, NULL, lb, ub, NULL, NULL);
2.21 return i;
2.22 }
2.23
2.24 @@ -67,18 +67,18 @@
2.25 sense[0]='L';//<= constraint
2.26 Value rhs[1];
2.27 rhs[0]=INF;
2.28 - int i = CPXgetnumrows (env, lp);
2.29 - status = CPXnewrows (env, lp, 1, rhs, sense, NULL, NULL);
2.30 + int i = CPXgetnumrows(env, lp);
2.31 + status = CPXnewrows(env, lp, 1, rhs, sense, NULL, NULL);
2.32 return i;
2.33 }
2.34
2.35
2.36 void LpCplex::_eraseCol(int i) {
2.37 - CPXdelcols (env, lp, i, i);
2.38 + CPXdelcols(env, lp, i, i);
2.39 }
2.40
2.41 void LpCplex::_eraseRow(int i) {
2.42 - CPXdelrows (env, lp, i, i);
2.43 + CPXdelrows(env, lp, i, i);
2.44 }
2.45
2.46
2.47 @@ -119,7 +119,7 @@
2.48
2.49 void LpCplex::_setCoeff(int row, int col, Value value)
2.50 {
2.51 - CPXchgcoef (env, lp, row, col, value);
2.52 + CPXchgcoef(env, lp, row, col, value);
2.53 }
2.54
2.55 void LpCplex::_setColLowerBound(int i, Value value)
2.56 @@ -130,7 +130,7 @@
2.57 lu[0]='L';
2.58 Value bd[1];
2.59 bd[0]=value;
2.60 - status = CPXchgbds (env, lp, 1, indices, lu, bd);
2.61 + status = CPXchgbds(env, lp, 1, indices, lu, bd);
2.62
2.63 }
2.64
2.65 @@ -142,7 +142,7 @@
2.66 lu[0]='U';
2.67 Value bd[1];
2.68 bd[0]=value;
2.69 - status = CPXchgbds (env, lp, 1, indices, lu, bd);
2.70 + status = CPXchgbds(env, lp, 1, indices, lu, bd);
2.71 }
2.72
2.73 //This will be easier to implement
2.74 @@ -160,27 +160,27 @@
2.75
2.76 if (lb==-INF){
2.77 sense[0]='L';
2.78 - CPXchgsense (env, lp, cnt, indices, sense);
2.79 - CPXchgcoef (env, lp, i, -1, ub);
2.80 + CPXchgsense(env, lp, cnt, indices, sense);
2.81 + CPXchgcoef(env, lp, i, -1, ub);
2.82
2.83 }
2.84 else{
2.85 if (ub==INF){
2.86 sense[0]='G';
2.87 - CPXchgsense (env, lp, cnt, indices, sense);
2.88 - CPXchgcoef (env, lp, i, -1, lb);
2.89 + CPXchgsense(env, lp, cnt, indices, sense);
2.90 + CPXchgcoef(env, lp, i, -1, lb);
2.91 }
2.92 else{
2.93 if (lb == ub){
2.94 sense[0]='E';
2.95 - CPXchgsense (env, lp, cnt, indices, sense);
2.96 - CPXchgcoef (env, lp, i, -1, lb);
2.97 + CPXchgsense(env, lp, cnt, indices, sense);
2.98 + CPXchgcoef(env, lp, i, -1, lb);
2.99 }
2.100 else{
2.101 sense[0]='R';
2.102 - CPXchgsense (env, lp, cnt, indices, sense);
2.103 - CPXchgcoef (env, lp, i, -1, lb);
2.104 - CPXchgcoef (env, lp, i, -2, ub-lb);
2.105 + CPXchgsense(env, lp, cnt, indices, sense);
2.106 + CPXchgcoef(env, lp, i, -1, lb);
2.107 + CPXchgcoef(env, lp, i, -2, ub-lb);
2.108 }
2.109 }
2.110 }
2.111 @@ -197,9 +197,9 @@
2.112 // // //TODO Ezt kell meg megirni
2.113 // // //type of the problem
2.114 // // char sense[1];
2.115 -// // status = CPXgetsense (env, lp, sense, i, i);
2.116 +// // status = CPXgetsense(env, lp, sense, i, i);
2.117 // // Value rhs[1];
2.118 -// // status = CPXgetrhs (env, lp, rhs, i, i);
2.119 +// // status = CPXgetrhs(env, lp, rhs, i, i);
2.120
2.121 // // switch (sense[0]) {
2.122 // // case 'L'://<= constraint
2.123 @@ -214,18 +214,18 @@
2.124 // // //FIXME error
2.125 // // }
2.126
2.127 -// // status = CPXchgcoef (env, lp, i, -2, value_rng);
2.128 +// // status = CPXchgcoef(env, lp, i, -2, value_rng);
2.129 // }
2.130
2.131 void LpCplex::_setObjCoeff(int i, Value obj_coef)
2.132 {
2.133 - CPXchgcoef (env, lp, -1, i, obj_coef);
2.134 + CPXchgcoef(env, lp, -1, i, obj_coef);
2.135 }
2.136
2.137 void LpCplex::_clearObj()
2.138 {
2.139 - for (int i=0;i< CPXgetnumcols (env, lp);++i){
2.140 - CPXchgcoef (env, lp, -1, i, 0);
2.141 + for (int i=0;i< CPXgetnumcols(env, lp);++i){
2.142 + CPXchgcoef(env, lp, -1, i, 0);
2.143 }
2.144
2.145 }
2.146 @@ -241,10 +241,10 @@
2.147 LpCplex::SolveExitStatus LpCplex::_solve()
2.148 {
2.149 //CPX_PARAM_LPMETHOD
2.150 - status = CPXlpopt (env, lp);
2.151 + status = CPXlpopt(env, lp);
2.152 if (status == 0){
2.153 //We want to exclude some cases
2.154 - switch (CPXgetstat (env, lp)){
2.155 + switch (CPXgetstat(env, lp)){
2.156 case CPX_OBJ_LIM:
2.157 case CPX_IT_LIM_FEAS:
2.158 case CPX_IT_LIM_INFEAS:
2.159 @@ -263,7 +263,7 @@
2.160 LpCplex::Value LpCplex::_getPrimal(int i)
2.161 {
2.162 Value x;
2.163 - CPXgetx (env, lp, &x, i, i);
2.164 + CPXgetx(env, lp, &x, i, i);
2.165 return x;
2.166 }
2.167
2.168 @@ -271,7 +271,9 @@
2.169 {
2.170 Value objval;
2.171 //method = CPXgetmethod (env, lp);
2.172 - status = CPXgetobjval (env, lp, &objval);
2.173 + //printf("CPXgetprobtype %d \n",CPXgetprobtype(env,lp));
2.174 + status = CPXgetobjval(env, lp, &objval);
2.175 + //printf("Objective value: %g \n",objval);
2.176 return objval;
2.177 }
2.178
2.179 @@ -329,7 +331,8 @@
2.180
2.181 LpCplex::SolutionStatus LpCplex::_getPrimalStatus()
2.182 {
2.183 - int stat = CPXgetstat (env, lp);
2.184 + int stat = CPXgetstat(env, lp);
2.185 + //printf("A primal status: %d, CPX_OPTIMAL=%d \n",stat,CPX_OPTIMAL);
2.186 switch (stat) {
2.187 case 0:
2.188 return UNDEFINED; //Undefined
2.189 @@ -379,7 +382,7 @@
2.190
2.191 LpCplex::SolutionStatus LpCplex::_getDualStatus()
2.192 {
2.193 - int stat = CPXgetstat (env, lp);
2.194 + int stat = CPXgetstat(env, lp);
2.195 switch (stat) {
2.196 case 0:
2.197 return UNDEFINED; //Undefined
2.198 @@ -395,7 +398,7 @@
2.199
2.200 LpCplex::ProblemTypes LpCplex::_getProblemType()
2.201 {
2.202 - int stat = CPXgetstat (env, lp);
2.203 + int stat = CPXgetstat(env, lp);
2.204 switch (stat) {
2.205 case CPX_OPTIMAL://Optimal
2.206 return PRIMAL_DUAL_FEASIBLE;
2.207 @@ -414,11 +417,11 @@
2.208
2.209 void LpCplex::_setMax()
2.210 {
2.211 - CPXchgobjsen (env, lp, CPX_MAX);
2.212 + CPXchgobjsen(env, lp, CPX_MAX);
2.213 }
2.214 void LpCplex::_setMin()
2.215 {
2.216 - CPXchgobjsen (env, lp, CPX_MIN);
2.217 + CPXchgobjsen(env, lp, CPX_MIN);
2.218 }
2.219
2.220 } //namespace lemon
3.1 --- a/lemon/lp_skeleton.h Tue Jun 21 14:57:17 2005 +0000
3.2 +++ b/lemon/lp_skeleton.h Tue Jun 21 15:58:57 2005 +0000
3.3 @@ -22,7 +22,7 @@
3.4 ///\file
3.5 ///\brief A skeleton file to implement LP solver interfaces
3.6 namespace lemon {
3.7 -
3.8 +
3.9 ///A skeleton class to implement LP solver interfaces
3.10 class LpSkeleton :public LpSolverBase {
3.11 int col_num,row_num;
4.1 --- a/test/lp_test.cc Tue Jun 21 14:57:17 2005 +0000
4.2 +++ b/test/lp_test.cc Tue Jun 21 15:58:57 2005 +0000
4.3 @@ -17,12 +17,17 @@
4.4
4.5 void lpTest(LpSolverBase & lp)
4.6 {
4.7 +
4.8 +
4.9 +
4.10 typedef LpSolverBase LP;
4.11
4.12 std::vector<LP::Col> x(10);
4.13 // for(int i=0;i<10;i++) x.push_back(lp.addCol());
4.14 lp.addColSet(x);
4.15
4.16 +#ifndef GYORSITAS
4.17 +
4.18 std::vector<LP::Col> y(10);
4.19 lp.addColSet(y);
4.20
4.21 @@ -174,7 +179,7 @@
4.22 );
4.23 }
4.24
4.25 -
4.26 +#endif
4.27 }
4.28
4.29 void aTest(LpSolverBase & lp)
4.30 @@ -240,8 +245,9 @@
4.31 #endif
4.32
4.33 #ifdef HAVE_CPLEX
4.34 -// LpCplex lp_cplex;
4.35 -// lpTest(lp_cplex);
4.36 + LpCplex lp_cplex;
4.37 + lpTest(lp_cplex);
4.38 + aTest(lp_cplex);
4.39 #endif
4.40
4.41 return 0;