glpk: move it to third_party_solvers/

This commit is contained in:
Corentin Le Molgat
2025-11-05 16:03:11 +01:00
parent b53c28a6ca
commit f204b720b8
14 changed files with 28 additions and 23 deletions

View File

@@ -79,7 +79,6 @@ if(USE_GLOP)
endif()
if(USE_GLPK)
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_GLPK")
set(GLPK_DIR glpk)
endif()
if(USE_GUROBI)
set(GUROBI_DIR gurobi)
@@ -517,7 +516,6 @@ foreach(SUBPROJECT IN ITEMS
linear_solver
bop
glop
${GLPK_DIR}
${GUROBI_DIR}
${PDLP_DIR}
sat
@@ -534,6 +532,13 @@ foreach(SUBPROJECT IN ITEMS
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_${SUBPROJECT})
endforeach()
if(USE_GLPK)
add_subdirectory(ortools/third_party_solvers/glpk)
#target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_glpk)
target_sources(${PROJECT_NAME} PRIVATE $<TARGET_OBJECTS:${PROJECT_NAME}_glpk>)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_glpk)
endif()
if(BUILD_MATH_OPT)
add_subdirectory(ortools/${MATH_OPT_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_math_opt)

View File

@@ -26,8 +26,8 @@
#include "absl/strings/str_format.h"
#include "ortools/base/logging.h"
#include "ortools/base/timer.h"
#include "ortools/glpk/glpk_env_deleter.h"
#include "ortools/linear_solver/linear_solver.h"
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
extern "C" {
#include "glpk.h"

View File

@@ -442,8 +442,6 @@ cc_library(
"//ortools/base:protoutil",
"//ortools/base:status_macros",
"//ortools/base:sysinfo",
"//ortools/glpk:glpk_env_deleter",
"//ortools/glpk:glpk_formatters",
"//ortools/math_opt:callback_cc_proto",
"//ortools/math_opt:infeasible_subsystem_cc_proto",
"//ortools/math_opt:model_cc_proto",
@@ -464,6 +462,8 @@ cc_library(
"//ortools/math_opt/solvers/glpk:rays",
"//ortools/math_opt/validators:callback_validator",
"//ortools/port:proto_utils",
"//ortools/third_party_solvers/glpk:glpk_env_deleter",
"//ortools/third_party_solvers/glpk:glpk_formatters",
"//ortools/util:solve_interrupter",
"@abseil-cpp//absl/cleanup",
"@abseil-cpp//absl/container:flat_hash_map",

View File

@@ -29,8 +29,8 @@ cc_library(
deps = [
"//ortools/base:logging",
"//ortools/base:status_macros",
"//ortools/glpk:glpk_computational_form",
"//ortools/glpk:glpk_formatters",
"//ortools/third_party_solvers/glpk:glpk_computational_form",
"//ortools/third_party_solvers/glpk:glpk_formatters",
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/status:statusor",

View File

@@ -23,8 +23,8 @@
#include "absl/strings/str_cat.h"
#include "ortools/base/logging.h"
#include "ortools/base/status_macros.h"
#include "ortools/glpk/glpk_computational_form.h"
#include "ortools/glpk/glpk_formatters.h"
#include "ortools/third_party_solvers/glpk/glpk_computational_form.h"
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
namespace operations_research::math_opt {
namespace {

View File

@@ -42,8 +42,6 @@
#include "absl/types/span.h"
#include "ortools/base/protoutil.h"
#include "ortools/base/status_macros.h"
#include "ortools/glpk/glpk_env_deleter.h"
#include "ortools/glpk/glpk_formatters.h"
#include "ortools/math_opt/callback.pb.h"
#include "ortools/math_opt/core/empty_bounds.h"
#include "ortools/math_opt/core/inverted_bounds.h"
@@ -66,6 +64,8 @@
#include "ortools/math_opt/sparse_containers.pb.h"
#include "ortools/math_opt/validators/callback_validator.h"
#include "ortools/port/proto_utils.h"
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
#include "ortools/util/solve_interrupter.h"
namespace operations_research {

View File

@@ -64,8 +64,8 @@
//
// This logic is usually necessary when using advanced APIs that deal with
// indices in the computational form.
#ifndef ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
#define ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
#ifndef ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
#define ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
extern "C" {
#include <glpk.h>
@@ -133,4 +133,4 @@ inline double ComputeFormVarUpperBound(glp_prob* const problem,
} // namespace operations_research
#endif // ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
#endif // ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_

View File

@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ortools/glpk/glpk_env_deleter.h"
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
#include "ortools/base/logging.h"

View File

@@ -11,8 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
#define ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
#ifndef ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_
#define ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_
namespace operations_research {
@@ -27,4 +27,4 @@ void SetupGlpkEnvAutomaticDeletion();
} // namespace operations_research
#endif // ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
#endif // ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_

View File

@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ortools/glpk/glpk_formatters.h"
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
#include <cstddef>
#include <sstream>

View File

@@ -12,8 +12,8 @@
// limitations under the License.
// Formatting functions for GLPK constants.
#ifndef ORTOOLS_GLPK_GLPK_FORMATTERS_H_
#define ORTOOLS_GLPK_GLPK_FORMATTERS_H_
#ifndef ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_FORMATTERS_H_
#define ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_FORMATTERS_H_
#include <cstddef>
#include <string>
@@ -41,4 +41,4 @@ std::string TruncateAndQuoteGLPKName(std::string_view original_name);
} // namespace operations_research
#endif // ORTOOLS_GLPK_GLPK_FORMATTERS_H_
#endif // ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_FORMATTERS_H_

View File

@@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ortools/glpk/glpk_formatters.h"
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
#include <sstream>
#include <string>