COIN-OR::LEMON - Graph Library

Changeset 614:3314f58e7b25 in lemon


Ignore:
Timestamp:
04/01/09 22:58:58 (11 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

Add CBC support (#204)

Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r611 r614  
    1212        m4/lx_check_glpk.m4 \
    1313        m4/lx_check_soplex.m4 \
     14        m4/lx_check_clp.m4 \
     15        m4/lx_check_cbc.m4 \
    1416        CMakeLists.txt \
    1517        cmake/FindGhostscript.cmake \
  • configure.ac

    r611 r614  
    6161LX_CHECK_SOPLEX
    6262LX_CHECK_CLP
     63LX_CHECK_CBC
    6364
    6465AM_CONDITIONAL([HAVE_LP], [test x"$lx_lp_found" = x"yes"])
     
    120121echo SOPLEX support................ : $lx_soplex_found
    121122echo CLP support................... : $lx_clp_found
     123echo CBC support................... : $lx_cbc_found
    122124echo
    123125echo Build additional tools........ : $enable_tools
  • lemon/Makefile.am

    r597 r614  
    1313        lemon/lp_base.cc \
    1414        lemon/lp_skeleton.cc \
    15         lemon/random.cc \
     15        lemon/random.cc \
    1616        lemon/bits/windows.cc
    1717
     
    2222        $(CPLEX_CFLAGS) \
    2323        $(SOPLEX_CXXFLAGS) \
    24         $(CLP_CXXFLAGS)
     24        $(CLP_CXXFLAGS) \
     25        $(CBC_CXXFLAGS)
    2526
    2627lemon_libemon_la_LDFLAGS = \
     
    2829        $(CPLEX_LIBS) \
    2930        $(SOPLEX_LIBS) \
    30         $(CLP_LIBS)
     31        $(CLP_LIBS) \
     32        $(CBC_LIBS)
    3133
    3234if HAVE_GLPK
     
    4446if HAVE_CLP
    4547lemon_libemon_la_SOURCES += lemon/clp.cc
     48endif
     49
     50if HAVE_CBC
     51lemon_libemon_la_SOURCES += lemon/cbc.cc
    4652endif
    4753
  • lemon/config.h.in

    r564 r614  
    1919/* Define to 1 if you have CLP */
    2020#undef HAVE_CLP
     21
     22/* Define to 1 if you have CBC */
     23#undef HAVE_CBC
  • test/mip_test.cc

    r598 r614  
    1919#include "test_tools.h"
    2020
    21 
    2221#ifdef HAVE_CONFIG_H
    2322#include <lemon/config.h>
     
    3029#ifdef HAVE_GLPK
    3130#include <lemon/glpk.h>
     31#endif
     32
     33#ifdef HAVE_CBC
     34#include <lemon/cbc.h>
    3235#endif
    3336
     
    5861void aTest(MipSolver& mip)
    5962{
    60  //The following example is very simple
     63  //The following example is very simple
    6164
    6265
    6366  typedef MipSolver::Row Row;
    6467  typedef MipSolver::Col Col;
    65 
    6668
    6769
     
    7577  mip.max();
    7678
    77 
    7879  //Unconstrained optimization
    7980  mip.solve();
     
    8182
    8283  //Constraints
    83   mip.addRow(2*x1+x2 <=2);
    84   mip.addRow(x1-2*x2 <=0);
     84  mip.addRow(2 * x1 + x2 <= 2);
     85  Row y2 = mip.addRow(x1 - 2 * x2 <= 0);
    8586
    8687  //Nonnegativity of the variable x1
    8788  mip.colLowerBound(x1, 0);
     89
    8890
    8991  //Maximization of x1
     
    9193  double expected_opt=4.0/5.0;
    9294  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
     95
    9396
    9497  //Restrict x2 to integer
     
    103106  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
    104107
    105 
     108  //Erase a variable
     109  mip.erase(x2);
     110  mip.rowUpperBound(y2, 8);
     111  expected_opt=1;
     112  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
    106113
    107114}
     115
    108116
    109117template<class MIP>
     
    145153#endif
    146154
     155#ifdef HAVE_CBC
     156  {
     157    CbcMip mip1;
     158    aTest(mip1);
     159    cloneTest<CbcMip>();
     160  }
     161#endif
     162
    147163  return 0;
    148164
Note: See TracChangeset for help on using the changeset viewer.