backport from main

* rename swig files .i in .swig
* update constraint_solver and routing
* backport math_opt changes
* move dynamic loading to ortools/third_party_solvers
This commit is contained in:
Corentin Le Molgat
2025-07-23 15:07:49 +02:00
committed by Mizux Seiha
parent 03e2551e61
commit a7f49a2585
202 changed files with 4734 additions and 7260 deletions

View File

@@ -20,7 +20,7 @@ This module determines the SCIP library of the system.
IMPORTED Targets
^^^^^^^^^^^^^^^^
This module defines :prop_tgt:`IMPORTED` target ``SCIP::SCIP``, if
This module defines :prop_tgt:`IMPORTED` target ``SCIP::libscip``, if
SCIP has been found.
Result Variables
@@ -45,6 +45,10 @@ find_package(SCIP QUIET NO_MODULE)
# if we found the SCIP cmake package then we are done.
if(SCIP_FOUND)
find_package_handle_standard_args(SCIP CONFIG_MODE)
if(NOT TARGET SCIP::libscip)
message(WARNING "SCIP::libscip not provided")
add_library(SCIP::libscip ALIAS libscip)
endif()
return()
endif()
@@ -69,15 +73,15 @@ else()
set(SCIP_FOUND TRUE)
endif()
if(SCIP_FOUND AND NOT TARGET SCIP::SCIP)
add_library(SCIP::SCIP UNKNOWN IMPORTED)
if(SCIP_FOUND AND NOT TARGET SCIP::libscip)
add_library(SCIP::libscip UNKNOWN IMPORTED)
set_target_properties(SCIP::SCIP PROPERTIES
set_target_properties(SCIP::libscip PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SCIP_ROOT}/include")
if(APPLE)
set(SCIP_ARCH darwin.x86_64.gnu.opt)
set_property(TARGET SCIP::SCIP PROPERTY IMPORTED_LOCATION
set_property(TARGET SCIP::libscip PROPERTY IMPORTED_LOCATION
-force_load
${SCIP_ROOT}/lib/libscip.a
${SCIP_ROOT}/lib/libscipopt.a
@@ -86,14 +90,14 @@ if(SCIP_FOUND AND NOT TARGET SCIP::SCIP)
)
elseif(UNIX)
set(SCIP_ARCH linux.x86_64.gnu.opt)
set_property(TARGET SCIP::SCIP PROPERTY IMPORTED_LOCATION
set_property(TARGET SCIP::libscip PROPERTY IMPORTED_LOCATION
${SCIP_ROOT}/lib/libscip.a
${SCIP_ROOT}/lib/libscipopt.a
${SCIP_ROOT}/lib/libsoplex.a
${SCIP_ROOT}/lib/libsoplex.${SCIP_ARCH}.a
)
elseif(MSVC)
set_property(TARGET SCIP::SCIP PROPERTY IMPORTED_LOCATION
set_property(TARGET SCIP::libscip PROPERTY IMPORTED_LOCATION
${SCIP_ROOT}/lib/scip.lib
${SCIP_ROOT}/lib/soplex.lib
ignore:4006

View File

@@ -518,12 +518,12 @@ foreach(SUBPROJECT IN ITEMS
${GUROBI_DIR}
${PDLP_DIR}
sat
xpress
lp_data
packing
scheduling
set_cover
port
third_party_solvers
util)
add_subdirectory(ortools/${SUBPROJECT})
#target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_${SUBPROJECT})

View File

@@ -20,6 +20,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
endif()
# Will need swig
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
set(CMAKE_SWIG_FLAGS)
find_package(SWIG REQUIRED)
include(UseSWIG)

View File

@@ -20,6 +20,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
endif()
# Will need swig
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
set(CMAKE_SWIG_FLAGS)
find_package(SWIG REQUIRED)
include(UseSWIG)

View File

@@ -23,6 +23,7 @@ if(NOT TARGET ${PROJECT_NAMESPACE}::ortools)
endif()
# Will need swig
set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig")
set(CMAKE_SWIG_FLAGS)
find_package(SWIG REQUIRED)
include(UseSWIG)
@@ -378,7 +379,6 @@ if(BUILD_MATH_OPT)
ortools/math_opt/python/errors.py
ortools/math_opt/python/expressions.py
ortools/math_opt/python/from_model.py
ortools/math_opt/python/hash_model_storage.py
ortools/math_opt/python/indicator_constraints.py
ortools/math_opt/python/init_arguments.py
ortools/math_opt/python/linear_constraints.py
@@ -386,7 +386,6 @@ if(BUILD_MATH_OPT)
ortools/math_opt/python/message_callback.py
ortools/math_opt/python/model.py
ortools/math_opt/python/model_parameters.py
ortools/math_opt/python/model_storage.py
ortools/math_opt/python/normalized_inequality.py
ortools/math_opt/python/normalize.py
ortools/math_opt/python/objectives.py
@@ -414,7 +413,6 @@ if(BUILD_MATH_OPT)
endif()
file(COPY
ortools/sat/python/cp_model.py
ortools/sat/python/cp_model_numbers.py
DESTINATION ${PYTHON_PROJECT_DIR}/sat/python)
file(COPY
ortools/sat/colab/flags.py

View File

@@ -13,6 +13,7 @@
# limitations under the License.
"""Sample to test or-tools installation."""
import ortools
# from ortools.algorithms import knapsack_solver

View File

@@ -96,6 +96,10 @@ endif()
if(USE_SCIP)
if(NOT BUILD_SCIP AND NOT TARGET SCIP::libscip)
find_package(SCIP REQUIRED)
if(TARGET libscip AND NOT TARGET SCIP::libscip)
message(WARNING "SCIP::libscip not provided")
add_library(SCIP::libscip ALIAS libscip)
endif()
endif()
endif()