475 changed files with 17943 additions and 9897 deletions
-
8CMakeLists.txt
-
13resources/3rdparty/CMakeLists.txt
-
281resources/3rdparty/glpk-4.53/CMakeLists.txt
-
27resources/3rdparty/glpk-4.53/config.h.cmake.in
-
BINresources/3rdparty/glpk-4.53/doc/notes/scaling.pdf
-
BINresources/3rdparty/glpk-4.53/doc/notes/updating.pdf
-
47resources/3rdparty/glpk-4.53/resources/FindMySQL.cmake
-
60resources/3rdparty/glpk-4.53/resources/FindODBC.cmake
-
576resources/3rdparty/glpk-4.53/src/bfd.c
-
1097resources/3rdparty/glpk-4.53/src/glplpf.c
-
216resources/3rdparty/glpk-4.53/src/glplpf.h
-
2971resources/3rdparty/glpk-4.53/src/glpspx01.c
-
3118resources/3rdparty/glpk-4.53/src/glpspx02.c
-
667resources/3rdparty/glpk-4.53/src/glptsp.c
-
0resources/3rdparty/glpk-4.57/AUTHORS
-
0resources/3rdparty/glpk-4.57/COPYING
-
185resources/3rdparty/glpk-4.57/ChangeLog
-
0resources/3rdparty/glpk-4.57/INSTALL
-
0resources/3rdparty/glpk-4.57/Makefile.am
-
0resources/3rdparty/glpk-4.57/Makefile.in
-
100resources/3rdparty/glpk-4.57/NEWS
-
8resources/3rdparty/glpk-4.57/README
-
19resources/3rdparty/glpk-4.57/THANKS
-
0resources/3rdparty/glpk-4.57/aclocal.m4
-
0resources/3rdparty/glpk-4.57/config.guess
-
0resources/3rdparty/glpk-4.57/config.h.in
-
0resources/3rdparty/glpk-4.57/config.sub
-
21resources/3rdparty/glpk-4.57/configure
-
3resources/3rdparty/glpk-4.57/configure.ac
-
0resources/3rdparty/glpk-4.57/depcomp
-
0resources/3rdparty/glpk-4.57/doc/cnfsat.pdf
-
0resources/3rdparty/glpk-4.57/doc/cnfsat.tex
-
BINresources/3rdparty/glpk-4.57/doc/glpk.pdf
-
17resources/3rdparty/glpk-4.57/doc/glpk.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk01.tex
-
66resources/3rdparty/glpk-4.57/doc/glpk02.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk03.tex
-
78resources/3rdparty/glpk-4.57/doc/glpk04.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk05.tex
-
83resources/3rdparty/glpk-4.57/doc/glpk06.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk07.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk08.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk09.tex
-
11resources/3rdparty/glpk-4.57/doc/glpk10.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk11.tex
-
0resources/3rdparty/glpk-4.57/doc/glpk12.tex
-
BINresources/3rdparty/glpk-4.57/doc/gmpl.pdf
-
28resources/3rdparty/glpk-4.57/doc/gmpl.tex
-
BINresources/3rdparty/glpk-4.57/doc/gmpl_es.pdf
-
3233resources/3rdparty/glpk-4.57/doc/gmpl_es.tex
-
0resources/3rdparty/glpk-4.57/doc/graphs.pdf
-
0resources/3rdparty/glpk-4.57/doc/graphs.tex
-
0resources/3rdparty/glpk-4.57/doc/miplib2.txt
-
0resources/3rdparty/glpk-4.57/doc/miplib3.txt
-
0resources/3rdparty/glpk-4.57/doc/netlib.txt
-
0resources/3rdparty/glpk-4.57/doc/notes/dfeas.pdf
-
0resources/3rdparty/glpk-4.57/doc/notes/gomory.pdf
-
0resources/3rdparty/glpk-4.57/doc/notes/keller.pdf
-
BINresources/3rdparty/glpk-4.57/doc/notes/scf.pdf
-
BINresources/3rdparty/glpk-4.57/doc/notes/simplex1.pdf
-
BINresources/3rdparty/glpk-4.57/doc/notes/simplex2.pdf
-
10resources/3rdparty/glpk-4.57/examples/INDEX
-
0resources/3rdparty/glpk-4.57/examples/Makefile.am
-
0resources/3rdparty/glpk-4.57/examples/Makefile.in
-
282resources/3rdparty/glpk-4.57/examples/alloy.mps
-
0resources/3rdparty/glpk-4.57/examples/assign.mod
-
0resources/3rdparty/glpk-4.57/examples/bpp.mod
-
0resources/3rdparty/glpk-4.57/examples/cal.mod
-
0resources/3rdparty/glpk-4.57/examples/cf12a.mod
-
0resources/3rdparty/glpk-4.57/examples/cf12b.mod
-
0resources/3rdparty/glpk-4.57/examples/cflsq.mod
-
0resources/3rdparty/glpk-4.57/examples/color.mod
-
0resources/3rdparty/glpk-4.57/examples/cplex/README
-
0resources/3rdparty/glpk-4.57/examples/cplex/concorde.txt
-
0resources/3rdparty/glpk-4.57/examples/cplex/cplex.c
-
0resources/3rdparty/glpk-4.57/examples/cplex/cplex.h
-
0resources/3rdparty/glpk-4.57/examples/cpp.mod
-
0resources/3rdparty/glpk-4.57/examples/crypto.mod
-
0resources/3rdparty/glpk-4.57/examples/csv/distances.csv
-
0resources/3rdparty/glpk-4.57/examples/csv/markets.csv
-
0resources/3rdparty/glpk-4.57/examples/csv/parameters.csv
-
0resources/3rdparty/glpk-4.57/examples/csv/plants.csv
-
0resources/3rdparty/glpk-4.57/examples/csv/transp_csv.mod
-
0resources/3rdparty/glpk-4.57/examples/dbf/ForestMgt_Model_I_GIS_dbf.mod
-
0resources/3rdparty/glpk-4.57/examples/dbf/Forest_Cost.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/NetRev_Table.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/README
-
0resources/3rdparty/glpk-4.57/examples/dbf/TCost_Table.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/Yield_Table_Vol.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/cultural_pres.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/mgt_year.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/stands.dbf
-
0resources/3rdparty/glpk-4.57/examples/dbf/standtype.dbf
-
0resources/3rdparty/glpk-4.57/examples/dea.mod
-
0resources/3rdparty/glpk-4.57/examples/diet.mod
-
0resources/3rdparty/glpk-4.57/examples/dist.mod
-
0resources/3rdparty/glpk-4.57/examples/egypt.mod
-
0resources/3rdparty/glpk-4.57/examples/fctp.mod
-
0resources/3rdparty/glpk-4.57/examples/food.mod
-
0resources/3rdparty/glpk-4.57/examples/food2.mod
@ -1,281 +0,0 @@ |
|||
cmake_minimum_required (VERSION 2.8.6) |
|||
|
|||
# Set project name |
|||
project (glpk CXX C) |
|||
|
|||
# Add the resources/cmake folder to Module Search Path for FindMySQL.cmake |
|||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/resources/") |
|||
|
|||
# Add base folder for better inclusion paths |
|||
include_directories("${PROJECT_SOURCE_DIR}") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/amd") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/bflib") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/cglib") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/colamd") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/env") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/minisat") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/misc") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/proxy") |
|||
include_directories("${PROJECT_SOURCE_DIR}/src/zlib") |
|||
|
|||
############################################################# |
|||
## |
|||
## CMake options of GLPK |
|||
## |
|||
############################################################# |
|||
option(WITH_GLPK_EXAMPLES "Also build examples and standalone executables" OFF) |
|||
option(WITH_GMP "Use GNU MO bignum library" OFF) |
|||
option(ENABLE_DL "Enable shared library support" OFF) |
|||
option(ENABLE_ODBC "Enable MathProg ODBC support" OFF) |
|||
option(ENABLE_MYSQL "Enable MathProg MySQL support" OFF) |
|||
option(DEBUG "Sets whether the DEBUG mode is used" OFF) |
|||
set(ADDITIONAL_INCLUDE_DIRS "" CACHE STRING "Additional directories added to the include directories.") |
|||
set(ADDITIONAL_LINK_DIRS "" CACHE STRING "Additional directories added to the link directories.") |
|||
|
|||
MARK_AS_ADVANCED(WITH_GLPK_EXAMPLES WITH_GMP ENABLE_DL ENABLE_ODBC ENABLE_MYSQL) |
|||
|
|||
# If the DEBUG option was turned on, we will target a debug version and a release version otherwise |
|||
if (DEBUG) |
|||
set (CMAKE_BUILD_TYPE "DEBUG") |
|||
else() |
|||
set (CMAKE_BUILD_TYPE "RELEASE") |
|||
endif() |
|||
message(STATUS "GLPK - Building ${CMAKE_BUILD_TYPE} version.") |
|||
message(STATUS "GLPK - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") |
|||
message(STATUS "GLPK - CMAKE_BUILD_TYPE (ENV): $ENV{CMAKE_BUILD_TYPE}") |
|||
|
|||
|
|||
############################################################# |
|||
## |
|||
## Compiler specific settings and definitions |
|||
## |
|||
############################################################# |
|||
|
|||
if(CMAKE_COMPILER_IS_GNUCC) |
|||
message(STATUS "GLPK - Using Compiler Configuration: GCC") |
|||
# Set standard flags for GCC |
|||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type -Wno-parentheses -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-function -Wno-address -Wno-unused-label") |
|||
add_definitions(-DHAVE_CONFIG_H=1) |
|||
elseif(MSVC) |
|||
message(STATUS "GLPK - Using Compiler Configuration: MSVC") |
|||
add_definitions(/D_SCL_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS) |
|||
add_definitions(/D_VARIADIC_MAX=10) |
|||
add_definitions(/DNOMINMAX) |
|||
add_definitions(/DHAVE_CONFIG_H=1) |
|||
else(CLANG) |
|||
message(STATUS "GLPK - Using Compiler Configuration: Clang (LLVM)") |
|||
# As CLANG is not set as a variable, we need to set it in case we have not matched another compiler. |
|||
set (CLANG ON) |
|||
# Set standard flags for clang |
|||
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -funroll-loops -O3") |
|||
|
|||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-return-type -Wno-return-type-c-linkage -Wno-unused-label -Wno-unused-value -Wno-unused-function -Wno-unused-variable -Wno-logical-op-parentheses -Wno-macro-redefined -Wno-uninitialized -Wno-sometimes-uninitialized -Wno-self-assign") |
|||
|
|||
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") |
|||
add_definitions(-DHAVE_CONFIG_H=1) |
|||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -version-info=37:0:1 -export-symbols-regex='^glp_*'") |
|||
endif() |
|||
|
|||
############################################################# |
|||
## |
|||
## CMake-generated Config File for GLPK |
|||
## |
|||
############################################################# |
|||
include(CheckIncludeFiles) |
|||
include(CheckFunctionExists) |
|||
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) |
|||
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) |
|||
CHECK_INCLUDE_FILES(ltdl.h HAVE_LTDL) |
|||
CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN) |
|||
if(WITH_GMP) |
|||
message(STATUS "GLPK - Building with GMP Support") |
|||
CHECK_INCLUDE_FILE(gmp.h HAVE_GMP_H) |
|||
if (NOT HAVE_GMP_H) |
|||
message(SEND_ERROR "Could not find gmp.h!") |
|||
endif() |
|||
set(GLPK_HAVE_GMP "define") |
|||
else() |
|||
set(GLPK_HAVE_GMP "undef") |
|||
endif() |
|||
|
|||
if (UNIX AND NOT APPLE) |
|||
set(LIBIODBC "libiodbc.so") |
|||
set(LIBODBC "libodbc.so") |
|||
set(LIBMYSQL "libmysqlclient.so") |
|||
elseif(UNIX AND APPLE) |
|||
set(LIBIODBC "libiodbc.dylib") |
|||
set(LIBODBC "libodbc.dylib") |
|||
set(LIBMYSQL "libmysqlclient.dylib") |
|||
elseif(MSVC) |
|||
set(LIBIODBC "odbc32.lib") |
|||
set(LIBODBC "odbc32.lib") |
|||
set(LIBMYSQL "mysqlclient.lib") |
|||
endif() |
|||
|
|||
if(ENABLE_ODBC) |
|||
message(STATUS "GLPK - Building with ODBC Support") |
|||
find_package(ODBC REQUIRED) |
|||
if (NOT ENABLE_DL) |
|||
message(SEND_ERROR "ENABLE_ODBC required ENABLE_DL") |
|||
endif() |
|||
include_directories(ODBC_INCLUDE_DIRECTORIES) |
|||
set(GLPK_HAVE_ODBC "define") |
|||
set(GLPK_ODBC_DLNAME "${ODBC_LIBRARIES}") |
|||
else() |
|||
set(GLPK_HAVE_ODBC "undef") |
|||
set(GLPK_ODBC_DLNAME "") |
|||
endif() |
|||
|
|||
if(ENABLE_MYSQL) |
|||
message(STATUS "GLPK - Building with MySQL Support") |
|||
find_package(MySQL REQUIRED) |
|||
if (NOT ENABLE_DL) |
|||
message(SEND_ERROR "ENABLE_MYSQL required ENABLE_DL") |
|||
endif() |
|||
include_directories(MYSQL_INCLUDE_DIR) |
|||
set(GLPK_HAVE_MYSQL "define") |
|||
set(GLPK_MYSQL_DLNAME "${MYSQL_LIBRARIES}") |
|||
else() |
|||
set(GLPK_HAVE_MYSQL "undef") |
|||
set(GLPK_MYSQL_DLNAME "") |
|||
endif() |
|||
|
|||
# Convert to CMake Variables to be used in the Config File |
|||
if(HAVE_SYS_TIME_H) |
|||
set(GLPK_HAVE_SYS_TIME_H "define") |
|||
else() |
|||
set (GLPK_HAVE_SYS_TIME_H "undef") |
|||
endif() |
|||
if(HAVE_GETTIMEOFDAY) |
|||
set(GLPK_HAVE_GETTIMEOFDAY "define") |
|||
else() |
|||
set (GLPK_HAVE_GETTIMEOFDAY "undef") |
|||
endif() |
|||
if(HAVE_LTDL) |
|||
set(GLPK_HAVE_LTDL "define") |
|||
else() |
|||
set (GLPK_HAVE_LTDL "undef") |
|||
endif() |
|||
if(HAVE_DLFCN) |
|||
set(GLPK_HAVE_DLFCN "define") |
|||
else() |
|||
set (GLPK_HAVE_DLFCN "undef") |
|||
endif() |
|||
|
|||
|
|||
# Configure a header file to pass some of the CMake settings to the source code |
|||
configure_file ( |
|||
"${PROJECT_SOURCE_DIR}/config.h.cmake.in" |
|||
"${PROJECT_BINARY_DIR}/include/config.h" |
|||
) |
|||
# Add the binary dir include directory for config.h |
|||
include_directories("${PROJECT_BINARY_DIR}/include") |
|||
|
|||
############################################################# |
|||
## |
|||
## Source file aggregation and clustering |
|||
## |
|||
############################################################# |
|||
file(GLOB_RECURSE GLPK_LIB_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h) |
|||
file(GLOB_RECURSE GLPK_LIB_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c) |
|||
|
|||
file(GLOB_RECURSE GLPK_LIB_DEF ${PROJECT_SOURCE_DIR}/w64/*.def) |
|||
|
|||
set(GLPK_EXAMPLE_GLPSOL_SOURCES ${PROJECT_SOURCE_DIR}/examples/glpsol.c) |
|||
set(GLPK_EXAMPLE_IPTSAMP_SOURCES ${PROJECT_SOURCE_DIR}/examples/iptsamp.c) |
|||
set(GLPK_EXAMPLE_MPLSAMP1_SOURCES ${PROJECT_SOURCE_DIR}/examples/mplsamp1.c) |
|||
set(GLPK_EXAMPLE_MPLSAMP2_SOURCES ${PROJECT_SOURCE_DIR}/examples/mplsamp2.c) |
|||
set(GLPK_EXAMPLE_SAMPLE_SOURCES ${PROJECT_SOURCE_DIR}/examples/sample.c) |
|||
set(GLPK_EXAMPLE_SPXSAMP1_SOURCES ${PROJECT_SOURCE_DIR}/examples/spxsamp1.c) |
|||
set(GLPK_EXAMPLE_SPXSAMP2_SOURCES ${PROJECT_SOURCE_DIR}/examples/spxsamp2.c) |
|||
set(GLPK_EXAMPLE_NETGEN_SOURCES ${PROJECT_SOURCE_DIR}/examples/netgen.c) |
|||
|
|||
# Additional include files like the storm-config.h |
|||
file(GLOB_RECURSE GLPK_BUILD_HEADERS ${PROJECT_BINARY_DIR}/include/*.h) |
|||
|
|||
# Add custom additional include or link directories |
|||
if (ADDITIONAL_INCLUDE_DIRS) |
|||
message(STATUS "GLPK - Using additional include directories ${ADDITIONAL_INCLUDE_DIRS}") |
|||
include_directories(${ADDITIONAL_INCLUDE_DIRS}) |
|||
endif(ADDITIONAL_INCLUDE_DIRS) |
|||
if (ADDITIONAL_LINK_DIRS) |
|||
message(STATUS "GLPK - Using additional link directories ${ADDITIONAL_LINK_DIRS}") |
|||
link_directories(${ADDITIONAL_LINK_DIRS}) |
|||
endif(ADDITIONAL_LINK_DIRS) |
|||
|
|||
############################################################################### |
|||
## # |
|||
## Executable Creation # |
|||
## # |
|||
## All link_directories() calls MUST be made before this point # |
|||
## # |
|||
############################################################################### |
|||
if(WITH_GLPK_EXAMPLES) |
|||
add_executable(glpsol ${GLPK_EXAMPLE_GLPSOL_SOURCES}) |
|||
add_executable(iptsamp ${GLPK_EXAMPLE_IPTSAMP_SOURCES}) |
|||
add_executable(mplsamp1 ${GLPK_EXAMPLE_MPLSAMP1_SOURCES}) |
|||
add_executable(mplsamp2 ${GLPK_EXAMPLE_MPLSAMP2_SOURCES}) |
|||
add_executable(spxsamp1 ${GLPK_EXAMPLE_SPXSAMP1_SOURCES}) |
|||
add_executable(spxsamp2 ${GLPK_EXAMPLE_SPXSAMP2_SOURCES}) |
|||
add_executable(netgen ${GLPK_EXAMPLE_NETGEN_SOURCES}) |
|||
add_executable(sample ${GLPK_EXAMPLE_SAMPLE_SOURCES}) |
|||
endif() |
|||
|
|||
if(ENABLE_DL) |
|||
set(GLPK_BUILD_TYPE SHARED) |
|||
else() |
|||
set(GLPK_BUILD_TYPE STATIC) |
|||
endif() |
|||
if (NOT MSVC) |
|||
set(GLPK_LIB_DEF "") |
|||
endif() |
|||
|
|||
add_library(glpk ${GLPK_BUILD_TYPE} ${GLPK_LIB_SOURCES} ${GLPK_LIB_HEADERS} ${GLPK_LIB_DEF}) |
|||
IF(UNIX) |
|||
target_link_libraries(glpk m) |
|||
ENDIF(UNIX) |
|||
if(HAVE_LTDL) |
|||
target_link_libraries(glpk ltdl) |
|||
endif(HAVE_LTDL) |
|||
if(HAVE_DLFCN) |
|||
target_link_libraries(glpk dl) |
|||
endif(HAVE_DLFCN) |
|||
|
|||
if(WITH_GLPK_EXAMPLES) |
|||
# Dependency for the Executable |
|||
add_dependencies(glpsol glpk) |
|||
add_dependencies(iptsamp glpk) |
|||
add_dependencies(mplsamp1 glpk) |
|||
add_dependencies(mplsamp2 glpk) |
|||
add_dependencies(spxsamp1 glpk) |
|||
add_dependencies(spxsamp2 glpk) |
|||
add_dependencies(netgen glpk) |
|||
add_dependencies(sample glpk) |
|||
target_link_libraries(glpsol glpk) |
|||
target_link_libraries(iptsamp glpk) |
|||
target_link_libraries(mplsamp1 glpk) |
|||
target_link_libraries(mplsamp2 glpk) |
|||
target_link_libraries(spxsamp1 glpk) |
|||
target_link_libraries(spxsamp2 glpk) |
|||
target_link_libraries(netgen glpk) |
|||
target_link_libraries(sample glpk) |
|||
endif() |
|||
|
|||
############################################################# |
|||
## |
|||
## ODBC |
|||
## |
|||
############################################################# |
|||
if(ODBC_FOUND) |
|||
target_link_libraries(glpk ${ODBC_LIBRARIES}) |
|||
endif() |
|||
|
|||
############################################################# |
|||
## |
|||
## MySQL |
|||
## |
|||
############################################################# |
|||
if(MYSQL_FOUND) |
|||
target_link_libraries(glpk ${MYSQL_LIBRARIES}) |
|||
endif() |
@ -1,27 +0,0 @@ |
|||
/* config.h.in (GLPK configuration template file) */ |
|||
|
|||
#@GLPK_HAVE_SYS_TIME_H@ HAVE_SYS_TIME_H |
|||
/* defined if the <sys/time.h> header can be used */ |
|||
|
|||
#@GLPK_HAVE_GETTIMEOFDAY@ HAVE_GETTIMEOFDAY |
|||
/* defined if the gettimeofday function can be used */ |
|||
|
|||
#@GLPK_HAVE_GMP@ HAVE_GMP |
|||
/* defined if the GNU MP bignum library is available */ |
|||
/* requires <gmp.h> and -lgmp */ |
|||
|
|||
#@GLPK_HAVE_LTDL@ HAVE_LTDL |
|||
/* defined if the GNU Libtool shared library support is enabled */ |
|||
/* requires <ltdl.h> and -lltdl */ |
|||
|
|||
#@GLPK_HAVE_DLFCN@ HAVE_DLFCN |
|||
/* defined if the POSIX shared library support is enabled */ |
|||
/* requires <dlfcn.h> */ |
|||
|
|||
#@GLPK_HAVE_ODBC@ ODBC_DLNAME @GLPK_ODBC_DLNAME@ |
|||
/* ODBC shared library name if this feature is enabled */ |
|||
|
|||
#@GLPK_HAVE_MYSQL@ MYSQL_DLNAME @GLPK_MYSQL_DLNAME@ |
|||
/* MySQL shared library name if this feature is enabled */ |
|||
|
|||
/* eof */ |
@ -1,47 +0,0 @@ |
|||
# - Find mysqlclient |
|||
# Find the native MySQL includes and library |
|||
# |
|||
# MYSQL_INCLUDE_DIR - where to find mysql.h, etc. |
|||
# MYSQL_LIBRARIES - List of libraries when using MySQL. |
|||
# MYSQL_FOUND - True if MySQL found. |
|||
|
|||
IF (MYSQL_INCLUDE_DIR) |
|||
# Already in cache, be silent |
|||
SET(MYSQL_FIND_QUIETLY TRUE) |
|||
ENDIF (MYSQL_INCLUDE_DIR) |
|||
|
|||
FIND_PATH(MYSQL_INCLUDE_DIR mysql.h |
|||
/usr/local/include/mysql |
|||
/usr/include/mysql |
|||
) |
|||
|
|||
SET(MYSQL_NAMES mysqlclient mysqlclient_r) |
|||
FIND_LIBRARY(MYSQL_LIBRARY |
|||
NAMES ${MYSQL_NAMES} |
|||
PATHS /usr/lib /usr/local/lib |
|||
PATH_SUFFIXES mysql |
|||
) |
|||
|
|||
IF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) |
|||
SET(MYSQL_FOUND TRUE) |
|||
SET( MYSQL_LIBRARIES ${MYSQL_LIBRARY} ) |
|||
ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) |
|||
SET(MYSQL_FOUND FALSE) |
|||
SET( MYSQL_LIBRARIES ) |
|||
ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY) |
|||
|
|||
IF (MYSQL_FOUND) |
|||
IF (NOT MYSQL_FIND_QUIETLY) |
|||
MESSAGE(STATUS "Found MySQL: ${MYSQL_LIBRARY}") |
|||
ENDIF (NOT MYSQL_FIND_QUIETLY) |
|||
ELSE (MYSQL_FOUND) |
|||
IF (MYSQL_FIND_REQUIRED) |
|||
MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.") |
|||
MESSAGE(FATAL_ERROR "Could NOT find MySQL library") |
|||
ENDIF (MYSQL_FIND_REQUIRED) |
|||
ENDIF (MYSQL_FOUND) |
|||
|
|||
MARK_AS_ADVANCED( |
|||
MYSQL_LIBRARY |
|||
MYSQL_INCLUDE_DIR |
|||
) |
@ -1,60 +0,0 @@ |
|||
# |
|||
# Find the ODBC driver manager includes and library. |
|||
# |
|||
# ODBC is an open standard for connecting to different databases in a |
|||
# semi-vendor-independent fashion. First you install the ODBC driver |
|||
# manager. Then you need a driver for each separate database you want |
|||
# to connect to (unless a generic one works). VTK includes neither |
|||
# the driver manager nor the vendor-specific drivers: you have to find |
|||
# those yourself. |
|||
# |
|||
# This module defines |
|||
# ODBC_INCLUDE_DIRECTORIES, where to find sql.h |
|||
# ODBC_LIBRARIES, the libraries to link against to use ODBC |
|||
# ODBC_FOUND. If false, you cannot build anything that requires MySQL. |
|||
|
|||
find_path(ODBC_INCLUDE_DIRECTORIES |
|||
NAMES sql.h |
|||
HINTS |
|||
/usr/include |
|||
/usr/include/odbc |
|||
/usr/local/include |
|||
/usr/local/include/odbc |
|||
/usr/local/odbc/include |
|||
"C:/Program Files/ODBC/include" |
|||
"C:/Program Files/Microsoft SDKs/Windows/v7.0/include" |
|||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/include" |
|||
"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include" |
|||
"C:/ODBC/include" |
|||
DOC "Specify the directory containing sql.h." |
|||
) |
|||
|
|||
find_library(ODBC_LIBRARIES |
|||
NAMES iodbc odbc odbcinst odbc32 |
|||
HINTS |
|||
/usr/lib |
|||
/usr/lib/odbc |
|||
/usr/local/lib |
|||
/usr/local/lib/odbc |
|||
/usr/local/odbc/lib |
|||
"C:/Program Files/ODBC/lib" |
|||
"C:/ODBC/lib/debug" |
|||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib" |
|||
"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib" |
|||
DOC "Specify the ODBC driver manager library here." |
|||
) |
|||
|
|||
# MinGW find usually fails |
|||
if(MINGW) |
|||
set(ODBC_INCLUDE_DIRECTORIES ".") |
|||
set(ODBC_LIBRARIES odbc32) |
|||
endif() |
|||
|
|||
include(FindPackageHandleStandardArgs) |
|||
find_package_handle_standard_args(ODBC |
|||
DEFAULT_MSG |
|||
ODBC_INCLUDE_DIRECTORIES |
|||
ODBC_LIBRARIES |
|||
) |
|||
|
|||
mark_as_advanced(ODBC_FOUND ODBC_LIBRARIES ODBC_INCLUDE_DIRECTORIES) |
@ -1,576 +0,0 @@ |
|||
/* bfd.c (LP basis factorization driver) */ |
|||
|
|||
/*********************************************************************** |
|||
* This code is part of GLPK (GNU Linear Programming Kit). |
|||
* |
|||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
|||
* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied |
|||
* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights |
|||
* reserved. E-mail: <mao@gnu.org>. |
|||
* |
|||
* GLPK is free software: you can redistribute it and/or modify it |
|||
* under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* GLPK is distributed in the hope that it will be useful, but WITHOUT |
|||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
|||
* License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
|||
***********************************************************************/ |
|||
|
|||
#include "env.h" |
|||
#if 0 /* 27/IV-2013 */ |
|||
#include "glpfhv.h" |
|||
#else |
|||
#include "fhvint.h" |
|||
#endif |
|||
#include "glplpf.h" |
|||
#include "prob.h" |
|||
|
|||
/* CAUTION: DO NOT CHANGE THE LIMIT BELOW */ |
|||
|
|||
#define M_MAX 100000000 /* = 100*10^6 */ |
|||
/* maximal order of the basis matrix */ |
|||
|
|||
struct BFD |
|||
{ /* LP basis factorization */ |
|||
int valid; |
|||
/* factorization is valid only if this flag is set */ |
|||
int type; |
|||
/* factorization type: |
|||
GLP_BF_FT - LUF + Forrest-Tomlin |
|||
GLP_BF_BG - LUF + Schur compl. + Bartels-Golub |
|||
GLP_BF_GR - LUF + Schur compl. + Givens rotation */ |
|||
#if 0 /* 27/IV-2013 */ |
|||
FHV *fhv; |
|||
/* LP basis factorization (GLP_BF_FT) */ |
|||
#else |
|||
FHVINT *fi; |
|||
/* interface to FHV-factorization (GLP_BF_FT) */ |
|||
#endif |
|||
LPF *lpf; |
|||
/* LP basis factorization (GLP_BF_BG, GLP_BF_GR) */ |
|||
int lu_size; /* luf.sv_size */ |
|||
double piv_tol; /* luf.piv_tol */ |
|||
int piv_lim; /* luf.piv_lim */ |
|||
int suhl; /* luf.suhl */ |
|||
double eps_tol; /* luf.eps_tol */ |
|||
double max_gro; /* luf.max_gro */ |
|||
int nfs_max; /* fhv.hh_max */ |
|||
double upd_tol; /* fhv.upd_tol */ |
|||
int nrs_max; /* lpf.n_max */ |
|||
int rs_size; /* lpf.v_size */ |
|||
/* internal control parameters */ |
|||
int upd_lim; |
|||
/* the factorization update limit */ |
|||
int upd_cnt; |
|||
/* the factorization update count */ |
|||
}; |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_create_it - create LP basis factorization |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* BFD *bfd_create_it(void); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_create_it creates a program object, which represents |
|||
* a factorization of LP basis. |
|||
* |
|||
* RETURNS |
|||
* |
|||
* The routine bfd_create_it returns a pointer to the object created. */ |
|||
|
|||
BFD *bfd_create_it(void) |
|||
{ BFD *bfd; |
|||
bfd = xmalloc(sizeof(BFD)); |
|||
bfd->valid = 0; |
|||
bfd->type = GLP_BF_FT; |
|||
#if 0 /* 27/IV-2013 */ |
|||
bfd->fhv = NULL; |
|||
#else |
|||
bfd->fi = NULL; |
|||
#endif |
|||
bfd->lpf = NULL; |
|||
bfd->lu_size = 0; |
|||
bfd->piv_tol = 0.10; |
|||
bfd->piv_lim = 4; |
|||
bfd->suhl = 1; |
|||
bfd->eps_tol = 1e-15; |
|||
bfd->max_gro = 1e+10; |
|||
bfd->nfs_max = 100; |
|||
bfd->upd_tol = 1e-6; |
|||
bfd->nrs_max = 100; |
|||
bfd->rs_size = 1000; |
|||
bfd->upd_lim = -1; |
|||
bfd->upd_cnt = 0; |
|||
return bfd; |
|||
} |
|||
|
|||
/**********************************************************************/ |
|||
|
|||
void bfd_set_parm(BFD *bfd, const void *_parm) |
|||
{ /* change LP basis factorization control parameters */ |
|||
const glp_bfcp *parm = _parm; |
|||
xassert(bfd != NULL); |
|||
bfd->type = parm->type; |
|||
bfd->lu_size = parm->lu_size; |
|||
bfd->piv_tol = parm->piv_tol; |
|||
bfd->piv_lim = parm->piv_lim; |
|||
bfd->suhl = parm->suhl; |
|||
bfd->eps_tol = parm->eps_tol; |
|||
bfd->max_gro = parm->max_gro; |
|||
bfd->nfs_max = parm->nfs_max; |
|||
bfd->upd_tol = parm->upd_tol; |
|||
bfd->nrs_max = parm->nrs_max; |
|||
bfd->rs_size = parm->rs_size; |
|||
return; |
|||
} |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_factorize - compute LP basis factorization |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* int bfd_factorize(BFD *bfd, int m, int bh[], int (*col)(void *info, |
|||
* int j, int ind[], double val[]), void *info); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_factorize computes the factorization of the basis |
|||
* matrix B specified by the routine col. |
|||
* |
|||
* The parameter bfd specified the basis factorization data structure |
|||
* created with the routine bfd_create_it. |
|||
* |
|||
* The parameter m specifies the order of B, m > 0. |
|||
* |
|||
* The array bh specifies the basis header: bh[j], 1 <= j <= m, is the |
|||
* number of j-th column of B in some original matrix. The array bh is |
|||
* optional and can be specified as NULL. |
|||
* |
|||
* The formal routine col specifies the matrix B to be factorized. To |
|||
* obtain j-th column of A the routine bfd_factorize calls the routine |
|||
* col with the parameter j (1 <= j <= n). In response the routine col |
|||
* should store row indices and numerical values of non-zero elements |
|||
* of j-th column of B to locations ind[1,...,len] and val[1,...,len], |
|||
* respectively, where len is the number of non-zeros in j-th column |
|||
* returned on exit. Neither zero nor duplicate elements are allowed. |
|||
* |
|||
* The parameter info is a transit pointer passed to the routine col. |
|||
* |
|||
* RETURNS |
|||
* |
|||
* 0 The factorization has been successfully computed. |
|||
* |
|||
* BFD_ESING |
|||
* The specified matrix is singular within the working precision. |
|||
* |
|||
* BFD_ECOND |
|||
* The specified matrix is ill-conditioned. |
|||
* |
|||
* For more details see comments to the routine luf_factorize. */ |
|||
|
|||
int bfd_factorize(BFD *bfd, int m, const int bh[], int (*col) |
|||
(void *info, int j, int ind[], double val[]), void *info) |
|||
#if 0 /* 06/VI-2013 */ |
|||
{ LUF *luf; |
|||
#else |
|||
{ |
|||
#endif |
|||
int nov, ret; |
|||
xassert(bfd != NULL); |
|||
xassert(1 <= m && m <= M_MAX); |
|||
/* invalidate the factorization */ |
|||
bfd->valid = 0; |
|||
/* create the factorization, if necessary */ |
|||
nov = 0; |
|||
switch (bfd->type) |
|||
{ case GLP_BF_FT: |
|||
if (bfd->lpf != NULL) |
|||
lpf_delete_it(bfd->lpf), bfd->lpf = NULL; |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv == NULL) |
|||
bfd->fhv = fhv_create_it(), nov = 1; |
|||
#else |
|||
if (bfd->fi == NULL) |
|||
bfd->fi = fhvint_create(), nov = 1; |
|||
#endif |
|||
break; |
|||
case GLP_BF_BG: |
|||
case GLP_BF_GR: |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
fhv_delete_it(bfd->fhv), bfd->fhv = NULL; |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
fhvint_delete(bfd->fi), bfd->fi = NULL; |
|||
#endif |
|||
if (bfd->lpf == NULL) |
|||
bfd->lpf = lpf_create_it(), nov = 1; |
|||
break; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
#if 0 /* 06/VI-2013 */ |
|||
/* set control parameters specific to LUF */ |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
luf = bfd->fhv->luf; |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
goto skip; |
|||
#endif |
|||
else if (bfd->lpf != NULL) |
|||
luf = bfd->lpf->luf; |
|||
else |
|||
xassert(bfd != bfd); |
|||
if (nov) luf->new_sva = bfd->lu_size; |
|||
luf->piv_tol = bfd->piv_tol; |
|||
luf->piv_lim = bfd->piv_lim; |
|||
luf->suhl = bfd->suhl; |
|||
luf->eps_tol = bfd->eps_tol; |
|||
luf->max_gro = bfd->max_gro; |
|||
#endif |
|||
#if 0 /* 27/IV-2013 */ |
|||
/* set control parameters specific to FHV */ |
|||
if (bfd->fhv != NULL) |
|||
{ if (nov) bfd->fhv->hh_max = bfd->nfs_max; |
|||
bfd->fhv->upd_tol = bfd->upd_tol; |
|||
} |
|||
#endif |
|||
/* set control parameters specific to LPF */ |
|||
if (bfd->lpf != NULL) |
|||
{ if (nov) bfd->lpf->n_max = bfd->nrs_max; |
|||
if (nov) bfd->lpf->v_size = bfd->rs_size; |
|||
} |
|||
#if 0 /* 27/IV-2013 */ |
|||
/* try to factorize the basis matrix */ |
|||
if (bfd->fhv != NULL) |
|||
{ switch (fhv_factorize(bfd->fhv, m, col, info)) |
|||
{ case 0: |
|||
break; |
|||
case FHV_ESING: |
|||
ret = BFD_ESING; |
|||
goto done; |
|||
case FHV_ECOND: |
|||
ret = BFD_ECOND; |
|||
goto done; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
} |
|||
#else |
|||
skip: /* try to factorize the basis matrix */ |
|||
if (bfd->fi != NULL) |
|||
{ /* FIXME */ |
|||
if (fhvint_factorize(bfd->fi, m, col, info) != 0) |
|||
{ ret = BFD_ESING; |
|||
goto done; |
|||
} |
|||
/* printf("*** FACTORIZED; m = %d ***\n", m); */ |
|||
} |
|||
#endif |
|||
else if (bfd->lpf != NULL) |
|||
{ switch (lpf_factorize(bfd->lpf, m, bh, col, info)) |
|||
{ case 0: |
|||
/* set the Schur complement update type */ |
|||
switch (bfd->type) |
|||
{ case GLP_BF_BG: |
|||
/* Bartels-Golub update */ |
|||
#if 0 /* 11/VIII-2013 */ |
|||
bfd->lpf->scf->t_opt = SCF_TBG; |
|||
#else |
|||
bfd->lpf->t_opt = SCF_TBG; |
|||
#endif |
|||
break; |
|||
case GLP_BF_GR: |
|||
/* Givens rotations update */ |
|||
#if 0 /* 11/VIII-2013 */ |
|||
bfd->lpf->scf->t_opt = SCF_TGR; |
|||
#else |
|||
bfd->lpf->t_opt = SCF_TGR; |
|||
#endif |
|||
break; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
break; |
|||
case LPF_ESING: |
|||
ret = BFD_ESING; |
|||
goto done; |
|||
case LPF_ECOND: |
|||
ret = BFD_ECOND; |
|||
goto done; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
} |
|||
else |
|||
xassert(bfd != bfd); |
|||
/* the basis matrix has been successfully factorized */ |
|||
bfd->valid = 1; |
|||
bfd->upd_cnt = 0; |
|||
ret = 0; |
|||
done: /* return to the calling program */ |
|||
return ret; |
|||
} |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_ftran - perform forward transformation (solve system B*x = b) |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* void bfd_ftran(BFD *bfd, double x[]); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_ftran performs forward transformation, i.e. solves |
|||
* the system B*x = b, where B is the basis matrix, x is the vector of |
|||
* unknowns to be computed, b is the vector of right-hand sides. |
|||
* |
|||
* On entry elements of the vector b should be stored in dense format |
|||
* in locations x[1], ..., x[m], where m is the number of rows. On exit |
|||
* the routine stores elements of the vector x in the same locations. */ |
|||
|
|||
void bfd_ftran(BFD *bfd, double x[]) |
|||
{ xassert(bfd != NULL); |
|||
xassert(bfd->valid); |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
fhv_ftran(bfd->fhv, x); |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
fhvint_ftran(bfd->fi, x); |
|||
#endif |
|||
else if (bfd->lpf != NULL) |
|||
lpf_ftran(bfd->lpf, x); |
|||
else |
|||
xassert(bfd != bfd); |
|||
return; |
|||
} |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_btran - perform backward transformation (solve system B'*x = b) |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* void bfd_btran(BFD *bfd, double x[]); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_btran performs backward transformation, i.e. solves |
|||
* the system B'*x = b, where B' is a matrix transposed to the basis |
|||
* matrix B, x is the vector of unknowns to be computed, b is the vector |
|||
* of right-hand sides. |
|||
* |
|||
* On entry elements of the vector b should be stored in dense format |
|||
* in locations x[1], ..., x[m], where m is the number of rows. On exit |
|||
* the routine stores elements of the vector x in the same locations. */ |
|||
|
|||
void bfd_btran(BFD *bfd, double x[]) |
|||
{ xassert(bfd != NULL); |
|||
xassert(bfd->valid); |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
fhv_btran(bfd->fhv, x); |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
fhvint_btran(bfd->fi, x); |
|||
#endif |
|||
else if (bfd->lpf != NULL) |
|||
lpf_btran(bfd->lpf, x); |
|||
else |
|||
xassert(bfd != bfd); |
|||
return; |
|||
} |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_update_it - update LP basis factorization |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* int bfd_update_it(BFD *bfd, int j, int bh, int len, const int ind[], |
|||
* const double val[]); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_update_it updates the factorization of the basis |
|||
* matrix B after replacing its j-th column by a new vector. |
|||
* |
|||
* The parameter j specifies the number of column of B, which has been |
|||
* replaced, 1 <= j <= m, where m is the order of B. |
|||
* |
|||
* The parameter bh specifies the basis header entry for the new column |
|||
* of B, which is the number of the new column in some original matrix. |
|||
* This parameter is optional and can be specified as 0. |
|||
* |
|||
* Row indices and numerical values of non-zero elements of the new |
|||
* column of B should be placed in locations ind[1], ..., ind[len] and |
|||
* val[1], ..., val[len], resp., where len is the number of non-zeros |
|||
* in the column. Neither zero nor duplicate elements are allowed. |
|||
* |
|||
* RETURNS |
|||
* |
|||
* 0 The factorization has been successfully updated. |
|||
* |
|||
* BFD_ESING |
|||
* New basis matrix is singular within the working precision. |
|||
* |
|||
* BFD_ECHECK |
|||
* The factorization is inaccurate. |
|||
* |
|||
* BFD_ELIMIT |
|||
* Factorization update limit has been reached. |
|||
* |
|||
* BFD_EROOM |
|||
* Overflow of the sparse vector area. |
|||
* |
|||
* In case of non-zero return code the factorization becomes invalid. |
|||
* It should not be used until it has been recomputed with the routine |
|||
* bfd_factorize. */ |
|||
|
|||
int bfd_update_it(BFD *bfd, int j, int bh, int len, const int ind[], |
|||
const double val[]) |
|||
{ int ret; |
|||
xassert(bfd != NULL); |
|||
xassert(bfd->valid); |
|||
/* try to update the factorization */ |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
{ switch (fhv_update_it(bfd->fhv, j, len, ind, val)) |
|||
{ case 0: |
|||
break; |
|||
case FHV_ESING: |
|||
bfd->valid = 0; |
|||
ret = BFD_ESING; |
|||
goto done; |
|||
case FHV_ECHECK: |
|||
bfd->valid = 0; |
|||
ret = BFD_ECHECK; |
|||
goto done; |
|||
case FHV_ELIMIT: |
|||
bfd->valid = 0; |
|||
ret = BFD_ELIMIT; |
|||
goto done; |
|||
case FHV_EROOM: |
|||
bfd->valid = 0; |
|||
ret = BFD_EROOM; |
|||
goto done; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
} |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
{ /* see fhv_ft_update for return codes */ |
|||
switch (fhvint_update(bfd->fi, j, len, ind, val)) |
|||
{ case 0: |
|||
break; |
|||
case 1: |
|||
bfd->valid = 0; |
|||
ret = BFD_ESING; |
|||
goto done; |
|||
case 2: |
|||
case 3: |
|||
case 5: |
|||
bfd->valid = 0; |
|||
ret = BFD_ECHECK; |
|||
goto done; |
|||
case 4: |
|||
bfd->valid = 0; |
|||
ret = BFD_ELIMIT; |
|||
goto done; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
} |
|||
#endif |
|||
else if (bfd->lpf != NULL) |
|||
{ switch (lpf_update_it(bfd->lpf, j, bh, len, ind, val)) |
|||
{ case 0: |
|||
break; |
|||
case LPF_ESING: |
|||
bfd->valid = 0; |
|||
ret = BFD_ESING; |
|||
goto done; |
|||
case LPF_ELIMIT: |
|||
bfd->valid = 0; |
|||
ret = BFD_ELIMIT; |
|||
goto done; |
|||
default: |
|||
xassert(bfd != bfd); |
|||
} |
|||
} |
|||
else |
|||
xassert(bfd != bfd); |
|||
/* the factorization has been successfully updated */ |
|||
/* increase the update count */ |
|||
bfd->upd_cnt++; |
|||
ret = 0; |
|||
done: /* return to the calling program */ |
|||
return ret; |
|||
} |
|||
|
|||
/**********************************************************************/ |
|||
|
|||
int bfd_get_count(BFD *bfd) |
|||
{ /* determine factorization update count */ |
|||
xassert(bfd != NULL); |
|||
xassert(bfd->valid); |
|||
return bfd->upd_cnt; |
|||
} |
|||
|
|||
/*********************************************************************** |
|||
* NAME |
|||
* |
|||
* bfd_delete_it - delete LP basis factorization |
|||
* |
|||
* SYNOPSIS |
|||
* |
|||
* #include "glpbfd.h" |
|||
* void bfd_delete_it(BFD *bfd); |
|||
* |
|||
* DESCRIPTION |
|||
* |
|||
* The routine bfd_delete_it deletes LP basis factorization specified |
|||
* by the parameter fhv and frees all memory allocated to this program |
|||
* object. */ |
|||
|
|||
void bfd_delete_it(BFD *bfd) |
|||
{ xassert(bfd != NULL); |
|||
#if 0 /* 27/IV-2013 */ |
|||
if (bfd->fhv != NULL) |
|||
fhv_delete_it(bfd->fhv); |
|||
#else |
|||
if (bfd->fi != NULL) |
|||
fhvint_delete(bfd->fi); |
|||
#endif |
|||
if (bfd->lpf != NULL) |
|||
lpf_delete_it(bfd->lpf); |
|||
xfree(bfd); |
|||
return; |
|||
} |
|||
|
|||
/* eof */ |
1097
resources/3rdparty/glpk-4.53/src/glplpf.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,216 +0,0 @@ |
|||
/* glplpf.h (LP basis factorization, Schur complement version) */ |
|||
|
|||
/*********************************************************************** |
|||
* This code is part of GLPK (GNU Linear Programming Kit). |
|||
* |
|||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
|||
* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied |
|||
* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights |
|||
* reserved. E-mail: <mao@gnu.org>. |
|||
* |
|||
* GLPK is free software: you can redistribute it and/or modify it |
|||
* under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* GLPK is distributed in the hope that it will be useful, but WITHOUT |
|||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
|||
* License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
|||
***********************************************************************/ |
|||
|
|||
#ifndef GLPLPF_H |
|||
#define GLPLPF_H |
|||
|
|||
#if 0 /* 11/VIII-2013 */ |
|||
#include "glpscf.h" |
|||
#else |
|||
#include "ifu.h" |
|||
#endif |
|||
#if 0 /* 06/VI-2013 */ |
|||
#include "glpluf.h" |
|||
#else |
|||
#include "lufint.h" |
|||
#endif |
|||
|
|||
/*********************************************************************** |
|||
* The structure LPF defines the factorization of the basis mxm matrix |
|||
* B, where m is the number of rows in corresponding problem instance. |
|||
* |
|||
* This factorization is the following septet: |
|||
* |
|||
* [B] = (L0, U0, R, S, C, P, Q), (1) |
|||
* |
|||
* and is based on the following main equality: |
|||
* |
|||
* ( B F^) ( B0 F ) ( L0 0 ) ( U0 R ) |
|||
* ( ) = P ( ) Q = P ( ) ( ) Q, (2) |
|||
* ( G^ H^) ( G H ) ( S I ) ( 0 C ) |
|||
* |
|||
* where: |
|||
* |
|||
* B is the current basis matrix (not stored); |
|||
* |
|||
* F^, G^, H^ are some additional matrices (not stored); |
|||
* |
|||
* B0 is some initial basis matrix (not stored); |
|||
* |
|||
* F, G, H are some additional matrices (not stored); |
|||
* |
|||
* P, Q are permutation matrices (stored in both row- and column-like |
|||
* formats); |
|||
* |
|||
* L0, U0 are some matrices that defines a factorization of the initial |
|||
* basis matrix B0 = L0 * U0 (stored in an invertable form); |
|||
* |
|||
* R is a matrix defined from L0 * R = F, so R = inv(L0) * F (stored in |
|||
* a column-wise sparse format); |
|||
* |
|||
* S is a matrix defined from S * U0 = G, so S = G * inv(U0) (stored in |
|||
* a row-wise sparse format); |
|||
* |
|||
* C is the Schur complement for matrix (B0 F G H). It is defined from |
|||
* S * R + C = H, so C = H - S * R = H - G * inv(U0) * inv(L0) * F = |
|||
* = H - G * inv(B0) * F. Matrix C is stored in an invertable form. |
|||
* |
|||
* REFERENCES |
|||
* |
|||
* 1. M.A.Saunders, "LUSOL: A basis package for constrained optimiza- |
|||
* tion," SCCM, Stanford University, 2006. |
|||
* |
|||
* 2. M.A.Saunders, "Notes 5: Basis Updates," CME 318, Stanford Univer- |
|||
* sity, Spring 2006. |
|||
* |
|||
* 3. M.A.Saunders, "Notes 6: LUSOL---a Basis Factorization Package," |
|||
* ibid. */ |
|||
|
|||
typedef struct LPF LPF; |
|||
|
|||
struct LPF |
|||
{ /* LP basis factorization */ |
|||
int valid; |
|||
/* the factorization is valid only if this flag is set */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* initial basis matrix B0 */ |
|||
int m0_max; |
|||
/* maximal value of m0 (increased automatically, if necessary) */ |
|||
int m0; |
|||
/* the order of B0 */ |
|||
#if 0 /* 06/VI-2013 */ |
|||
LUF *luf; |
|||
#else |
|||
LUFINT *lufint; |
|||
#endif |
|||
/* LU-factorization of B0 */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* current basis matrix B */ |
|||
int m; |
|||
/* the order of B */ |
|||
double *B; /* double B[1+m*m]; */ |
|||
/* B in dense format stored by rows and used only for debugging; |
|||
normally this array is not allocated */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* augmented matrix (B0 F G H) of the order m0+n */ |
|||
int n_max; |
|||
/* maximal number of additional rows and columns */ |
|||
int n; |
|||
/* current number of additional rows and columns */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* m0xn matrix R in column-wise format */ |
|||
int *R_ptr; /* int R_ptr[1+n_max]; */ |
|||
/* R_ptr[j], 1 <= j <= n, is a pointer to j-th column */ |
|||
int *R_len; /* int R_len[1+n_max]; */ |
|||
/* R_len[j], 1 <= j <= n, is the length of j-th column */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* nxm0 matrix S in row-wise format */ |
|||
int *S_ptr; /* int S_ptr[1+n_max]; */ |
|||
/* S_ptr[i], 1 <= i <= n, is a pointer to i-th row */ |
|||
int *S_len; /* int S_len[1+n_max]; */ |
|||
/* S_len[i], 1 <= i <= n, is the length of i-th row */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* Schur complement C of the order n */ |
|||
#if 0 /* 11/VIII-2013 */ |
|||
SCF *scf; /* SCF scf[1:n_max]; */ |
|||
/* factorization of the Schur complement */ |
|||
#else |
|||
IFU ifu; |
|||
/* IFU-factorization of the Schur complement */ |
|||
int t_opt; |
|||
/* type of transformation used to restore triangular structure of |
|||
matrix U: */ |
|||
#define SCF_TBG 1 /* Bartels-Golub elimination */ |
|||
#define SCF_TGR 2 /* Givens plane rotations */ |
|||
#endif |
|||
/*--------------------------------------------------------------*/ |
|||
/* matrix P of the order m0+n */ |
|||
int *P_row; /* int P_row[1+m0_max+n_max]; */ |
|||
/* P_row[i] = j means that P[i,j] = 1 */ |
|||
int *P_col; /* int P_col[1+m0_max+n_max]; */ |
|||
/* P_col[j] = i means that P[i,j] = 1 */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* matrix Q of the order m0+n */ |
|||
int *Q_row; /* int Q_row[1+m0_max+n_max]; */ |
|||
/* Q_row[i] = j means that Q[i,j] = 1 */ |
|||
int *Q_col; /* int Q_col[1+m0_max+n_max]; */ |
|||
/* Q_col[j] = i means that Q[i,j] = 1 */ |
|||
/*--------------------------------------------------------------*/ |
|||
/* Sparse Vector Area (SVA) is a set of locations intended to |
|||
store sparse vectors which represent columns of matrix R and |
|||
rows of matrix S; each location is a doublet (ind, val), where |
|||
ind is an index, val is a numerical value of a sparse vector |
|||
element; in the whole each sparse vector is a set of adjacent |
|||
locations defined by a pointer to its first element and its |
|||
length, i.e. the number of its elements */ |
|||
int v_size; |
|||
/* the SVA size, in locations; locations are numbered by integers |
|||
1, 2, ..., v_size, and location 0 is not used */ |
|||
int v_ptr; |
|||
/* pointer to the first available location */ |
|||
int *v_ind; /* int v_ind[1+v_size]; */ |
|||
/* v_ind[k], 1 <= k <= v_size, is the index field of location k */ |
|||
double *v_val; /* double v_val[1+v_size]; */ |
|||
/* v_val[k], 1 <= k <= v_size, is the value field of location k */ |
|||
/*--------------------------------------------------------------*/ |
|||
double *work1; /* double work1[1+m0+n_max]; */ |
|||
/* working array */ |
|||
double *work2; /* double work2[1+m0+n_max]; */ |
|||
/* working array */ |
|||
}; |
|||
|
|||
/* return codes: */ |
|||
#define LPF_ESING 1 /* singular matrix */ |
|||
#define LPF_ECOND 2 /* ill-conditioned matrix */ |
|||
#define LPF_ELIMIT 3 /* update limit reached */ |
|||
|
|||
#define lpf_create_it _glp_lpf_create_it |
|||
LPF *lpf_create_it(void); |
|||
/* create LP basis factorization */ |
|||
|
|||
#define lpf_factorize _glp_lpf_factorize |
|||
int lpf_factorize(LPF *lpf, int m, const int bh[], int (*col) |
|||
(void *info, int j, int ind[], double val[]), void *info); |
|||
/* compute LP basis factorization */ |
|||
|
|||
#define lpf_ftran _glp_lpf_ftran |
|||
void lpf_ftran(LPF *lpf, double x[]); |
|||
/* perform forward transformation (solve system B*x = b) */ |
|||
|
|||
#define lpf_btran _glp_lpf_btran |
|||
void lpf_btran(LPF *lpf, double x[]); |
|||
/* perform backward transformation (solve system B'*x = b) */ |
|||
|
|||
#define lpf_update_it _glp_lpf_update_it |
|||
int lpf_update_it(LPF *lpf, int j, int bh, int len, const int ind[], |
|||
const double val[]); |
|||
/* update LP basis factorization */ |
|||
|
|||
#define lpf_delete_it _glp_lpf_delete_it |
|||
void lpf_delete_it(LPF *lpf); |
|||
/* delete LP basis factorization */ |
|||
|
|||
#endif |
|||
|
|||
/* eof */ |
2971
resources/3rdparty/glpk-4.53/src/glpspx01.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
3118
resources/3rdparty/glpk-4.53/src/glpspx02.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,667 +0,0 @@ |
|||
/* glptsp.c */ |
|||
|
|||
/*********************************************************************** |
|||
* This code is part of GLPK (GNU Linear Programming Kit). |
|||
* |
|||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
|||
* 2009, 2010, 2011, 2013 Andrew Makhorin, Department for Applied |
|||
* Informatics, Moscow Aviation Institute, Moscow, Russia. All rights |
|||
* reserved. E-mail: <mao@gnu.org>. |
|||
* |
|||
* GLPK is free software: you can redistribute it and/or modify it |
|||
* under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* |
|||
* GLPK is distributed in the hope that it will be useful, but WITHOUT |
|||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
|||
* License for more details. |
|||
* |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
|||
***********************************************************************/ |
|||
|
|||
#include "env.h" |
|||
#include "glptsp.h" |
|||
#include "misc.h" |
|||
|
|||
#define xfault xerror |
|||
|
|||
/*---------------------------------------------------------------------- |
|||
-- tsp_read_data - read TSP instance data. |
|||
-- |
|||
-- *Synopsis* |
|||
-- |
|||
-- #include "glptsp.h" |
|||
-- TSP *tsp_read_data(char *fname); |
|||
-- |
|||
-- *Description* |
|||
-- |
|||
-- The routine tsp_read_data reads a TSP (or related problem) instance |
|||
-- data from the text file, whose name is the character string fname. |
|||
-- |
|||
-- For detailed description of the format recognized by the routine see |
|||
-- the report: G.Reinelt, TSPLIB 95. |
|||
-- |
|||
-- *Returns* |
|||
-- |
|||
-- If no error occurred, the routine tsp_read_data returns a pointer to |
|||
-- the TSP instance data block, which contains loaded data. In the case |
|||
-- of error the routine prints an error message and returns NULL. */ |
|||
|
|||
struct dsa |
|||
{ /* dynamic storage area used by the routine tsp_read_data */ |
|||
char *fname; |
|||
/* name of the input text file */ |
|||
FILE *fp; |
|||
/* stream assigned to the input text file */ |
|||
int seqn; |
|||
/* line sequential number */ |
|||
int c; |
|||
/* current character */ |
|||
char token[255+1]; |
|||
/* current token */ |
|||
}; |
|||
|
|||
static int get_char(struct dsa *dsa) |
|||
{ dsa->c = fgetc(dsa->fp); |
|||
if (ferror(dsa->fp)) |
|||
{ xprintf("%s:%d: read error - %s\n", |
|||
dsa->fname, dsa->seqn, strerror(errno)); |
|||
return 1; |
|||
} |
|||
if (feof(dsa->fp)) |
|||
dsa->c = EOF; |
|||
else if (dsa->c == '\n') |
|||
dsa->seqn++; |
|||
else if (isspace(dsa->c)) |
|||
dsa->c = ' '; |
|||
else if (iscntrl(dsa->c)) |
|||
{ xprintf("%s:%d: invalid control character 0x%02X\n", |
|||
dsa->fname, dsa->seqn, dsa->c); |
|||
return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
static int skip_spaces(struct dsa *dsa, int across) |
|||
{ while (dsa->c == ' ' || (across && dsa->c == '\n')) |
|||
if (get_char(dsa)) return 1; |
|||
return 0; |
|||
} |
|||
|
|||
static int scan_keyword(struct dsa *dsa) |
|||
{ int len = 0; |
|||
if (skip_spaces(dsa, 0)) return 1; |
|||
dsa->token[0] = '\0'; |
|||
while (isalnum(dsa->c) || dsa->c == '_') |
|||
{ if (len == 31) |
|||
{ xprintf("%s:%d: keyword `%s...' too long\n", dsa->fname, |
|||
dsa->seqn, dsa->token); |
|||
return 1; |
|||
} |
|||
dsa->token[len++] = (char)dsa->c, dsa->token[len] = '\0'; |
|||
if (get_char(dsa)) return 1; |
|||
} |
|||
if (len == 0) |
|||
{ xprintf("%s:%d: missing keyword\n", dsa->fname, dsa->seqn); |
|||
return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
static int check_colon(struct dsa *dsa) |
|||
{ if (skip_spaces(dsa, 0)) return 1; |
|||
if (dsa->c != ':') |
|||
{ xprintf("%s:%d: missing colon after `%s'\n", dsa->fname, |
|||
dsa->seqn, dsa->token); |
|||
return 1; |
|||
} |
|||
if (get_char(dsa)) return 1; |
|||
return 0; |
|||
} |
|||
|
|||
static int scan_token(struct dsa *dsa, int across) |
|||
{ int len = 0; |
|||
if (skip_spaces(dsa, across)) return 1; |
|||
dsa->token[0] = '\0'; |
|||
while (!(dsa->c == EOF || dsa->c == '\n' || dsa->c == ' ')) |
|||
{ if (len == 255) |
|||
{ dsa->token[31] = '\0'; |
|||
xprintf("%s:%d: token `%s...' too long\n", dsa->fname, |
|||
dsa->seqn, dsa->token); |
|||
return 1; |
|||
} |
|||
dsa->token[len++] = (char)dsa->c, dsa->token[len] = '\0'; |
|||
if (get_char(dsa)) return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
static int check_newline(struct dsa *dsa) |
|||
{ if (skip_spaces(dsa, 0)) return 1; |
|||
if (!(dsa->c == EOF || dsa->c == '\n')) |
|||
{ xprintf("%s:%d: extra symbols detected\n", dsa->fname, |
|||
dsa->seqn); |
|||
return 1; |
|||
} |
|||
if (get_char(dsa)) return 1; |
|||
return 0; |
|||
} |
|||
|
|||
static int scan_comment(struct dsa *dsa) |
|||
{ int len = 0; |
|||
if (skip_spaces(dsa, 0)) return 1; |
|||
dsa->token[0] = '\0'; |
|||
while (!(dsa->c == EOF || dsa->c == '\n')) |
|||
{ if (len == 255) |
|||
{ xprintf("%s:%d: comment too long\n", dsa->fname, dsa->seqn) |
|||
; |
|||
return 1; |
|||
} |
|||
dsa->token[len++] = (char)dsa->c, dsa->token[len] = '\0'; |
|||
if (get_char(dsa)) return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
static int scan_integer(struct dsa *dsa, int across, int *val) |
|||
{ if (scan_token(dsa, across)) return 1; |
|||
if (strlen(dsa->token) == 0) |
|||
{ xprintf("%s:%d: missing integer\n", dsa->fname, dsa->seqn); |
|||
return 1; |
|||
} |
|||
if (str2int(dsa->token, val)) |
|||
{ xprintf("%s:%d: integer `%s' invalid\n", dsa->fname, dsa->seqn |
|||
, dsa->token); |
|||
return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
static int scan_number(struct dsa *dsa, int across, double *val) |
|||
{ if (scan_token(dsa, across)) return 1; |
|||
if (strlen(dsa->token) == 0) |
|||
{ xprintf("%s:%d: missing number\n", dsa->fname, dsa->seqn); |
|||
return 1; |
|||
} |
|||
if (str2num(dsa->token, val)) |
|||
{ xprintf("%s:%d: number `%s' invalid\n", dsa->fname, dsa->seqn, |
|||
dsa->token); |
|||
return 1; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
TSP *tsp_read_data(char *fname) |
|||
{ struct dsa _dsa, *dsa = &_dsa; |
|||
TSP *tsp = NULL; |
|||
dsa->fname = fname; |
|||
xprintf("tsp_read_data: reading TSP data from `%s'...\n", |
|||
dsa->fname); |
|||
dsa->fp = fopen(dsa->fname, "r"); |
|||
if (dsa->fp == NULL) |
|||
{ xprintf("tsp_read_data: unable to open `%s' - %s\n", |
|||
dsa->fname, strerror(errno)); |
|||
goto fail; |
|||
} |
|||
tsp = xmalloc(sizeof(TSP)); |
|||
tsp->name = NULL; |
|||
tsp->type = TSP_UNDEF; |
|||
tsp->comment = NULL; |
|||
tsp->dimension = 0; |
|||
tsp->edge_weight_type = TSP_UNDEF; |
|||
tsp->edge_weight_format = TSP_UNDEF; |
|||
tsp->display_data_type = TSP_UNDEF; |
|||
tsp->node_x_coord = NULL; |
|||
tsp->node_y_coord = NULL; |
|||
tsp->dply_x_coord = NULL; |
|||
tsp->dply_y_coord = NULL; |
|||
tsp->tour = NULL; |
|||
tsp->edge_weight = NULL; |
|||
dsa->seqn = 1; |
|||
if (get_char(dsa)) goto fail; |
|||
loop: if (scan_keyword(dsa)) goto fail; |
|||
if (strcmp(dsa->token, "NAME") == 0) |
|||
{ if (tsp->name != NULL) |
|||
{ xprintf("%s:%d: NAME entry multiply defined\n", dsa->fname, |
|||
dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_token(dsa, 0)) goto fail; |
|||
if (strlen(dsa->token) == 0) |
|||
{ xprintf("%s:%d: NAME entry incomplete\n", dsa->fname, |
|||
dsa->seqn); |
|||
goto fail; |
|||
} |
|||
tsp->name = xmalloc(strlen(dsa->token) + 1); |
|||
strcpy(tsp->name, dsa->token); |
|||
xprintf("tsp_read_data: NAME: %s\n", tsp->name); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "TYPE") == 0) |
|||
{ if (tsp->type != TSP_UNDEF) |
|||
{ xprintf("%s:%d: TYPE entry multiply defined\n", dsa->fname, |
|||
dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_keyword(dsa)) goto fail; |
|||
if (strcmp(dsa->token, "TSP") == 0) |
|||
tsp->type = TSP_TSP; |
|||
else if (strcmp(dsa->token, "ATSP") == 0) |
|||
tsp->type = TSP_ATSP; |
|||
else if (strcmp(dsa->token, "TOUR") == 0) |
|||
tsp->type = TSP_TOUR; |
|||
else |
|||
{ xprintf("%s:%d: data type `%s' not recognized\n", |
|||
dsa->fname, dsa->seqn, dsa->token); |
|||
goto fail; |
|||
} |
|||
xprintf("tsp_read_data: TYPE: %s\n", dsa->token); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "COMMENT") == 0) |
|||
{ if (tsp->comment != NULL) |
|||
{ xprintf("%s:%d: COMMENT entry multiply defined\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_comment(dsa)) goto fail; |
|||
tsp->comment = xmalloc(strlen(dsa->token) + 1); |
|||
strcpy(tsp->comment, dsa->token); |
|||
xprintf("tsp_read_data: COMMENT: %s\n", tsp->comment); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "DIMENSION") == 0) |
|||
{ if (tsp->dimension != 0) |
|||
{ xprintf("%s:%d: DIMENSION entry multiply defined\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_integer(dsa, 0, &tsp->dimension)) goto fail; |
|||
if (tsp->dimension < 1) |
|||
{ xprintf("%s:%d: invalid dimension\n", dsa->fname, |
|||
dsa->seqn); |
|||
goto fail; |
|||
} |
|||
xprintf("tsp_read_data: DIMENSION: %d\n", tsp->dimension); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "EDGE_WEIGHT_TYPE") == 0) |
|||
{ if (tsp->edge_weight_type != TSP_UNDEF) |
|||
{ xprintf("%s:%d: EDGE_WEIGHT_TYPE entry multiply defined\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_keyword(dsa)) goto fail; |
|||
if (strcmp(dsa->token, "GEO") == 0) |
|||
tsp->edge_weight_type = TSP_GEO; |
|||
else if (strcmp(dsa->token, "EUC_2D") == 0) |
|||
tsp->edge_weight_type = TSP_EUC_2D; |
|||
else if (strcmp(dsa->token, "ATT") == 0) |
|||
tsp->edge_weight_type = TSP_ATT; |
|||
else if (strcmp(dsa->token, "EXPLICIT") == 0) |
|||
tsp->edge_weight_type = TSP_EXPLICIT; |
|||
else if (strcmp(dsa->token, "CEIL_2D") == 0) |
|||
tsp->edge_weight_type = TSP_CEIL_2D; |
|||
else |
|||
{ xprintf("%s:%d: edge weight type `%s' not recognized\n", |
|||
dsa->fname, dsa->seqn, dsa->token); |
|||
goto fail; |
|||
} |
|||
xprintf("tsp_read_data: EDGE_WEIGHT_TYPE: %s\n", dsa->token); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "EDGE_WEIGHT_FORMAT") == 0) |
|||
{ if (tsp->edge_weight_format != TSP_UNDEF) |
|||
{ xprintf( |
|||
"%s:%d: EDGE_WEIGHT_FORMAT entry multiply defined\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_keyword(dsa)) goto fail; |
|||
if (strcmp(dsa->token, "UPPER_ROW") == 0) |
|||
tsp->edge_weight_format = TSP_UPPER_ROW; |
|||
else if (strcmp(dsa->token, "FULL_MATRIX") == 0) |
|||
tsp->edge_weight_format = TSP_FULL_MATRIX; |
|||
else if (strcmp(dsa->token, "FUNCTION") == 0) |
|||
tsp->edge_weight_format = TSP_FUNCTION; |
|||
else if (strcmp(dsa->token, "LOWER_DIAG_ROW") == 0) |
|||
tsp->edge_weight_format = TSP_LOWER_DIAG_ROW; |
|||
else |
|||
{ xprintf("%s:%d: edge weight format `%s' not recognized\n", |
|||
dsa->fname, dsa->seqn, dsa->token); |
|||
goto fail; |
|||
} |
|||
xprintf("tsp_read_data: EDGE_WEIGHT_FORMAT: %s\n", dsa->token); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "DISPLAY_DATA_TYPE") == 0) |
|||
{ if (tsp->display_data_type != TSP_UNDEF) |
|||
{ xprintf("%s:%d: DISPLAY_DATA_TYPE entry multiply defined\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_colon(dsa)) goto fail; |
|||
if (scan_keyword(dsa)) goto fail; |
|||
if (strcmp(dsa->token, "COORD_DISPLAY") == 0) |
|||
tsp->display_data_type = TSP_COORD_DISPLAY; |
|||
else if (strcmp(dsa->token, "TWOD_DISPLAY") == 0) |
|||
tsp->display_data_type = TSP_TWOD_DISPLAY; |
|||
else |
|||
{ xprintf("%s:%d: display data type `%s' not recognized\n", |
|||
dsa->fname, dsa->seqn, dsa->token); |
|||
goto fail; |
|||
} |
|||
xprintf("tsp_read_data: DISPLAY_DATA_TYPE: %s\n", dsa->token); |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "NODE_COORD_SECTION") == 0) |
|||
{ int n = tsp->dimension, k, node; |
|||
if (n == 0) |
|||
{ xprintf("%s:%d: DIMENSION entry not specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (tsp->node_x_coord != NULL) |
|||
{ xprintf("%s:%d: NODE_COORD_SECTION multiply specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
tsp->node_x_coord = xcalloc(1+n, sizeof(double)); |
|||
tsp->node_y_coord = xcalloc(1+n, sizeof(double)); |
|||
for (node = 1; node <= n; node++) |
|||
tsp->node_x_coord[node] = tsp->node_y_coord[node] = DBL_MAX; |
|||
for (k = 1; k <= n; k++) |
|||
{ if (scan_integer(dsa, 0, &node)) goto fail; |
|||
if (!(1 <= node && node <= n)) |
|||
{ xprintf("%s:%d: invalid node number %d\n", dsa->fname, |
|||
dsa->seqn, node); |
|||
goto fail; |
|||
} |
|||
if (tsp->node_x_coord[node] != DBL_MAX) |
|||
{ xprintf("%s:%d: node number %d multiply specified\n", |
|||
dsa->fname, dsa->seqn, node); |
|||
goto fail; |
|||
} |
|||
if (scan_number(dsa, 0, &tsp->node_x_coord[node])) |
|||
goto fail; |
|||
if (scan_number(dsa, 0, &tsp->node_y_coord[node])) |
|||
goto fail; |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
} |
|||
else if (strcmp(dsa->token, "DISPLAY_DATA_SECTION") == 0) |
|||
{ int n = tsp->dimension, k, node; |
|||
if (n == 0) |
|||
{ xprintf("%s:%d: DIMENSION entry not specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (tsp->dply_x_coord != NULL) |
|||
{ xprintf("%s:%d: DISPLAY_DATA_SECTION multiply specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
tsp->dply_x_coord = xcalloc(1+n, sizeof(double)); |
|||
tsp->dply_y_coord = xcalloc(1+n, sizeof(double)); |
|||
for (node = 1; node <= n; node++) |
|||
tsp->dply_x_coord[node] = tsp->dply_y_coord[node] = DBL_MAX; |
|||
for (k = 1; k <= n; k++) |
|||
{ if (scan_integer(dsa, 0, &node)) goto fail; |
|||
if (!(1 <= node && node <= n)) |
|||
{ xprintf("%s:%d: invalid node number %d\n", dsa->fname, |
|||
dsa->seqn, node); |
|||
goto fail; |
|||
} |
|||
if (tsp->dply_x_coord[node] != DBL_MAX) |
|||
{ xprintf("%s:%d: node number %d multiply specified\n", |
|||
dsa->fname, dsa->seqn, node); |
|||
goto fail; |
|||
} |
|||
if (scan_number(dsa, 0, &tsp->dply_x_coord[node])) |
|||
goto fail; |
|||
if (scan_number(dsa, 0, &tsp->dply_y_coord[node])) |
|||
goto fail; |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
} |
|||
else if (strcmp(dsa->token, "TOUR_SECTION") == 0) |
|||
{ int n = tsp->dimension, k, node; |
|||
if (n == 0) |
|||
{ xprintf("%s:%d: DIMENSION entry not specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (tsp->tour != NULL) |
|||
{ xprintf("%s:%d: TOUR_SECTION multiply specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
tsp->tour = xcalloc(1+n, sizeof(int)); |
|||
for (k = 1; k <= n; k++) |
|||
{ if (scan_integer(dsa, 1, &node)) goto fail; |
|||
if (!(1 <= node && node <= n)) |
|||
{ xprintf("%s:%d: invalid node number %d\n", dsa->fname, |
|||
dsa->seqn, node); |
|||
goto fail; |
|||
} |
|||
tsp->tour[k] = node; |
|||
} |
|||
if (scan_integer(dsa, 1, &node)) goto fail; |
|||
if (node != -1) |
|||
{ xprintf("%s:%d: extra node(s) detected\n", dsa->fname, |
|||
dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "EDGE_WEIGHT_SECTION") == 0) |
|||
{ int n = tsp->dimension, i, j, temp; |
|||
if (n == 0) |
|||
{ xprintf("%s:%d: DIMENSION entry not specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (tsp->edge_weight_format == TSP_UNDEF) |
|||
{ xprintf("%s:%d: EDGE_WEIGHT_FORMAT entry not specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (tsp->edge_weight != NULL) |
|||
{ xprintf("%s:%d: EDGE_WEIGHT_SECTION multiply specified\n", |
|||
dsa->fname, dsa->seqn); |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
tsp->edge_weight = xcalloc(1+n*n, sizeof(int)); |
|||
switch (tsp->edge_weight_format) |
|||
{ case TSP_FULL_MATRIX: |
|||
for (i = 1; i <= n; i++) |
|||
{ for (j = 1; j <= n; j++) |
|||
{ if (scan_integer(dsa, 1, &temp)) goto fail; |
|||
tsp->edge_weight[(i - 1) * n + j] = temp; |
|||
} |
|||
} |
|||
break; |
|||
case TSP_UPPER_ROW: |
|||
for (i = 1; i <= n; i++) |
|||
{ tsp->edge_weight[(i - 1) * n + i] = 0; |
|||
for (j = i + 1; j <= n; j++) |
|||
{ if (scan_integer(dsa, 1, &temp)) goto fail; |
|||
tsp->edge_weight[(i - 1) * n + j] = temp; |
|||
tsp->edge_weight[(j - 1) * n + i] = temp; |
|||
} |
|||
} |
|||
break; |
|||
case TSP_LOWER_DIAG_ROW: |
|||
for (i = 1; i <= n; i++) |
|||
{ for (j = 1; j <= i; j++) |
|||
{ if (scan_integer(dsa, 1, &temp)) goto fail; |
|||
tsp->edge_weight[(i - 1) * n + j] = temp; |
|||
tsp->edge_weight[(j - 1) * n + i] = temp; |
|||
} |
|||
} |
|||
break; |
|||
default: |
|||
goto fail; |
|||
} |
|||
if (check_newline(dsa)) goto fail; |
|||
} |
|||
else if (strcmp(dsa->token, "EOF") == 0) |
|||
{ if (check_newline(dsa)) goto fail; |
|||
goto done; |
|||
} |
|||
else |
|||
{ xprintf("%s:%d: keyword `%s' not recognized\n", dsa->fname, |
|||
dsa->seqn, dsa->token); |
|||
goto fail; |
|||
} |
|||
goto loop; |
|||
done: xprintf("tsp_read_data: %d lines were read\n", dsa->seqn-1); |
|||
fclose(dsa->fp); |
|||
return tsp; |
|||
fail: if (tsp != NULL) |
|||
{ if (tsp->name != NULL) xfree(tsp->name); |
|||
if (tsp->comment != NULL) xfree(tsp->comment); |
|||
if (tsp->node_x_coord != NULL) xfree(tsp->node_x_coord); |
|||
if (tsp->node_y_coord != NULL) xfree(tsp->node_y_coord); |
|||
if (tsp->dply_x_coord != NULL) xfree(tsp->dply_x_coord); |
|||
if (tsp->dply_y_coord != NULL) xfree(tsp->dply_y_coord); |
|||
if (tsp->tour != NULL) xfree(tsp->tour); |
|||
if (tsp->edge_weight != NULL) xfree(tsp->edge_weight); |
|||
xfree(tsp); |
|||
} |
|||
if (dsa->fp != NULL) fclose(dsa->fp); |
|||
return NULL; |
|||
} |
|||
|
|||
/*---------------------------------------------------------------------- |
|||
-- tsp_free_data - free TSP instance data. |
|||
-- |
|||
-- *Synopsis* |
|||
-- |
|||
-- #include "glptsp.h" |
|||
-- void tsp_free_data(TSP *tsp); |
|||
-- |
|||
-- *Description* |
|||
-- |
|||
-- The routine tsp_free_data frees all the memory allocated to the TSP |
|||
-- instance data block, which the parameter tsp points to. */ |
|||
|
|||
void tsp_free_data(TSP *tsp) |
|||
{ if (tsp->name != NULL) xfree(tsp->name); |
|||
if (tsp->comment != NULL) xfree(tsp->comment); |
|||
if (tsp->node_x_coord != NULL) xfree(tsp->node_x_coord); |
|||
if (tsp->node_y_coord != NULL) xfree(tsp->node_y_coord); |
|||
if (tsp->dply_x_coord != NULL) xfree(tsp->dply_x_coord); |
|||
if (tsp->dply_y_coord != NULL) xfree(tsp->dply_y_coord); |
|||
if (tsp->tour != NULL) xfree(tsp->tour); |
|||
if (tsp->edge_weight != NULL) xfree(tsp->edge_weight); |
|||
xfree(tsp); |
|||
return; |
|||
} |
|||
|
|||
/*---------------------------------------------------------------------- |
|||
-- tsp_distance - compute distance between two nodes. |
|||
-- |
|||
-- *Synopsis* |
|||
-- |
|||
-- #include "glptsp.h" |
|||
-- int tsp_distance(TSP *tsp, int i, int j); |
|||
-- |
|||
-- *Description* |
|||
-- |
|||
-- The routine tsp_distance computes the distance between i-th and j-th |
|||
-- nodes for the TSP instance, which tsp points to. |
|||
-- |
|||
-- *Returns* |
|||
-- |
|||
-- The routine tsp_distance returns the computed distance. */ |
|||
|
|||
#define nint(x) ((int)((x) + 0.5)) |
|||
|
|||
static double rad(double x) |
|||
{ /* convert input coordinate to longitude/latitude, in radians */ |
|||
double pi = 3.141592, deg, min; |
|||
deg = (int)x; |
|||
min = x - deg; |
|||
return pi * (deg + 5.0 * min / 3.0) / 180.0; |
|||
} |
|||
|
|||
int tsp_distance(TSP *tsp, int i, int j) |
|||
{ int n = tsp->dimension, dij; |
|||
if (!(tsp->type == TSP_TSP || tsp->type == TSP_ATSP)) |
|||
xfault("tsp_distance: invalid TSP instance\n"); |
|||
if (!(1 <= i && i <= n && 1 <= j && j <= n)) |
|||
xfault("tsp_distance: node number out of range\n"); |
|||
switch (tsp->edge_weight_type) |
|||
{ case TSP_UNDEF: |
|||
xfault("tsp_distance: edge weight type not specified\n"); |
|||
case TSP_EXPLICIT: |
|||
if (tsp->edge_weight == NULL) |
|||
xfault("tsp_distance: edge weights not specified\n"); |
|||
dij = tsp->edge_weight[(i - 1) * n + j]; |
|||
break; |
|||
case TSP_EUC_2D: |
|||
if (tsp->node_x_coord == NULL || tsp->node_y_coord == NULL) |
|||
xfault("tsp_distance: node coordinates not specified\n"); |
|||
{ double xd, yd; |
|||
xd = tsp->node_x_coord[i] - tsp->node_x_coord[j]; |
|||
yd = tsp->node_y_coord[i] - tsp->node_y_coord[j]; |
|||
dij = nint(sqrt(xd * xd + yd * yd)); |
|||
} |
|||
break; |
|||
case TSP_CEIL_2D: |
|||
if (tsp->node_x_coord == NULL || tsp->node_y_coord == NULL) |
|||
xfault("tsp_distance: node coordinates not specified\n"); |
|||
{ double xd, yd; |
|||
xd = tsp->node_x_coord[i] - tsp->node_x_coord[j]; |
|||
yd = tsp->node_y_coord[i] - tsp->node_y_coord[j]; |
|||
dij = (int)ceil(sqrt(xd * xd + yd * yd)); |
|||
} |
|||
break; |
|||
case TSP_GEO: |
|||
if (tsp->node_x_coord == NULL || tsp->node_y_coord == NULL) |
|||
xfault("tsp_distance: node coordinates not specified\n"); |
|||
{ double rrr = 6378.388; |
|||
double latitude_i = rad(tsp->node_x_coord[i]); |
|||
double latitude_j = rad(tsp->node_x_coord[j]); |
|||
double longitude_i = rad(tsp->node_y_coord[i]); |
|||
double longitude_j = rad(tsp->node_y_coord[j]); |
|||
double q1 = cos(longitude_i - longitude_j); |
|||
double q2 = cos(latitude_i - latitude_j); |
|||
double q3 = cos(latitude_i + latitude_j); |
|||
dij = (int)(rrr * acos(0.5 * ((1.0 + q1) * q2 - |
|||
(1.0 - q1) *q3)) + 1.0); |
|||
} |
|||
break; |
|||
case TSP_ATT: |
|||
if (tsp->node_x_coord == NULL || tsp->node_y_coord == NULL) |
|||
xfault("tsp_distance: node coordinates not specified\n"); |
|||
{ int tij; |
|||
double xd, yd, rij; |
|||
xd = tsp->node_x_coord[i] - tsp->node_x_coord[j]; |
|||
yd = tsp->node_y_coord[i] - tsp->node_y_coord[j]; |
|||
rij = sqrt((xd * xd + yd * yd) / 10.0); |
|||
tij = nint(rij); |
|||
if (tij < rij) dij = tij + 1; else dij = tij; |
|||
} |
|||
break; |
|||
default: |
|||
xassert(tsp->edge_weight_type != tsp->edge_weight_type); |
|||
} |
|||
return dij; |
|||
} |
|||
|
|||
/* eof */ |
@ -1,3 +1,188 @@ |
|||
Sun Nov 08 12:00:00 2015 Andrew Makhorin <mao@gnu.org> |
|||
|
|||
* GLPK 4.57 (38:0:2) has been released. |
|||
|
|||
* src/simplex/spy*.* |
|||
New, more efficient implementation of the dual simplex method |
|||
was included in the package. |
|||
|
|||
* src/simplex/spxprim.c |
|||
Incorrect directive #ifdef USE_AT was changed to #if USE_AT. |
|||
|
|||
* src/simplex/simplex.h |
|||
New header for simplex-based drivers was added. |
|||
|
|||
* src/glpspx02.c |
|||
Old implementation of the dual simplex method was removed from |
|||
the package. |
|||
|
|||
* src/glpspx.h |
|||
Old header for simplex-based drivers was removed. |
|||
|
|||
* src/glpapi06.c |
|||
Call to spx_dual was changed to spy_dual. |
|||
tol_piv = 1e-10 in glp_init_smcp was changed to 1e-9 (this new |
|||
tolerance seems to be more adequate for new implementations of |
|||
the primal and dual simplex methods). |
|||
|
|||
* src/glpk.h, src/glpapi09.c, src/glpios03.c |
|||
Option iocp.sr_heur to enable/disable simple rounding heuristic |
|||
was added. Thanks to Chris Matrakidis <cmatraki@gmail.com> for |
|||
suggestion. |
|||
|
|||
* src/env/env.h src/env/error.c |
|||
API routine glp_at_error was added and documented. Thanks to |
|||
Jeroen Demeyer <jdemeyer@cage.ugent.be> for suggestion. |
|||
|
|||
* src/glpapi19.c |
|||
Translation of MiniSat solver (src/minisat) from C++ to C is |
|||
made by a non-skilled programmer who converts pointers to ints |
|||
and vice versa, so MiniSat works on 32-bit platforms only. |
|||
Fixing this portability issue would require rewriting the code, |
|||
so currently to prevent crashing the API routine glp_minisat1 |
|||
was changed just to report failure if 64-bit version of GLPK is |
|||
used. Thanks to Heinrich Schuchardt <xypron.glpk@gmx.de> for |
|||
bug report. |
|||
|
|||
* doc/glpk.tex, doc/gmpl.tex |
|||
Some material was added according to changes in GLPK API. |
|||
Also some minor typos were corrected. Thanks to Anton Voropaev |
|||
<anton.n.voropaev@gmail.com> for typo report. |
|||
|
|||
* w32/makefiles, w64/makefiles |
|||
Option /Zi was added to pass to MSVC compiler. |
|||
|
|||
examples/tsp/*.* |
|||
An example application program TSPSOL was added. This program |
|||
is intended to solve the Symmetric Traveling Salesman Problem. |
|||
For more details see examples/tsp/README. |
|||
|
|||
Thu Oct 01 12:00:00 2015 Andrew Makhorin <mao@gnu.org> |
|||
|
|||
* GLPK 4.56 (37:3:1) has been released. |
|||
|
|||
* src/simplex/*.c, *.h |
|||
New, more efficient and robust implementation of the primal |
|||
simplex method was included in the package. |
|||
|
|||
* src/glpspx01.c |
|||
Old implementation of the primal simplex method was removed |
|||
from the package. |
|||
|
|||
* src/bflib/sgf.c |
|||
A bug was fixed in routine sgf_reduce_nuc. (The bug appeared if |
|||
the basis matrix was structurally singular.) Thanks to Martin |
|||
Jacob <mj@bahntechnik.de> for bug report. |
|||
|
|||
* w32/*.*, w64/*.* |
|||
Scripts to build GLPK with Microsoft Visual Studio 2015 were |
|||
added. Thanks to Xypron <xypron.glpk@gmx.de> for contribution |
|||
and testing. |
|||
|
|||
Fri Aug 22 12:00:00 2014 Andrew Makhorin <mao@gnu.org> |
|||
|
|||
* GLPK 4.55 (37:2:1) has been released. |
|||
|
|||
* src/bflib/luf.c, src/bflib/luf.h |
|||
Two routines luf_vt_solve1 and luf_estimate_norm were added to |
|||
estimate 1-norm of matrix inverse. |
|||
|
|||
* src/bflib/btf.c, src/bflib/btf.h |
|||
Two routines btf_at_solve1 and btf_estimate_norm were added to |
|||
estimate 1-norm of block triangular matrix inverse. |
|||
|
|||
* src/bflib/fhvint.c, src/bflib/fhvint.h |
|||
The routine fhvint_estimate was added to estimate 1-norm of the |
|||
basis matrix inverse (FHV-factorization). |
|||
|
|||
* src/bflib/scfint.c, src/bflib/scfint.h |
|||
The routine scfint_estimate was added to estimate 1-norm of the |
|||
basis matrix inverse (Schur-complement-based factorization). |
|||
|
|||
* src/bfd.c, src/bfd.c |
|||
The routine bfd_condest was added to estimate the condition of |
|||
the basis matrix. |
|||
|
|||
* src/bflib/scfint.h |
|||
The prefix '_glp' was added to keep the namespace clean. |
|||
|
|||
* src/env/stream.c |
|||
Two open modes "a" and "ab" were added. Thanks to Pedro P. Wong |
|||
<d00604@taipower.com.tw> for bug report. |
|||
|
|||
* src/glpapi21.c (glpsol) |
|||
Minor bug was fixed (command-line options --btf, --cbg, --cgr |
|||
didn't work properly). |
|||
|
|||
* src/bflib/sgf.c |
|||
A serious bug was fixed in a basis factorization routine used |
|||
on the dense phase. (The bug might appear only if the number of |
|||
rows exceeded sqrt(2**31) ~= 46,340 and caused access violtaion |
|||
exception because of integer overflow.) Thanks to Mark Meketon |
|||
<Marc.Meketon@oliverwyman.com> for bug report. |
|||
|
|||
* doc/glpk.tex |
|||
Two API routines glp_alloc and glp_realloc were documented. |
|||
Thanks to Brian Gladman <brg@gladman.plus.com> for suggestion. |
|||
|
|||
* doc/gmpl_es.tex, doc/gmpl_es.pdf |
|||
Translation of the document "Modeling Language GNU MathProg" |
|||
to Spanish was included (in LaTeX and pdf formats). Thanks to |
|||
Pablo Yapura <ypf@agro.unlp.edu.ar> for contribution. |
|||
|
|||
Fri Mar 28 12:00:00 2014 Andrew Makhorin <mao@gnu.org> |
|||
|
|||
* GLPK 4.54 (37:1:1) has been released. |
|||
|
|||
* src/bflib/fhvint.h, fhvint.c |
|||
Some technical changes were made. |
|||
|
|||
* src/bflib/btf.h, btf.c, btfint.h, btfint.c |
|||
The module BTF was added to the package. It implements sparse |
|||
block triangular factorization of a square non-singular matrix |
|||
and is based on LU-factorization (see the LUF module). |
|||
|
|||
* src/bflib/scf.h, scf.c, scfint.h, scfint.c |
|||
The module SCF was added to the package. It implements sparse |
|||
factorization of a square non-singular matrix based on Schur |
|||
complement and LU-factorization (plain or block triangular; see |
|||
the LUF and BTF modules). |
|||
|
|||
* src/bfd.c |
|||
LP basis factorization driver was changed to use most recent |
|||
versions of the FHV and SCF modules. |
|||
|
|||
* src/glplpf.h, glplpf.c |
|||
Old version of the Schur-complement-based factorization module |
|||
was removed from the package. |
|||
|
|||
* src/glpk.h |
|||
New flags GLP_BF_LUF, GLP_BF_BTF were added for glp_bfcp. |
|||
|
|||
* src/glpapi12.c |
|||
The API routines glp_get_bfcp, glp_set_bfcp were replaced due |
|||
to new version of the BFD module. |
|||
|
|||
* src/glpapi21.c |
|||
New command-line options --luf, --btf, --ft, --cbg, and --cgr |
|||
were added for the glpsol solver. |
|||
|
|||
* src/* |
|||
According to a new version of the GNU Coding Standards in all |
|||
messages a grave accent character (`) was replaced by a single |
|||
apostrophe character ('). |
|||
|
|||
* src/glpapi09.c mip status bug was fixed. Thanks to Remy Roy |
|||
<remyroyster@gmail.com> for bug report. |
|||
|
|||
* doc/glpk.tex |
|||
Some comments about invalidating the basis factorization were |
|||
added. Thanks to Xypron <xypron.glpk@gmx.de> for suggestion. |
|||
|
|||
* configure.ac |
|||
"iodbc-config --cflags" was added to detect iodbc flags. Thanks |
|||
to Sebastien Villemot <sebastien@debian.org> for patch. |
|||
|
|||
Thu Feb 13 12:00:00 2014 Andrew Makhorin <mao@gnu.org> |
|||
|
|||
* GLPK 4.53 (37:0:1) has been released. |
@ -1,3 +1,103 @@ |
|||
GLPK 4.57 (release date: Nov 08, 2015) |
|||
|
|||
A new, more efficient implementation of the dual simplex method |
|||
was included in the package. This new implementation replaces |
|||
the old one, which was removed. |
|||
|
|||
Option sr_heur was added to struct glp_iocp to enable/disable |
|||
the simple rounding heuristic used by the MIP solver. Thanks to |
|||
Chris Matrakidis <cmatraki@gmail.com> for suggestion. |
|||
|
|||
New API routine glp_at_error was added and documented. Thanks |
|||
to Jeroen Demeyer <jdemeyer@cage.ugent.be> for suggestion. |
|||
|
|||
Some minor typos were corrected in the GLPK documentation. |
|||
Thanks to Anton Voropaev <anton.n.voropaev@gmail.com> for typo |
|||
report. |
|||
|
|||
An example application program TSPSOL was added. It uses the |
|||
GLPK MIP optimizer to solve the Symmetric Traveling Salesman |
|||
Problem and illustrates "lazy" constraints generation. For more |
|||
details please see glpk/examples/tsp/README. |
|||
|
|||
GLPK 4.56 (release date: Oct 01, 2015) |
|||
|
|||
A new, more efficient and more robust implementation of the |
|||
primal simplex method was included in the package. This new |
|||
implementation replaces the old one, which was removed. |
|||
|
|||
A bug was fixed in a basis factorization routine. (The bug |
|||
appeared if the basis matrix was structurally singular having |
|||
duplicate row and/or column singletons.) Thanks to Martin Jacob |
|||
<mj@bahntechnik.de> for bug report. |
|||
|
|||
Scripts to build GLPK with Microsoft Visual Studio 2015 were |
|||
added. Thanks to Xypron <xypron.glpk@gmx.de> for contribution |
|||
and testing. |
|||
|
|||
GLPK 4.55 (release date: Aug 22, 2014) |
|||
|
|||
Some internal (non-API) routines to estimate the condition of |
|||
the basis matrix were added. These routines are mainly intended |
|||
to be used by the simplex-based solvers. |
|||
|
|||
Two open modes "a" and "ab" were added to GLPK I/O routines. |
|||
Thanks to Pedro P. Wong <d00604@taipower.com.tw> for bug report. |
|||
|
|||
Minor bug was fixed in the solver glpsol (command-line options |
|||
--btf, --cbg, and --cgr didn't work properly). |
|||
|
|||
A serious bug was fixed in a basis factorization routine used |
|||
on the dense phase. (The bug might appear only if the number of |
|||
rows exceeded sqrt(2**31) ~= 46,340 and caused access violation |
|||
exception because of integer overflow.) Thanks to Mark Meketon |
|||
<Marc.Meketon@oliverwyman.com> for bug report. |
|||
|
|||
Two API routines glp_alloc and glp_realloc were documented. |
|||
Thanks to Brian Gladman <brg@gladman.plus.com> for suggestion. |
|||
|
|||
Translation of the document "Modeling Language GNU MathProg" |
|||
to Spanish was included (in LaTeX and pdf formats). Thanks to |
|||
Pablo Yapura <ypf@agro.unlp.edu.ar> for contribution. |
|||
|
|||
GLPK 4.54 (release date: Mar 28, 2014) |
|||
|
|||
Block-triangular LU-factorization was implemented to be used |
|||
on computing an initial factorization of the basis matrix. |
|||
|
|||
A new version of the Schur-complement-based factorization |
|||
module was included in the package. Now it can be used along |
|||
with plain as well as with block-triangular LU-factorization. |
|||
|
|||
Currently the following flags can be used to specify the type |
|||
of the basis matrix factorization (glp_bfcp.type): |
|||
|
|||
GLP_BF_LUF + GLP_BF_FT LUF, Forrest-Tomlin update (default) |
|||
GLP_BF_LUF + GLP_BF_BG LUF, Schur complement, Bartels-Golub |
|||
update |
|||
GLP_BF_LUF + GLP_BF_GR LUF, Schur complement, Givens rotation |
|||
update |
|||
GLP_BF_BTF + GLP_BF_BG BTF, Schur complement, Bartels-Golub |
|||
update |
|||
GLP_BF_BTF + GLP_BF_GR BTF, Schur complement, Givens rotation |
|||
update |
|||
|
|||
In case of GLP_BF_FT the update is applied to matrix U, while |
|||
in cases of GLP_BF_BG and GLP_BF_GR the update is applied to |
|||
the Schur complement. |
|||
|
|||
Corresponding new options --luf and --btf were added to glpsol. |
|||
|
|||
For more details please see a new edition of the GLPK reference |
|||
manual included in the distribution. |
|||
|
|||
A minor bug (in reporting the mip solution status) was fixed. |
|||
Thanks to Remy Roy <remyroyster@gmail.com> for bug report. |
|||
|
|||
A call to "iodbc-config --cflags" was added in configure.ac |
|||
to correctly detect iodbc flags. Thanks to Sebastien Villemot |
|||
<sebastien@debian.org> for patch. |
|||
|
|||
GLPK 4.53 (release date: Feb 13, 2014) |
|||
|
|||
The API routine glp_read_mps was changed to remove free rows. |
@ -1,11 +1,11 @@ |
|||
Olga K. gewidmet |
|||
|
|||
GLPK (GNU Linear Programming Kit) Version 4.53 |
|||
GLPK (GNU Linear Programming Kit) Version 4.57 |
|||
|
|||
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
|||
2009, 2010, 2011, 2013, 2014 Andrew Makhorin, Department for Applied |
|||
Informatics, Moscow Aviation Institute, Moscow, Russia. All rights |
|||
reserved. E-mail: <mao@gnu.org>. |
|||
2009, 2010, 2011, 2013, 2014, 2015 Andrew Makhorin, Department for |
|||
Applied Informatics, Moscow Aviation Institute, Moscow, Russia. All |
|||
rights reserved. E-mail: <mao@gnu.org>. |
|||
|
|||
GLPK is part of the GNU Project released under the aegis of GNU. |
|||
|
3233
resources/3rdparty/glpk-4.57/doc/gmpl_es.tex
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,282 @@ |
|||
*NAME: ALLOY |
|||
*ROWS: 22 |
|||
*COLUMNS: 20 |
|||
*NONZERO: 203 |
|||
*OPT SOLN: 2149.247891 |
|||
*SOURCE: Linear Programming--Aluminium Alloy Blending |
|||
* Data Processing Application. N.Y.: IBM Corp. |
|||
*APPLICATION: Aluminium Alloy Blending |
|||
*COMMENTS: fixed MPS format |
|||
* encoded by Andrew Makhorin <mao@gnu.org> |
|||
* |
|||
NAME ALLOY |
|||
ROWS |
|||
N COST $ Cost $ |
|||
G ZN $ Zinc Minimum lbs |
|||
L ZX $ Zinc Maximum lbs |
|||
G CN $ Copper Minimum lbs |
|||
L CX $ Copper Maximum lbs |
|||
G MN $ Magnesium Minimum lbs |
|||
L MX $ Magnesium Maximum lbs |
|||
G CHN $ Chromium Minimum lbs |
|||
L CHX $ Chromium Maximum lbs |
|||
G BN $ Beryllium Minimum lbs |
|||
L BX $ Beryllium Maximum lbs |
|||
L IX $ Iron Maximum lbs |
|||
L SX $ Silicon Maximum lbs |
|||
L MGX $ Manganese Maximum lbs |
|||
L NX $ Nickel Maximum lbs |
|||
L TX $ Titanium Maximum lbs |
|||
L LX $ Lead Maximum lbs |
|||
L TNX $ Tin Maximum lbs |
|||
L BIX $ Bismuth Maximum lbs |
|||
L GX $ General Impurities lbs |
|||
L SCX $ Scrap 1 Limit lbs |
|||
G FL $ Furnance Load lbs |
|||
COLUMNS |
|||
* Pure Aluminium 1 |
|||
A1 COST .28 |
|||
IX .0004 |
|||
SX .0005 |
|||
FL 1.0 |
|||
* Pure Aluminium 2 |
|||
A2 COST .26 |
|||
IX .0006 |
|||
SX .0006 |
|||
FL 1.0 |
|||
* Pure Aluminium 3 |
|||
A3 COST .25 |
|||
IX .0011 |
|||
SX .0007 |
|||
FL 1.0 |
|||
* Pure Aluminium 4 |
|||
A4 COST .23 |
|||
IX .0026 |
|||
SX .0012 |
|||
FL 1.0 |
|||
* Pure Copper |
|||
C COST .31 |
|||
CN 1.00 |
|||
CX 1.00 |
|||
FL 1.0 |
|||
* Pure Magnesium |
|||
M COST .38 |
|||
MN 1.00 |
|||
MX 1.00 |
|||
FL 1.0 |
|||
* Beryllium/Aluminium Alloy |
|||
B/A COST 3.60 |
|||
BN 0.0600 |
|||
BX 0.0600 |
|||
FL 1.0 |
|||
* Pure Zinc |
|||
Z COST .22 |
|||
ZN .95 |
|||
ZX .95 |
|||
FL 1.0 |
|||
* Chromium Aluminium Alloy |
|||
C/A COST .27 |
|||
CHN .0300 |
|||
CHX .0300 |
|||
FL 1.0 |
|||
* Scrap 1 |
|||
SC1 COST .21 |
|||
ZN .0009 |
|||
ZX .0009 |
|||
CN .0444 |
|||
CX .0444 |
|||
MN .0042 |
|||
MX .0042 |
|||
CHN .0001 |
|||
CHX .0001 |
|||
IX .0024 |
|||
SX .0101 |
|||
MGX .0079 |
|||
NX .0001 |
|||
TX .0004 |
|||
LX .0001 |
|||
TNX .0001 |
|||
GX .0001 |
|||
SCX 1.00 |
|||
FL 1.0 |
|||
* Scrap 2 |
|||
SC2 COST .20 |
|||
ZN .0012 |
|||
ZX .0012 |
|||
CN .0026 |
|||
CX .0026 |
|||
MN .0060 |
|||
MX .0060 |
|||
CHN .0018 |
|||
CHX .0018 |
|||
IX .0026 |
|||
SX .0106 |
|||
MGX .0003 |
|||
NX .0002 |
|||
TX .0004 |
|||
LX .0001 |
|||
TNX .0001 |
|||
GX .0002 |
|||
FL 1.0 |
|||
* Scrap 3 |
|||
SC3 COST .21 |
|||
ZN .0568 |
|||
ZX .0568 |
|||
CN .0152 |
|||
CX .0152 |
|||
MN .0248 |
|||
MX .0248 |
|||
CHN .0020 |
|||
CHX .0020 |
|||
IX .0016 |
|||
SX .0013 |
|||
MGX .0005 |
|||
TX .0004 |
|||
LX .0003 |
|||
TNX .0003 |
|||
FL 1.0 |
|||
* Scrap 4 |
|||
SC4 COST .20 |
|||
ZN .0563 |
|||
ZX .0563 |
|||
CN .0149 |
|||
CX .0149 |
|||
MN .0238 |
|||
MX .0238 |
|||
CHN .0019 |
|||
CHX .0019 |
|||
IX .0019 |
|||
SX .0011 |
|||
MGX .0004 |
|||
TX .0004 |
|||
LX .0003 |
|||
TNX .0003 |
|||
FL 1.0 |
|||
* Scrap 5 |
|||
SC5 COST .21 |
|||
ZN .0460 |
|||
ZX .0460 |
|||
CN .0071 |
|||
CX .0071 |
|||
MN .0343 |
|||
MX .0343 |
|||
CHN .0013 |
|||
CHX .0013 |
|||
IX .0017 |
|||
SX .0013 |
|||
MGX .0018 |
|||
TX .0002 |
|||
LX .0002 |
|||
TNX .0002 |
|||
FL 1.0 |
|||
* Scrap 6 |
|||
SC6 COST .20 |
|||
ZN .0455 |
|||
ZX .0455 |
|||
CN .0071 |
|||
CX .0071 |
|||
MN .0343 |
|||
MX .0343 |
|||
IX .0016 |
|||
SX .0011 |
|||
MGX .0017 |
|||
TX .0002 |
|||
LX .0002 |
|||
TNX .0002 |
|||
FL 1.0 |
|||
* Scrap 7 |
|||
SC7 COST .21 |
|||
ZN .0009 |
|||
ZX .0009 |
|||
CN .0447 |
|||
CX .0447 |
|||
MN .0143 |
|||
MX .0143 |
|||
IX .0026 |
|||
SX .0013 |
|||
MGX .0052 |
|||
TX .0003 |
|||
LX .0001 |
|||
TNX .0001 |
|||
FL 1.0 |
|||
* Scrap 8 |
|||
SC8 COST .20 |
|||
ZN .0006 |
|||
ZX .0006 |
|||
CN .0623 |
|||
CX .0623 |
|||
IX .0017 |
|||
SX .0010 |
|||
MGX .0025 |
|||
TX .0005 |
|||
LX .0001 |
|||
TNX .0001 |
|||
GX .0025 |
|||
FL 1.0 |
|||
* Scrap 9 |
|||
SC9 COST .21 |
|||
ZN .0009 |
|||
ZX .0009 |
|||
CN .0034 |
|||
CX .0034 |
|||
MN .0093 |
|||
MX .0093 |
|||
CHN .0019 |
|||
CHX .0019 |
|||
IX .0030 |
|||
SX .0062 |
|||
MGX .0002 |
|||
TX .0003 |
|||
BIX .0005 |
|||
FL 1.0 |
|||
* Scrap 10 |
|||
SC10 COST .20 |
|||
ZN .0008 |
|||
ZX .0008 |
|||
CN .0003 |
|||
CX .0003 |
|||
MN .0249 |
|||
MX .0249 |
|||
CHN .0016 |
|||
CHX .0016 |
|||
IX .0015 |
|||
SX .0011 |
|||
MGX .0002 |
|||
FL 1.0 |
|||
* Scrap 11 |
|||
SC11 COST .21 |
|||
ZN .0675 |
|||
ZX .0675 |
|||
CN .0195 |
|||
CX .0195 |
|||
MN .0265 |
|||
MX .0265 |
|||
CHN .0020 |
|||
CHX .0020 |
|||
IX .0014 |
|||
SX .0008 |
|||
MGX .0002 |
|||
FL 1.0 |
|||
RHS |
|||
ZN 555. |
|||
ZX 590. |
|||
CN 140.0 |
|||
CX 190.0 |
|||
MN 245.0 |
|||
MX 275.0 |
|||
CHN 19.0 |
|||
CHX 22.0 |
|||
BN 2.0 |
|||
BX 4.0 |
|||
IX 15.0 |
|||
SX 10.0 |
|||
MGX 3.0 |
|||
NX 2.0 |
|||
TX 2.0 |
|||
LX 2.0 |
|||
TNX 2.0 |
|||
BIX 8.0 |
|||
GX 8.0 |
|||
SCX 900.0 |
|||
FL 10000. |
|||
ENDATA |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue