COIN-OR::LEMON - Graph Library

Changes in / [1209:4a170261cc54:1208:c6aa2cc1af04] in lemon-main


Ignore:
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r1204 r1198  
    66
    77IF(POLICY CMP0043)
    8   CMAKE_POLICY(SET CMP0043 NEW)
     8  CMAKE_POLICY(SET CMP0043 OLD)
    99ENDIF(POLICY CMP0043)
    1010
    1111IF(POLICY CMP0026)
    1212  #This is for copying the dll's needed by glpk (in lp_test and mip_test)
    13   CMAKE_POLICY(SET CMP0026 NEW)
     13  CMAKE_POLICY(SET CMP0026 OLD)
    1414ENDIF(POLICY CMP0026)
    1515
     
    197197
    198198IF(MSVC)
    199   SET( CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
     199  SET(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}")
    200200  SET( CMAKE_CXX_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    201     "Flags used by the C++ compiler during maintainer builds." FORCE
     201    "Flags used by the C++ compiler during maintainer builds."
    202202    )
    203203  SET( CMAKE_C_FLAGS_MAINTAINER "/WX ${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING
    204     "Flags used by the C compiler during maintainer builds." FORCE
     204    "Flags used by the C compiler during maintainer builds."
    205205    )
    206206  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    207207    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    208     "Flags used for linking binaries during maintainer builds." FORCE
     208    "Flags used for linking binaries during maintainer builds."
    209209    )
    210210  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    211211    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    212212    "Flags used by the shared libraries linker during maintainer builds."
    213      FORCE
    214213    )
    215214ELSE()
    216215  SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb -O0" CACHE STRING
    217     "Flags used by the C++ compiler during maintainer builds." FORCE
     216    "Flags used by the C++ compiler during maintainer builds."
    218217    )
    219218  SET( CMAKE_C_FLAGS_MAINTAINER "-Werror -O0" CACHE STRING
    220     "Flags used by the C compiler during maintainer builds." FORCE
     219    "Flags used by the C compiler during maintainer builds."
    221220    )
    222221  SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER
    223222    "${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
    224     "Flags used for linking binaries during maintainer builds." FORCE
     223    "Flags used for linking binaries during maintainer builds."
    225224    )
    226225  SET( CMAKE_SHARED_LINKER_FLAGS_MAINTAINER
    227226    "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
    228     "Flags used by the shared libraries linker during maintainer builds." FORCE)
     227    "Flags used by the shared libraries linker during maintainer builds."
     228    )
    229229ENDIF()
    230230
     
    252252
    253253SET_DIRECTORY_PROPERTIES(PROPERTIES
    254   COMPILE_DEFINITIONS
    255   $<$<OR:$<CONFIG:Debug>,$<CONFIG:Maintainer>>:LEMON_ENABLE_DEBUG>
     254  COMPILE_DEFINITIONS_DEBUG "LEMON_ENABLE_DEBUG"
     255  COMPILE_DEFINITIONS_MAINTAINER "LEMON_ENABLE_DEBUG"
    256256)
    257257
  • cmake/FindILOG.cmake

    r1205 r1126  
    9797  IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    9898    # SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
    99     SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread" "dl")
     99    SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread")
    100100  ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    101101ENDIF(ILOG_FOUND)
  • lemon/clp.cc

    r1206 r1130  
    228228
    229229  ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const {
    230     CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[jx];
    231     CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[jx];
     230    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix];
     231    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix];
    232232
    233233    const int* indices = _prob->clpMatrix()->getIndices();
    234234    const double* elements = _prob->clpMatrix()->getElements();
    235235
    236     const int* it = std::lower_bound(indices + begin, indices + end, ix);
    237     if (it != indices + end && *it == ix) {
     236    const int* it = std::lower_bound(indices + begin, indices + end, jx);
     237    if (it != indices + end && *it == jx) {
    238238      return elements[it - indices];
    239239    } else {
     
    462462  }
    463463
    464    void ClpLp::_write(std::string file, std::string format) const
    465   {
    466     if(format == "LP")
    467       _prob->writeLp(file.c_str(), "", 1e-5, 10, 5,
    468                      sense()==ClpLp::MIN?1:-1,
    469                      true
    470                      );
    471     else throw UnsupportedFormatError(format);
    472   }
    473  
    474464} //END OF NAMESPACE LEMON
  • lemon/clp.h

    r1206 r1130  
    140140    virtual void _messageLevel(MessageLevel);
    141141
    142     void _write(std::string file, std::string format) const;
    143 
    144142  public:
    145143
  • lemon/cplex.cc

    r1205 r1140  
    159159      const char s = 'R';
    160160      double len = ub - lb;
    161       CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s,
     161      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s,
    162162                 &rmatbeg, &indices.front(), &values.front(), 0, 0);
    163163      CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
  • test/CMakeLists.txt

    r1204 r1187  
    8585
    8686  IF(WIN32 AND LEMON_HAVE_GLPK)
     87    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
     88    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
    8789    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
    88       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll $<TARGET_FILE_DIR:lp_test>
    89       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll $<TARGET_FILE_DIR:lp_test>
    90       COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll $<TARGET_FILE_DIR:lp_test>
     90      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
     91      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
     92      COMMAND ${CMAKE_COMMAND} -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
    9193    )
    9294  ENDIF()
  • test/lp_test.cc

    r1205 r1131  
    340340  check(lp.sense() == lp.MAX,"This is a maximization!");
    341341  check(lp.coeff(upright,x1)==1,"The coefficient in question is 1!");
    342   check(lp.coeff(upright,x2)==2,"The coefficient in question is 1!");
    343342  check(lp.colLowerBound(x1)==0,
    344343        "The lower bound for variable x1 should be 0.");
     
    426425}
    427426
    428 template<class LP>
    429 void rangeConstraintTest()
    430 {
    431   LP lp;
    432   // Add two columns (variables) to the problem
    433   typename LP::Col x1 = lp.addCol();
    434   typename LP::Col x2 = lp.addCol();
    435   // Add rows (constraints) to the problem
    436   lp.addRow(x1 - 5 <= x2);
    437     lp.addRow(0 <= 2 * x1 + x2 <= 25);
    438  
    439   // Set lower and upper bounds for the columns (variables)
    440   lp.colLowerBound(x1, 0);
    441   lp.colUpperBound(x2, 10);
    442  
    443   // Specify the objective function
    444   lp.max();
    445   lp.obj(5 * x1 + 3 * x2);
    446  
    447   // Solve the problem using the underlying LP solver
    448   lp.solve();
    449   // Print the results
    450   check(lp.primalType() == LP::OPTIMAL, "Optimal solution is not found");
    451   check(lp.primal() <= 67.501 && lp.primal() >= 67.499, "Wrong objective value");
    452   check(lp.primal(x1) <= 7.501 && lp.primal(x1) >= 7.499, "Wrong value for x1");
    453   check(lp.primal(x2) <= 10.001 && lp.primal(x2) >= 9.999, "Wrong value for x2");
    454 }
    455 
    456427int main()
    457428{
     
    474445    aTest(lp_glpk2);
    475446    cloneTest<GlpkLp>();
    476     rangeConstraintTest<GlpkLp>();
    477447  }
    478448#endif
     
    484454    aTest(lp_cplex2);
    485455    cloneTest<CplexLp>();
    486     rangeConstraintTest<CplexLp>();
    487456  } catch (CplexEnv::LicenseError& error) {
    488457    check(false, error.what());
     
    496465    aTest(lp_soplex2);
    497466    cloneTest<SoplexLp>();
    498     rangeConstraintTest<Soplex>();
    499467  }
    500468#endif
     
    506474    aTest(lp_clp2);
    507475    cloneTest<ClpLp>();
    508     rangeConstraintTest<ClpLp>();
    509476  }
    510477#endif
  • test/mip_test.cc

    r1205 r1105  
    6262}
    6363
    64 void aTest(MipSolver& mip, bool solve_empty=true)
     64void aTest(MipSolver& mip)
    6565{
    6666  //The following example is very simple
     
    8181
    8282  //Unconstrained optimization
    83   if(solve_empty)
    84     mip.solve();
     83  mip.solve();
    8584  //Check it out!
    8685
     
    137136  {
    138137    Mip mip1;
    139 #if LEMON_DEFAULT_MIP==LEMON_CBC_
    140     aTest(mip1, false);
    141 #else
    142138    aTest(mip1);
    143 #endif
    144139    cloneTest<Mip>();
    145140  }
     
    167162  {
    168163    CbcMip mip1;
    169     aTest(mip1, false);
     164    aTest(mip1);
    170165    cloneTest<CbcMip>();
    171166  }
Note: See TracChangeset for help on using the changeset viewer.