Skip to content

Commit

Permalink
Merge branch 'sassy-with-nauty' into 'master'
Browse files Browse the repository at this point in the history
Interface for sassy+nauty

See merge request integer/scip!3036
  • Loading branch information
GioniMexi committed Jun 27, 2023
2 parents 02b6c3a + 410d952 commit 9ccd2cf
Show file tree
Hide file tree
Showing 7 changed files with 1,741 additions and 23 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Interface changes
The value of scip_options is expected to be a sequence of parameter names and values, separated by a space, e.g.,
`option scip_options 'limits/time 10 display/verblevel 1';`.
String values should not be quoted and spaces in string values are not supported.
- sassy can be used now as preprocessor for nauty/traces

### Changed parameters

Expand Down Expand Up @@ -128,14 +129,16 @@ Build system
### Cmake

- New flag -DLAPACK=on for linking with Lapack (must be available in the system)
- added flag option "SYM=sassy" for using sassy/bliss as a graph automorphism package
- use SYM=sassy by default, since sassy and bliss are now shipped with SCIP.
- added flag option "SYM=sbliss" for using sassy/bliss as a graph automorphism package
- use SYM=sbliss by default, since sassy and bliss are now shipped with SCIP.
- added flag option "SYM=snauty" for using sassy/nauty as a graph automorphism package

### Makefile

- added flag option "nauty" for SYM variable to specify which graph automorphism package should be used
- added flag option "sassy" for SYM variable to specify which graph automorphism package should be used
- use SYM=sassy by default, since sassy and bliss are now shipped with SCIP
- added flag option "sbliss" (sassy/bliss) for SYM variable to specify which graph automorphism package should be used
- added flag option "snauty" (sassy/nauty) for SYM variable to specify which graph automorphism package should be used
- use SYM=sbliss by default, since sassy and bliss are now shipped with SCIP
- New flag LAPACK for linking with Lapack (must be available in the system)
- A file scip/config.h is created in the build directory ($(OBJDIR)/include) now.
Defining NO_CONFIG_HEADER is no longer necessary and has no effect anymore.
Expand Down
53 changes: 44 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ set_property(CACHE EXPRINT PROPERTY STRINGS none cppad ) #define list of values
set(LPS spx CACHE STRING "options for LP solver") #create the variable
set_property(CACHE LPS PROPERTY STRINGS spx cpx grb xprs clp glop msk qso none ) #define list of values GUI will offer for the variable

set(SYM sassy CACHE STRING "options for symmetry computation") #create the variable
set_property(CACHE SYM PROPERTY STRINGS bliss sassy nauty none ) #define list of values GUI will offer for the variable
set(SYM sbliss CACHE STRING "options for symmetry computation") #create the variable
set_property(CACHE SYM PROPERTY STRINGS bliss sbliss nauty snauty none ) #define list of values GUI will offer for the variable

