Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmake/cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -532,7 +531,6 @@ foreach(SUBPROJECT IN ITEMS
linear_solver
bop
glop
${GLPK_DIR}
${GUROBI_DIR}
${PDLP_DIR}
sat
Expand All @@ -550,6 +548,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)
Expand Down
2 changes: 1 addition & 1 deletion ortools/linear_solver/glpk_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions ortools/math_opt/solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions ortools/math_opt/solvers/glpk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions ortools/math_opt/solvers/glpk/rays.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions ortools/math_opt/solvers/glpk_solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading