test/mip_test.cc
changeset 553 e7eb04ece02c
parent 542 fc6c7aab4b8d
child 567 3314f58e7b25
equal deleted inserted replaced
7:1352c34c3fa9 8:b82ac25d67cd
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2009
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
   107 }
   107 }
   108 
   108 
   109 template<class MIP>
   109 template<class MIP>
   110 void cloneTest()
   110 void cloneTest()
   111 {
   111 {
   112   
   112 
   113   MIP* mip = new MIP();
   113   MIP* mip = new MIP();
   114   MIP* mipnew = mip->newSolver();
   114   MIP* mipnew = mip->newSolver();
   115   MIP* mipclone = mip->cloneSolver();
   115   MIP* mipclone = mip->cloneSolver();
   116   delete mip;
   116   delete mip;
   117   delete mipnew;
   117   delete mipnew;
   131 
   131 
   132 #ifdef HAVE_CPLEX
   132 #ifdef HAVE_CPLEX
   133   try {
   133   try {
   134     CplexMip mip2;
   134     CplexMip mip2;
   135     aTest(mip2);
   135     aTest(mip2);
       
   136     cloneTest<CplexMip>();
   136   } catch (CplexEnv::LicenseError& error) {
   137   } catch (CplexEnv::LicenseError& error) {
   137 #ifdef LEMON_FORCE_CPLEX_CHECK
   138 #ifdef LEMON_FORCE_CPLEX_CHECK
   138     check(false, error.what());
   139     check(false, error.what());
   139 #else
   140 #else
   140     std::cerr << error.what() << std::endl;
   141     std::cerr << error.what() << std::endl;
   141     std::cerr << "Cplex license check failed, lp check skipped" << std::endl;
   142     std::cerr << "Cplex license check failed, lp check skipped" << std::endl;
   142 #endif
   143 #endif
   143   }
   144   }
   144   cloneTest<CplexMip>();
       
   145 #endif
   145 #endif
   146 
   146 
   147   return 0;
   147   return 0;
   148 
   148 
   149 }
   149 }