if(NOT (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel"))
message(FATAL_ERROR "You have not selected a valid CMAKE_BUILD_TYPE. Please select 'Release' or 'Debug'.")
Expand Down Expand Up @@ -147,11 +147,11 @@ if(SYM STREQUAL "bliss")
set(BLISS_TARGET libbliss)
set(SYM_LIBRARIES libbliss)
set(SYM_PIC_LIBRARIES libbliss)
elseif(SYM STREQUAL "sassy")
message(STATUS "Support SYM: sassy")
set(sym symmetry/compute_symmetry_sassy.cpp)
elseif(SYM STREQUAL "sbliss")
message(STATUS "Support SYM: sassy+bliss")
set(sym symmetry/compute_symmetry_sassy_bliss.cpp)

# sassy is currently based on bliss, so configure bliss
# configure bliss
set(BUILD_SHARED_LIBS OFF)
set(TMPFLAGS ${CMAKE_C_FLAGS})
set(TMXFLAGS ${CMAKE_CXX_FLAGS})
Expand Down Expand Up @@ -187,28 +187,63 @@ elseif(SYM STREQUAL "nauty")
set(PIC_FLAG "")
endif()
file(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/src/nauty/*)

# add custom command to build the library using configure and make
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a
COMMAND
COMMAND
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/src/nauty &&
cd ${CMAKE_CURRENT_BINARY_DIR}/src/nauty &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/src/nauty/* . &&
./configure &&
make ${PIC_FLAG} nauty.a &&
cp nauty.a ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a
DEPENDS ${files})

# add custom target and library target
add_custom_target(libnauty_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a)
add_library(libnauty STATIC IMPORTED GLOBAL)
add_dependencies(libnauty libnauty_target)
set_target_properties(libnauty PROPERTIES
set_target_properties(libnauty PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a)

set(NAUTY_TARGET libnauty)
set(SYM_LIBRARIES libnauty)
set(SYM_PIC_LIBRARIES libnauty)
elseif(SYM STREQUAL "snauty")
message(STATUS "Support SYM: sassy+nauty")
set(sym symmetry/compute_symmetry_sassy_nauty.cpp)

if(SHARED)
set(PIC_FLAG "CFLAGS='-fPIC'")
else()
set(PIC_FLAG "")
endif()
file(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/src/nauty/*)

# sassy needs C++-17
set(CMAKE_CXX_STANDARD 17)

# add custom command to build the library using configure and make
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a
COMMAND
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/src/nauty &&
cd ${CMAKE_CURRENT_BINARY_DIR}/src/nauty &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/src/nauty/* . &&
./configure &&
make ${PIC_FLAG} nauty.a &&
cp nauty.a ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a
DEPENDS ${files})

# add custom target and library target
add_custom_target(libnauty_target DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a)
add_library(libnauty STATIC IMPORTED GLOBAL)
add_dependencies(libnauty libnauty_target)
set_target_properties(libnauty PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib/libnauty.a)

set(NAUTY_TARGET libnauty)
set(SYM_LIBRARIES libnauty)
set(SYM_PIC_LIBRARIES libnauty)
elseif(SYM STREQUAL "none")
message(STATUS "Support SYM: OFF")
set(sym symmetry/compute_symmetry_none.cpp)
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ e.g., `cmake </path/to/SCIP> -DSOPLEX_DIR=<path/to/SoPlex/build/or/install>`.
| `IPOPT` | `on`, `off` | `IPOPT=[true,false]` | requires IPOPT version >= 3.12.0; specify `IPOPT_DIR` if not found automatically |
| `LAPACK` | `on`, `off` | `LAPACK=[true,false]` | requires Lapack to be installed on the system |
| `LPS` | `spx`, `cpx`, `grb`, `xprs`, ... | `LPS=...` | specify `SOPLEX_DIR`, `CPLEX_DIR`, `MOSEK_DIR`, ... if LP solver is not found automatically |
| `SYM` | `bliss`, `sassy`, `none` | `SYM=[bliss, sassy, none]` | choose symmetry handling |
| `SYM` | `bliss`, `sbliss`, `none`, ... | `SYM=[bliss, sbliss, none]`| choose symmetry handling |
| `WORHP` | `on`, `off` | `WORHP=[true,false]` | should worhp be linked; specify `WORHP_DIR` if not found automatically |
| `ZIMPL` | `on`, `off` | `ZIMPL=[true, false]` | specify `ZIMPL_DIR` if not found automatically |
| `AMPL` | `on`, `off` | `AMPL=[true, false]` | |
Expand Down Expand Up @@ -346,7 +346,7 @@ In your SCIP main directory, enter `make [options]` with the following options:
| `PAPILO=false` | `[false, true]` | to disable or disable the MILP presolver based on the presolving library PaPILO |
| `READLINE=true` | `[true, false]` | to enable or disable readline library for interactive shell |
| `SHARED=false` | `[false, true]` | to suppress or create shared libraries (only Gnu compiler) |
| `SYM=none` | `[none, bliss, sassy]` | to choose method for computing symmetries in mixed nonlinear integer programs |
| `SYM=none` | `[none, bliss, sbliss, nauty, snauty]` | to choose method for computing symmetries in mixed nonlinear integer programs |
| `TPI=none` | `[none, omp, tny]` | to disable the task processing interface or use it with the openmp or tinycthreads interface for concurrent solves |
| `VERBOSE=false` | `[false, true]` | to suppress or display of compiler and linker invocations |
| `WORHP=false` | `[false, true]` | to disable or enable WORHP interface (needs WORHP >= 2.00) |
Expand Down
24 changes: 19 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ LPIINSTMSG += " -> \"libbliss.*.a\" is the path to the BLISS library, e.g., \"<B
LPIINSTMSG += " -> \"libbliss.*.so\" is the path to the BLISS library, e.g., \"<BLISS-path>/libbliss.so\""
endif

SYMOPTIONS += sassy
ifeq ($(SYM),sassy)
SYMOBJ = symmetry/compute_symmetry_sassy.o
SYMOPTIONS += sbliss
ifeq ($(SYM),sbliss)
SYMOBJ = symmetry/compute_symmetry_sassy_bliss.o
SYMOBJFILES = $(addprefix $(LIBOBJDIR)/,$(SYMOBJ))
SYMSRC = $(addprefix $(SRCDIR)/,$(SYMOBJ:.o=.cpp))
ifeq ($(BLISSEXTERNAL),false)
Expand Down Expand Up @@ -427,6 +427,18 @@ LPIINSTMSG += " -> \"libnauty.*.a\" is the path to the Nauty library, e.g., \"<N
endif
endif

SYMOPTIONS += snauty
ifeq ($(SYM),snauty)
FLAGS += -I$(LIBDIR)/include/
SYMOBJ = symmetry/compute_symmetry_sassy_nauty.o
SYMOBJFILES = $(addprefix $(LIBOBJDIR)/,$(SYMOBJ))
SYMSRC = $(addprefix $(SRCDIR)/,$(SYMOBJ:.o=.cpp))
ALLSRC += $(SYMSRC)
SOFTLINKS += $(LIBDIR)/include/nauty
SOFTLINKS += $(LIBDIR)/static/libnauty.$(OSTYPE).$(ARCH).$(COMP).$(STATICLIBEXT)
LPIINSTMSG += "\n -> \"nautyinc\" is the path to the Nauty directory, e.g., \"<Nauty-path>\".\n"
LPIINSTMSG += " -> \"libnauty.*.a\" is the path to the Nauty library, e.g., \"<Nauty-path>/nauty.a\"\n"
endif
#-----------------------------------------------------------------------------
# PaPILO Library
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -1646,14 +1658,16 @@ ifeq ($(COMP),msvc)
endif
endif
ifneq ($(SYM),bliss)
ifneq ($(SYM),sassy)
ifneq ($(SYM),sbliss)
ifneq ($(SYM),nauty)
ifneq ($(SYM),snauty)
ifneq ($(SYM),none)
$(error invalid SYM flag selected: SYM=$(SYM). Possible options are: $(SYMOPTIONS))
endif
endif
endif
endif
endif
ifneq ($(PAPILO),true)
ifneq ($(PAPILO),false)
$(error invalid PAPILO flag selected: PAPILO=$(PAPILO). Possible options are: true false)
Expand Down Expand Up @@ -1712,7 +1726,7 @@ help:
@echo " - IPOPT=<true|false>: Turns support of IPOPT on or off (default)."
@echo " - LAPACK=<true|false>: Link with Lapack (must be installed on the system)."
@echo " - EXPRINT=<cppad|none>: Use CppAD as expressions interpreter (default) or no expressions interpreter."
@echo " - SYM=<none|bliss|nauty|sassy>: To choose type of symmetry handling."
@echo " - SYM=<none|bliss|nauty|sbliss|snauty>: To choose type of symmetry handling."
@echo " - PARASCIP=<true|false>: Build for ParaSCIP (deprecated, use THREADSAFE)."
@echo " - THREADSAFE=<true|false>: Build thread safe."
@echo " - NOBLKMEM=<true|false>: Turn off block memory or on (default)."
Expand Down
9 changes: 7 additions & 2 deletions make/make.project
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ OPT = opt
COMP = gnu
LPS = spx2
TPI = none
SYM = sassy
SYM = sbliss
PAPILO = false
LAPACK = false
STATICLIBEXT = a
Expand Down Expand Up @@ -538,7 +538,7 @@ LIBOBJSUBDIRS += $(LIBOBJDIR)/bliss
endif
endif

ifeq ($(SYM),sassy)
ifeq ($(SYM),sbliss)
ifeq ($(BLISSEXTERNAL),true)
LDFLAGS += $(LINKCC_L)$(SCIPREALPATH)/$(LIBDIR)/$(LIBEXTTYPE) $(LINKCC_l)bliss.$(OSTYPE).$(ARCH).$(COMP)$(LINKLIBSUFFIX)
else
Expand All @@ -556,6 +556,11 @@ LIBOBJSUBDIRS += $(LIBOBJDIR)/nauty
endif
endif

ifeq ($(SYM),snauty)
LDFLAGS += $(LINKCC_L)$(SCIPREALPATH)/$(LIBDIR)/$(LIBEXTTYPE) $(LINKCC_l)nauty.$(OSTYPE).$(ARCH).$(COMP)$(LINKLIBSUFFIX)
CXXFLAGS += $(CXX17FLAG)
endif

#-----------------------------------------------------------------------------
# PaPILO Library
#-----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/**@file compute_symmetry_sassy.c
/**@file compute_symmetry_sassy_bliss.c
* @brief interface for symmetry computations to sassy as a preprocessor to bliss
* @author Marc Pfetsch
*/
Expand Down
Loading

0 comments on commit 9ccd2cf

Please sign in to comment.