test/CMakeLists.txt
author Peter Kovacs <kpeter@inf.elte.hu>
Wed, 29 Apr 2009 03:15:24 +0200
changeset 640 6c408d864fa1
parent 620 c3ce597c11ae
child 627 20dac2104519
permissions -rw-r--r--
Support negative costs and bounds in NetworkSimplex (#270)

* The interface is reworked to support negative costs and bounds.
- ProblemType and problemType() are renamed to
SupplyType and supplyType(), see also #234.
- ProblemType type is introduced similarly to the LP interface.
- 'bool run()' is replaced by 'ProblemType run()' to handle
unbounded problem instances, as well.
- Add INF public member constant similarly to the LP interface.
* Remove capacityMap() and boundMaps(), see also #266.
* Update the problem definition in the MCF module.
* Remove the usage of Circulation (and adaptors) for checking feasibility.
Check feasibility by examining the artifical arcs instead (after solving
the problem).
* Additional check for unbounded negative cycles found during the
algorithm (it is possible now, since negative costs are allowed).
* Fix in the constructor (the value types needn't be integer any more),
see also #254.
* Improve and extend the doc.
* Rework the test file and add test cases for negative costs and bounds.
ladanyi@473
     1
INCLUDE_DIRECTORIES(
ladanyi@549
     2
  ${PROJECT_SOURCE_DIR}
ladanyi@549
     3
  ${PROJECT_BINARY_DIR}
ladanyi@473
     4
)
deba@410
     5
ladanyi@549
     6
LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/lemon)
ladanyi@141
     7
alpar@225
     8
SET(TESTS
deba@488
     9
  adaptors_test
ladanyi@141
    10
  bfs_test
alpar@424
    11
  circulation_test
ladanyi@141
    12
  counter_test
ladanyi@141
    13
  dfs_test
ladanyi@141
    14
  digraph_test
kpeter@170
    15
  dijkstra_test
ladanyi@141
    16
  dim_test
deba@488
    17
  edge_set_test
ladanyi@141
    18
  error_test
ladanyi@522
    19
  euler_test
tapolcai@543
    20
  gomory_hu_test
deba@200
    21
  graph_copy_test
ladanyi@141
    22
  graph_test
kpeter@171
    23
  graph_utils_test
deba@410
    24
  hao_orlin_test
deba@203
    25
  heap_test
ladanyi@141
    26
  kruskal_test
ladanyi@141
    27
  maps_test
kpeter@594
    28
  matching_test
deba@501
    29
  min_cost_arborescence_test
kpeter@601
    30
  min_cost_flow_test
alpar@424
    31
  path_test
alpar@424
    32
  preflow_test
ladanyi@473
    33
  radix_sort_test
alpar@225
    34
  random_test
alpar@424
    35
  suurballe_test
ladanyi@141
    36
  time_measure_test
ladanyi@141
    37
  unionfind_test)
ladanyi@141
    38
ladanyi@473
    39
IF(HAVE_LP)
ladanyi@473
    40
  ADD_EXECUTABLE(lp_test lp_test.cc)
ladanyi@620
    41
  SET(LP_TEST_LIBS lemon)
ladanyi@474
    42
  IF(HAVE_GLPK)
ladanyi@620
    43
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@474
    44
  ENDIF(HAVE_GLPK)
ladanyi@620
    45
  IF(HAVE_CPLEX)
ladanyi@620
    46
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@620
    47
  ENDIF(HAVE_CPLEX)
ladanyi@621
    48
  IF(HAVE_CLP)
ladanyi@621
    49
    SET(LP_TEST_LIBS ${LP_TEST_LIBS} ${COIN_CLP_LIBRARIES})
ladanyi@621
    50
  ENDIF(HAVE_CLP)
ladanyi@620
    51
  TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
ladanyi@473
    52
  ADD_TEST(lp_test lp_test)
ladanyi@473
    53
ladanyi@474
    54
  IF(WIN32 AND HAVE_GLPK)
ladanyi@473
    55
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@473
    56
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    57
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@473
    58
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@473
    59
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@473
    60
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    61
    )
ladanyi@474
    62
  ENDIF(WIN32 AND HAVE_GLPK)
ladanyi@620
    63
  IF(WIN32 AND HAVE_CPLEX)
ladanyi@620
    64
    GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
ladanyi@620
    65
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    66
    ADD_CUSTOM_COMMAND(TARGET lp_test POST_BUILD
ladanyi@620
    67
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
    68
    )
ladanyi@620
    69
  ENDIF(WIN32 AND HAVE_CPLEX)
ladanyi@473
    70
ENDIF(HAVE_LP)
ladanyi@473
    71
ladanyi@473
    72
IF(HAVE_MIP)
ladanyi@473
    73
  ADD_EXECUTABLE(mip_test mip_test.cc)
ladanyi@620
    74
  SET(MIP_TEST_LIBS lemon)
ladanyi@474
    75
  IF(HAVE_GLPK)
ladanyi@620
    76
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${GLPK_LIBRARIES})
ladanyi@474
    77
  ENDIF(HAVE_GLPK)
ladanyi@620
    78
  IF(HAVE_CPLEX)
ladanyi@620
    79
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${CPLEX_LIBRARIES})
ladanyi@620
    80
  ENDIF(HAVE_CPLEX)
ladanyi@621
    81
  IF(HAVE_CBC)
ladanyi@621
    82
    SET(MIP_TEST_LIBS ${MIP_TEST_LIBS} ${COIN_CBC_LIBRARIES})
ladanyi@621
    83
  ENDIF(HAVE_CBC)
ladanyi@620
    84
  TARGET_LINK_LIBRARIES(mip_test ${MIP_TEST_LIBS})
ladanyi@473
    85
  ADD_TEST(mip_test mip_test)
ladanyi@473
    86
ladanyi@474
    87
  IF(WIN32 AND HAVE_GLPK)
ladanyi@473
    88
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@473
    89
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@473
    90
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@473
    91
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/glpk.dll ${TARGET_PATH}
ladanyi@473
    92
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/libltdl3.dll ${TARGET_PATH}
ladanyi@473
    93
      COMMAND cmake -E copy ${GLPK_BIN_DIR}/zlib1.dll ${TARGET_PATH}
ladanyi@473
    94
    )
ladanyi@474
    95
  ENDIF(WIN32 AND HAVE_GLPK)
ladanyi@620
    96
  IF(WIN32 AND HAVE_CPLEX)
ladanyi@620
    97
    GET_TARGET_PROPERTY(TARGET_LOC mip_test LOCATION)
ladanyi@620
    98
    GET_FILENAME_COMPONENT(TARGET_PATH ${TARGET_LOC} PATH)
ladanyi@620
    99
    ADD_CUSTOM_COMMAND(TARGET mip_test POST_BUILD
ladanyi@620
   100
      COMMAND cmake -E copy ${CPLEX_BIN_DIR}/cplex91.dll ${TARGET_PATH}
ladanyi@620
   101
    )
ladanyi@620
   102
  ENDIF(WIN32 AND HAVE_CPLEX)
ladanyi@473
   103
ENDIF(HAVE_MIP)
ladanyi@473
   104
alpar@225
   105
FOREACH(TEST_NAME ${TESTS})
alpar@225
   106
  ADD_EXECUTABLE(${TEST_NAME} ${TEST_NAME}.cc)
alpar@225
   107
  TARGET_LINK_LIBRARIES(${TEST_NAME} lemon)
alpar@225
   108
  ADD_TEST(${TEST_NAME} ${TEST_NAME})
alpar@225
   109
ENDFOREACH(TEST_NAME)