deba@458: /* -*- mode: C++; indent-tabs-mode: nil; -*- deba@458: * deba@458: * This file is a part of LEMON, a generic C++ optimization library. deba@458: * deba@551: * Copyright (C) 2003-2009 deba@458: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport deba@458: * (Egervary Research Group on Combinatorial Optimization, EGRES). deba@458: * deba@458: * Permission to use, modify and distribute this software is granted deba@458: * provided that this copyright notice appears in all copies. For deba@458: * precise terms see the accompanying LICENSE file. deba@458: * deba@458: * This software is provided "AS IS" with no warranty of any kind, deba@458: * express or implied, and with no claim as to its suitability for any deba@458: * purpose. deba@458: * deba@458: */ deba@458: deba@458: #include "test_tools.h" deba@458: deba@458: #include deba@458: ladanyi@627: #ifdef LEMON_HAVE_CPLEX alpar@461: #include deba@458: #endif deba@458: ladanyi@627: #ifdef LEMON_HAVE_GLPK alpar@461: #include deba@458: #endif deba@458: ladanyi@627: #ifdef LEMON_HAVE_CBC deba@567: #include deba@567: #endif deba@567: deba@458: deba@458: using namespace lemon; deba@458: deba@459: void solveAndCheck(MipSolver& mip, MipSolver::ProblemType stat, deba@458: double exp_opt) { deba@458: using std::string; deba@458: deba@459: mip.solve(); deba@458: //int decimal,sign; deba@458: std::ostringstream buf; deba@459: buf << "Type should be: " << int(stat)<<" and it is "< alpar@540: void cloneTest() alpar@540: { deba@551: alpar@540: MIP* mip = new MIP(); alpar@540: MIP* mipnew = mip->newSolver(); alpar@540: MIP* mipclone = mip->cloneSolver(); alpar@540: delete mip; alpar@540: delete mipnew; alpar@540: delete mipclone; alpar@540: } deba@458: deba@458: int main() deba@458: { deba@458: ladanyi@627: #ifdef LEMON_HAVE_GLPK deba@459: { alpar@462: GlpkMip mip1; deba@459: aTest(mip1); alpar@540: cloneTest(); deba@459: } deba@458: #endif deba@458: ladanyi@627: #ifdef LEMON_HAVE_CPLEX deba@459: try { alpar@462: CplexMip mip2; deba@459: aTest(mip2); deba@551: cloneTest(); deba@459: } catch (CplexEnv::LicenseError& error) { deba@459: check(false, error.what()); deba@459: } deba@458: #endif deba@458: ladanyi@627: #ifdef LEMON_HAVE_CBC deba@567: { deba@567: CbcMip mip1; deba@567: aTest(mip1); deba@567: cloneTest(); deba@567: } deba@567: #endif deba@567: deba@458: return 0; deba@458: deba@458: }