test/lp_test.cc
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 20 Jan 2021 16:31:29 +0100
changeset 1206 86a5b114a066
parent 1131 4add05447ca0
permissions -rw-r--r--
Implement CplLp::write() for LP format (#640)
deba@458
     1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
deba@458
     2
 *
deba@458
     3
 * This file is a part of LEMON, a generic C++ optimization library.
deba@458
     4
 *
alpar@1092
     5
 * Copyright (C) 2003-2013
deba@458
     6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
deba@458
     7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@458
     8
 *
deba@458
     9
 * Permission to use, modify and distribute this software is granted
deba@458
    10
 * provided that this copyright notice appears in all copies. For
deba@458
    11
 * precise terms see the accompanying LICENSE file.
deba@458
    12
 *
deba@458
    13
 * This software is provided "AS IS" with no warranty of any kind,
deba@458
    14
 * express or implied, and with no claim as to its suitability for any
deba@458
    15
 * purpose.
deba@458
    16
 *
deba@458
    17
 */
deba@458
    18
deba@458
    19
#include <sstream>
deba@458
    20
#include <lemon/lp_skeleton.h>
deba@458
    21
#include "test_tools.h"
deba@458
    22
#include <lemon/tolerance.h>
alpar@1131
    23
#include <lemon/concept_check.h>
deba@458
    24
#include <lemon/config.h>
deba@458
    25
ladanyi@627
    26
#ifdef LEMON_HAVE_GLPK
alpar@461
    27
#include <lemon/glpk.h>
deba@458
    28
#endif
deba@458
    29
ladanyi@627
    30
#ifdef LEMON_HAVE_CPLEX
alpar@461
    31
#include <lemon/cplex.h>
deba@458
    32
#endif
deba@458
    33
ladanyi@627
    34
#ifdef LEMON_HAVE_SOPLEX
alpar@461
    35
#include <lemon/soplex.h>
deba@458
    36
#endif
deba@458
    37
ladanyi@627
    38
#ifdef LEMON_HAVE_CLP
alpar@461
    39
#include <lemon/clp.h>
deba@459
    40
#endif
deba@459
    41
alpar@1105
    42
#ifdef LEMON_HAVE_LP
alpar@1105
    43
#include <lemon/lp.h>
alpar@1105
    44
#endif
deba@458
    45
using namespace lemon;
deba@458
    46
alpar@988
    47
int countCols(LpBase & lp) {
alpar@988
    48
  int count=0;
alpar@988
    49
  for (LpBase::ColIt c(lp); c!=INVALID; ++c) ++count;
alpar@1131
    50
#ifdef LEMON_CXX11
alpar@1131
    51
  int cnt = 0;
alpar@1131
    52
  for(auto c: lp.cols()) { cnt++; ::lemon::ignore_unused_variable_warning(c); }
alpar@1131
    53
  check(count == cnt, "Wrong STL iterator");
alpar@1131
    54
#endif
alpar@988
    55
  return count;
alpar@988
    56
}
alpar@988
    57
alpar@988
    58
int countRows(LpBase & lp) {
alpar@988
    59
  int count=0;
alpar@988
    60
  for (LpBase::RowIt r(lp); r!=INVALID; ++r) ++count;
alpar@1131
    61
#ifdef LEMON_CXX11
alpar@1131
    62
  int cnt = 0;
alpar@1131
    63
  for(auto r: lp.rows()) { cnt++; ::lemon::ignore_unused_variable_warning(r); }
alpar@1131
    64
  check(count == cnt, "Wrong STL iterator");
alpar@1131
    65
#endif
alpar@988
    66
  return count;
alpar@988
    67
}
alpar@988
    68
alpar@988
    69
deba@459
    70
void lpTest(LpSolver& lp)
deba@458
    71
{
deba@458
    72
deba@459
    73
  typedef LpSolver LP;
deba@458
    74
alpar@988
    75
  // Test LpBase::clear()
alpar@988
    76
  check(countRows(lp)==0, "Wrong number of rows");
alpar@988
    77
  check(countCols(lp)==0, "Wrong number of cols");
alpar@988
    78
  lp.addCol(); lp.addRow(); lp.addRow();
alpar@988
    79
  check(countRows(lp)==2, "Wrong number of rows");
alpar@988
    80
  check(countCols(lp)==1, "Wrong number of cols");
alpar@988
    81
  lp.clear();
alpar@988
    82
  check(countRows(lp)==0, "Wrong number of rows");
alpar@988
    83
  check(countCols(lp)==0, "Wrong number of cols");
alpar@988
    84
  lp.addCol(); lp.addCol(); lp.addCol(); lp.addRow();
alpar@988
    85
  check(countRows(lp)==1, "Wrong number of rows");
alpar@988
    86
  check(countCols(lp)==3, "Wrong number of cols");
alpar@988
    87
  lp.clear();
alpar@988
    88
deba@458
    89
  std::vector<LP::Col> x(10);
deba@458
    90
  //  for(int i=0;i<10;i++) x.push_back(lp.addCol());
deba@458
    91
  lp.addColSet(x);
deba@458
    92
  lp.colLowerBound(x,1);
deba@458
    93
  lp.colUpperBound(x,1);
deba@458
    94
  lp.colBounds(x,1,2);
deba@458
    95
deba@458
    96
  std::vector<LP::Col> y(10);
deba@458
    97
  lp.addColSet(y);
deba@458
    98
deba@458
    99
  lp.colLowerBound(y,1);
deba@458
   100
  lp.colUpperBound(y,1);
deba@458
   101
  lp.colBounds(y,1,2);
deba@458
   102
deba@458
   103
  std::map<int,LP::Col> z;
deba@458
   104
deba@458
   105
  z.insert(std::make_pair(12,INVALID));
deba@458
   106
  z.insert(std::make_pair(2,INVALID));
deba@458
   107
  z.insert(std::make_pair(7,INVALID));
deba@458
   108
  z.insert(std::make_pair(5,INVALID));
deba@458
   109
deba@458
   110
  lp.addColSet(z);
deba@458
   111
deba@458
   112
  lp.colLowerBound(z,1);
deba@458
   113
  lp.colUpperBound(z,1);
deba@458
   114
  lp.colBounds(z,1,2);
deba@458
   115
deba@458
   116
  {
deba@458
   117
    LP::Expr e,f,g;
deba@458
   118
    LP::Col p1,p2,p3,p4,p5;
deba@458
   119
    LP::Constr c;
deba@458
   120
deba@458
   121
    p1=lp.addCol();
deba@458
   122
    p2=lp.addCol();
deba@458
   123
    p3=lp.addCol();
deba@458
   124
    p4=lp.addCol();
deba@458
   125
    p5=lp.addCol();
deba@458
   126
deba@458
   127
    e[p1]=2;
deba@459
   128
    *e=12;
deba@458
   129
    e[p1]+=2;
deba@459
   130
    *e+=12;
deba@458
   131
    e[p1]-=2;
deba@459
   132
    *e-=12;
deba@458
   133
deba@458
   134
    e=2;
deba@458
   135
    e=2.2;
deba@458
   136
    e=p1;
deba@458
   137
    e=f;
deba@458
   138
deba@458
   139
    e+=2;
deba@458
   140
    e+=2.2;
deba@458
   141
    e+=p1;
deba@458
   142
    e+=f;
deba@458
   143
deba@458
   144
    e-=2;
deba@458
   145
    e-=2.2;
deba@458
   146
    e-=p1;
deba@458
   147
    e-=f;
deba@458
   148
deba@458
   149
    e*=2;
deba@458
   150
    e*=2.2;
deba@458
   151
    e/=2;
deba@458
   152
    e/=2.2;
deba@458
   153
deba@458
   154
    e=((p1+p2)+(p1-p2)+(p1+12)+(12+p1)+(p1-12)+(12-p1)+
deba@458
   155
       (f+12)+(12+f)+(p1+f)+(f+p1)+(f+g)+
deba@458
   156
       (f-12)+(12-f)+(p1-f)+(f-p1)+(f-g)+
deba@458
   157
       2.2*f+f*2.2+f/2.2+
deba@458
   158
       2*f+f*2+f/2+
deba@458
   159
       2.2*p1+p1*2.2+p1/2.2+
deba@458
   160
       2*p1+p1*2+p1/2
deba@458
   161
       );
deba@458
   162
deba@458
   163
deba@458
   164
    c = (e  <= f  );
deba@458
   165
    c = (e  <= 2.2);
deba@458
   166
    c = (e  <= 2  );
deba@458
   167
    c = (e  <= p1 );
deba@458
   168
    c = (2.2<= f  );
deba@458
   169
    c = (2  <= f  );
deba@458
   170
    c = (p1 <= f  );
deba@458
   171
    c = (p1 <= p2 );
deba@458
   172
    c = (p1 <= 2.2);
deba@458
   173
    c = (p1 <= 2  );
deba@458
   174
    c = (2.2<= p2 );
deba@458
   175
    c = (2  <= p2 );
deba@458
   176
deba@458
   177
    c = (e  >= f  );
deba@458
   178
    c = (e  >= 2.2);
deba@458
   179
    c = (e  >= 2  );
deba@458
   180
    c = (e  >= p1 );
deba@458
   181
    c = (2.2>= f  );
deba@458
   182
    c = (2  >= f  );
deba@458
   183
    c = (p1 >= f  );
deba@458
   184
    c = (p1 >= p2 );
deba@458
   185
    c = (p1 >= 2.2);
deba@458
   186
    c = (p1 >= 2  );
deba@458
   187
    c = (2.2>= p2 );
deba@458
   188
    c = (2  >= p2 );
deba@458
   189
deba@458
   190
    c = (e  == f  );
deba@458
   191
    c = (e  == 2.2);
deba@458
   192
    c = (e  == 2  );
deba@458
   193
    c = (e  == p1 );
deba@458
   194
    c = (2.2== f  );
deba@458
   195
    c = (2  == f  );
deba@458
   196
    c = (p1 == f  );
deba@458
   197
    //c = (p1 == p2 );
deba@458
   198
    c = (p1 == 2.2);
deba@458
   199
    c = (p1 == 2  );
deba@458
   200
    c = (2.2== p2 );
deba@458
   201
    c = (2  == p2 );
deba@458
   202
alpar@460
   203
    c = ((2 <= e) <= 3);
alpar@460
   204
    c = ((2 <= p1) <= 3);
deba@458
   205
alpar@460
   206
    c = ((2 >= e) >= 3);
alpar@460
   207
    c = ((2 >= p1) >= 3);
deba@458
   208
retvari@957
   209
    { //Tests for #430
retvari@957
   210
      LP::Col v=lp.addCol();
retvari@957
   211
      LP::Constr c = v >= -3;
retvari@957
   212
      c = c <= 4;
retvari@957
   213
      LP::Constr c2;
alpar@1078
   214
#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 3 )
alpar@1078
   215
      c2 = ( -3 <= v ) <= 4;
alpar@1078
   216
#else
retvari@957
   217
      c2 = -3 <= v <= 4;
alpar@1078
   218
#endif
alpar@1078
   219
retvari@957
   220
    }
retvari@957
   221
deba@458
   222
    e[x[3]]=2;
deba@458
   223
    e[x[3]]=4;
deba@458
   224
    e[x[3]]=1;
deba@459
   225
    *e=12;
deba@458
   226
deba@459
   227
    lp.addRow(-LP::INF,e,23);
deba@459
   228
    lp.addRow(-LP::INF,3.0*(x[1]+x[2]/2)-x[3],23);
deba@459
   229
    lp.addRow(-LP::INF,3.0*(x[1]+x[2]*2-5*x[3]+12-x[4]/3)+2*x[4]-4,23);
deba@458
   230
deba@458
   231
    lp.addRow(x[1]+x[3]<=x[5]-3);
alpar@460
   232
    lp.addRow((-7<=x[1]+x[3]-12)<=3);
deba@458
   233
    lp.addRow(x[1]<=x[5]);
deba@458
   234
deba@458
   235
    std::ostringstream buf;
deba@458
   236
deba@458
   237
deba@458
   238
    e=((p1+p2)+(p1-0.99*p2));
deba@458
   239
    //e.prettyPrint(std::cout);
deba@458
   240
    //(e<=2).prettyPrint(std::cout);
deba@458
   241
    double tolerance=0.001;
deba@458
   242
    e.simplify(tolerance);
deba@458
   243
    buf << "Coeff. of p2 should be 0.01";
deba@458
   244
    check(e[p2]>0, buf.str());
deba@458
   245
deba@458
   246
    tolerance=0.02;
deba@458
   247
    e.simplify(tolerance);
deba@458
   248
    buf << "Coeff. of p2 should be 0";
deba@459
   249
    check(const_cast<const LpSolver::Expr&>(e)[p2]==0, buf.str());
deba@458
   250
alpar@540
   251
    //Test for clone/new
alpar@540
   252
    LP* lpnew = lp.newSolver();
alpar@540
   253
    LP* lpclone = lp.cloneSolver();
alpar@540
   254
    delete lpnew;
alpar@540
   255
    delete lpclone;
deba@458
   256
deba@458
   257
  }
deba@458
   258
deba@458
   259
  {
deba@458
   260
    LP::DualExpr e,f,g;
alpar@1064
   261
    LP::Row p1 = INVALID, p2 = INVALID;
deba@458
   262
deba@458
   263
    e[p1]=2;
deba@458
   264
    e[p1]+=2;
deba@458
   265
    e[p1]-=2;
deba@458
   266
deba@458
   267
    e=p1;
deba@458
   268
    e=f;
deba@458
   269
deba@458
   270
    e+=p1;
deba@458
   271
    e+=f;
deba@458
   272
deba@458
   273
    e-=p1;
deba@458
   274
    e-=f;
deba@458
   275
deba@458
   276
    e*=2;
deba@458
   277
    e*=2.2;
deba@458
   278
    e/=2;
deba@458
   279
    e/=2.2;
deba@458
   280
deba@458
   281
    e=((p1+p2)+(p1-p2)+
deba@458
   282
       (p1+f)+(f+p1)+(f+g)+
deba@458
   283
       (p1-f)+(f-p1)+(f-g)+
deba@458
   284
       2.2*f+f*2.2+f/2.2+
deba@458
   285
       2*f+f*2+f/2+
deba@458
   286
       2.2*p1+p1*2.2+p1/2.2+
deba@458
   287
       2*p1+p1*2+p1/2
deba@458
   288
       );
deba@458
   289
  }
deba@458
   290
deba@458
   291
}
deba@458
   292
deba@459
   293
void solveAndCheck(LpSolver& lp, LpSolver::ProblemType stat,
deba@458
   294
                   double exp_opt) {
deba@458
   295
  using std::string;
deba@458
   296
  lp.solve();
deba@459
   297
deba@458
   298
  std::ostringstream buf;
deba@459
   299
  buf << "PrimalType should be: " << int(stat) << int(lp.primalType());
deba@458
   300
deba@459
   301
  check(lp.primalType()==stat, buf.str());
deba@458
   302
deba@459
   303
  if (stat ==  LpSolver::OPTIMAL) {
deba@458
   304
    std::ostringstream sbuf;
alpar@540
   305
    sbuf << "Wrong optimal value (" << lp.primal() <<") with "
alpar@540
   306
         << lp.solverName() <<"\n     the right optimum is " << exp_opt;
deba@459
   307
    check(std::abs(lp.primal()-exp_opt) < 1e-3, sbuf.str());
deba@458
   308
  }
deba@458
   309
}
deba@458
   310
deba@459
   311
void aTest(LpSolver & lp)
deba@458
   312
{
deba@459
   313
  typedef LpSolver LP;
deba@458
   314
deba@458
   315
 //The following example is very simple
deba@458
   316
deba@459
   317
  typedef LpSolver::Row Row;
deba@459
   318
  typedef LpSolver::Col Col;
deba@458
   319
deba@458
   320
deba@458
   321
  Col x1 = lp.addCol();
deba@458
   322
  Col x2 = lp.addCol();
deba@458
   323
deba@458
   324
deba@458
   325
  //Constraints
deba@459
   326
  Row upright=lp.addRow(x1+2*x2 <=1);
deba@458
   327
  lp.addRow(x1+x2 >=-1);
deba@458
   328
  lp.addRow(x1-x2 <=1);
deba@458
   329
  lp.addRow(x1-x2 >=-1);
deba@458
   330
  //Nonnegativity of the variables
deba@458
   331
  lp.colLowerBound(x1, 0);
deba@458
   332
  lp.colLowerBound(x2, 0);
deba@458
   333
  //Objective function
deba@458
   334
  lp.obj(x1+x2);
deba@458
   335
deba@459
   336
  lp.sense(lp.MAX);
deba@458
   337
deba@458
   338
  //Testing the problem retrieving routines
deba@458
   339
  check(lp.objCoeff(x1)==1,"First term should be 1 in the obj function!");
deba@459
   340
  check(lp.sense() == lp.MAX,"This is a maximization!");
deba@458
   341
  check(lp.coeff(upright,x1)==1,"The coefficient in question is 1!");
alpar@1205
   342
  check(lp.coeff(upright,x2)==2,"The coefficient in question is 1!");
deba@459
   343
  check(lp.colLowerBound(x1)==0,
deba@459
   344
        "The lower bound for variable x1 should be 0.");
deba@459
   345
  check(lp.colUpperBound(x1)==LpSolver::INF,
deba@459
   346
        "The upper bound for variable x1 should be infty.");
deba@459
   347
  check(lp.rowLowerBound(upright) == -LpSolver::INF,
deba@459
   348
        "The lower bound for the first row should be -infty.");
deba@459
   349
  check(lp.rowUpperBound(upright)==1,
deba@459
   350
        "The upper bound for the first row should be 1.");
deba@459
   351
  LpSolver::Expr e = lp.row(upright);
deba@459
   352
  check(e[x1] == 1, "The first coefficient should 1.");
deba@459
   353
  check(e[x2] == 2, "The second coefficient should 1.");
deba@458
   354
deba@459
   355
  lp.row(upright, x1+x2 <=1);
deba@459
   356
  e = lp.row(upright);
deba@459
   357
  check(e[x1] == 1, "The first coefficient should 1.");
deba@459
   358
  check(e[x2] == 1, "The second coefficient should 1.");
deba@459
   359
deba@459
   360
  LpSolver::DualExpr de = lp.col(x1);
deba@458
   361
  check(  de[upright] == 1, "The first coefficient should 1.");
deba@458
   362
deba@459
   363
  LpSolver* clp = lp.cloneSolver();
deba@458
   364
deba@458
   365
  //Testing the problem retrieving routines
deba@458
   366
  check(clp->objCoeff(x1)==1,"First term should be 1 in the obj function!");
deba@459
   367
  check(clp->sense() == clp->MAX,"This is a maximization!");
deba@458
   368
  check(clp->coeff(upright,x1)==1,"The coefficient in question is 1!");
deba@458
   369
  //  std::cout<<lp.colLowerBound(x1)<<std::endl;
deba@459
   370
  check(clp->colLowerBound(x1)==0,
deba@459
   371
        "The lower bound for variable x1 should be 0.");
deba@459
   372
  check(clp->colUpperBound(x1)==LpSolver::INF,
deba@459
   373
        "The upper bound for variable x1 should be infty.");
deba@458
   374
deba@459
   375
  check(lp.rowLowerBound(upright)==-LpSolver::INF,
deba@459
   376
        "The lower bound for the first row should be -infty.");
deba@459
   377
  check(lp.rowUpperBound(upright)==1,
deba@459
   378
        "The upper bound for the first row should be 1.");
deba@458
   379
  e = clp->row(upright);
deba@459
   380
  check(e[x1] == 1, "The first coefficient should 1.");
deba@459
   381
  check(e[x2] == 1, "The second coefficient should 1.");
deba@458
   382
deba@458
   383
  de = clp->col(x1);
deba@459
   384
  check(de[upright] == 1, "The first coefficient should 1.");
deba@458
   385
deba@458
   386
  delete clp;
deba@458
   387
deba@458
   388
  //Maximization of x1+x2
deba@458
   389
  //over the triangle with vertices (0,0) (0,1) (1,0)
deba@458
   390
  double expected_opt=1;
deba@459
   391
  solveAndCheck(lp, LpSolver::OPTIMAL, expected_opt);
deba@458
   392
deba@458
   393
  //Minimization
deba@459
   394
  lp.sense(lp.MIN);
deba@458
   395
  expected_opt=0;
deba@459
   396
  solveAndCheck(lp, LpSolver::OPTIMAL, expected_opt);
deba@458
   397
deba@458
   398
  //Vertex (-1,0) instead of (0,0)
deba@459
   399
  lp.colLowerBound(x1, -LpSolver::INF);
deba@458
   400
  expected_opt=-1;
deba@459
   401
  solveAndCheck(lp, LpSolver::OPTIMAL, expected_opt);
deba@458
   402
deba@458
   403
  //Erase one constraint and return to maximization
deba@459
   404
  lp.erase(upright);
deba@459
   405
  lp.sense(lp.MAX);
deba@459
   406
  expected_opt=LpSolver::INF;
deba@459
   407
  solveAndCheck(lp, LpSolver::UNBOUNDED, expected_opt);
deba@458
   408
deba@458
   409
  //Infeasibilty
deba@458
   410
  lp.addRow(x1+x2 <=-2);
deba@459
   411
  solveAndCheck(lp, LpSolver::INFEASIBLE, expected_opt);
deba@458
   412
deba@458
   413
}
deba@458
   414
alpar@540
   415
template<class LP>
alpar@540
   416
void cloneTest()
alpar@540
   417
{
alpar@540
   418
  //Test for clone/new
deba@551
   419
alpar@540
   420
  LP* lp = new LP();
alpar@540
   421
  LP* lpnew = lp->newSolver();
alpar@540
   422
  LP* lpclone = lp->cloneSolver();
alpar@540
   423
  delete lp;
alpar@540
   424
  delete lpnew;
alpar@540
   425
  delete lpclone;
alpar@540
   426
}
alpar@540
   427
alpar@1205
   428
template<class LP>
alpar@1205
   429
void rangeConstraintTest()
alpar@1205
   430
{
alpar@1205
   431
  LP lp;
alpar@1205
   432
  // Add two columns (variables) to the problem
alpar@1205
   433
  typename LP::Col x1 = lp.addCol();
alpar@1205
   434
  typename LP::Col x2 = lp.addCol();
alpar@1205
   435
  // Add rows (constraints) to the problem
alpar@1205
   436
  lp.addRow(x1 - 5 <= x2);
alpar@1205
   437
    lp.addRow(0 <= 2 * x1 + x2 <= 25);
alpar@1205
   438
  
alpar@1205
   439
  // Set lower and upper bounds for the columns (variables)
alpar@1205
   440
  lp.colLowerBound(x1, 0);
alpar@1205
   441
  lp.colUpperBound(x2, 10);
alpar@1205
   442
  
alpar@1205
   443
  // Specify the objective function
alpar@1205
   444
  lp.max();
alpar@1205
   445
  lp.obj(5 * x1 + 3 * x2);
alpar@1205
   446
  
alpar@1205
   447
  // Solve the problem using the underlying LP solver
alpar@1205
   448
  lp.solve();
alpar@1205
   449
  // Print the results
alpar@1205
   450
  check(lp.primalType() == LP::OPTIMAL, "Optimal solution is not found");
alpar@1205
   451
  check(lp.primal() <= 67.501 && lp.primal() >= 67.499, "Wrong objective value");
alpar@1205
   452
  check(lp.primal(x1) <= 7.501 && lp.primal(x1) >= 7.499, "Wrong value for x1");
alpar@1205
   453
  check(lp.primal(x2) <= 10.001 && lp.primal(x2) >= 9.999, "Wrong value for x2");
alpar@1205
   454
}
alpar@1205
   455
deba@458
   456
int main()
deba@458
   457
{
deba@458
   458
  LpSkeleton lp_skel;
deba@458
   459
  lpTest(lp_skel);
deba@458
   460
alpar@1105
   461
#ifdef LEMON_HAVE_LP
alpar@1105
   462
  {
alpar@1105
   463
    Lp lp,lp2;
alpar@1105
   464
    lpTest(lp);
alpar@1105
   465
    aTest(lp2);
alpar@1105
   466
    cloneTest<Lp>();
alpar@1105
   467
  }
alpar@1105
   468
#endif
alpar@1105
   469
ladanyi@627
   470
#ifdef LEMON_HAVE_GLPK
deba@459
   471
  {
alpar@462
   472
    GlpkLp lp_glpk1,lp_glpk2;
deba@459
   473
    lpTest(lp_glpk1);
deba@459
   474
    aTest(lp_glpk2);
alpar@540
   475
    cloneTest<GlpkLp>();
alpar@1205
   476
    rangeConstraintTest<GlpkLp>();
deba@459
   477
  }
deba@458
   478
#endif
deba@458
   479
ladanyi@627
   480
#ifdef LEMON_HAVE_CPLEX
deba@459
   481
  try {
alpar@462
   482
    CplexLp lp_cplex1,lp_cplex2;
deba@459
   483
    lpTest(lp_cplex1);
deba@459
   484
    aTest(lp_cplex2);
deba@551
   485
    cloneTest<CplexLp>();
alpar@1205
   486
    rangeConstraintTest<CplexLp>();
deba@459
   487
  } catch (CplexEnv::LicenseError& error) {
deba@459
   488
    check(false, error.what());
deba@459
   489
  }
deba@458
   490
#endif
deba@458
   491
ladanyi@627
   492
#ifdef LEMON_HAVE_SOPLEX
deba@459
   493
  {
alpar@462
   494
    SoplexLp lp_soplex1,lp_soplex2;
deba@459
   495
    lpTest(lp_soplex1);
deba@459
   496
    aTest(lp_soplex2);
alpar@540
   497
    cloneTest<SoplexLp>();
alpar@1205
   498
    rangeConstraintTest<Soplex>();
deba@459
   499
  }
deba@459
   500
#endif
deba@459
   501
ladanyi@627
   502
#ifdef LEMON_HAVE_CLP
deba@459
   503
  {
alpar@462
   504
    ClpLp lp_clp1,lp_clp2;
deba@459
   505
    lpTest(lp_clp1);
deba@459
   506
    aTest(lp_clp2);
alpar@540
   507
    cloneTest<ClpLp>();
alpar@1205
   508
    rangeConstraintTest<ClpLp>();
deba@459
   509
  }
deba@458
   510
#endif
deba@458
   511
deba@458
   512
  return 0;
deba@458
   513
}