mirror of https://github.com/CGAL/cgal
find GLPK
- added FindGLPK.cmake - try to find SCIP first. If not, try to find GLPK
This commit is contained in:
parent
b12d59dc4e
commit
010f05dfeb
|
|
@ -0,0 +1,30 @@
|
||||||
|
# This file sets up GLPK for CMake. Once done this will define
|
||||||
|
# GLPK_FOUND - system has GLPK lib
|
||||||
|
# GLPK_INCLUDE_DIR - the GLPK include directory
|
||||||
|
# GLPK_LIBRARIES - Link these to use GLPK
|
||||||
|
|
||||||
|
|
||||||
|
# Is it already configured?
|
||||||
|
if (NOT GLPK_FOUND)
|
||||||
|
|
||||||
|
# first look in user defined locations
|
||||||
|
find_path(GLPK_INCLUDE_DIR
|
||||||
|
NAMES glpk.h
|
||||||
|
PATHS /usr/local/include/LASlib/
|
||||||
|
ENV GLPK_INC_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(GLPK_LIBRARIES
|
||||||
|
NAMES libglpk
|
||||||
|
PATHS ENV LD_LIBRARY_PATH
|
||||||
|
ENV LIBRARY_PATH
|
||||||
|
/usr/local/lib
|
||||||
|
${GLPK_INCLUDE_DIR}/../lib
|
||||||
|
ENV GLPK_LIB_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
if(GLPK_LIBRARIES AND GLPK_INCLUDE_DIR)
|
||||||
|
set(GLPK_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
@ -31,22 +31,7 @@ if ( NOT Boost_FOUND )
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package( SCIP )
|
|
||||||
|
|
||||||
if ( NOT SCIP_FOUND )
|
|
||||||
|
|
||||||
message(STATUS "This project requires the SCIP library, and will not be compiled.")
|
|
||||||
|
|
||||||
return()
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# include for local directory
|
|
||||||
|
|
||||||
# include for local package
|
|
||||||
include_directories( BEFORE ../../include )
|
include_directories( BEFORE ../../include )
|
||||||
include_directories( BEFORE ${SCIP_INCLUDE_DIRS} )
|
|
||||||
|
|
||||||
# Creating entries for all C++ files with "main" routine
|
# Creating entries for all C++ files with "main" routine
|
||||||
# ##########################################################
|
# ##########################################################
|
||||||
|
|
@ -57,6 +42,39 @@ create_single_source_cgal_program( "polyfit_example_without_input_planes.cpp" )
|
||||||
create_single_source_cgal_program( "polyfit_example_user_provided_planes.cpp" )
|
create_single_source_cgal_program( "polyfit_example_user_provided_planes.cpp" )
|
||||||
create_single_source_cgal_program( "polyfit_example_model_complexty_control.cpp" )
|
create_single_source_cgal_program( "polyfit_example_model_complexty_control.cpp" )
|
||||||
|
|
||||||
target_link_libraries( polyfit_example_without_input_planes PRIVATE ${SCIP_LIBRARIES} )
|
|
||||||
target_link_libraries( polyfit_example_user_provided_planes PRIVATE ${SCIP_LIBRARIES} )
|
find_package( SCIP )
|
||||||
target_link_libraries( polyfit_example_model_complexty_control PRIVATE ${SCIP_LIBRARIES} )
|
|
||||||
|
if ( NOT SCIP_FOUND )
|
||||||
|
find_package( GLPK )
|
||||||
|
|
||||||
|
if ( NOT GLPK_FOUND )
|
||||||
|
message(STATUS "This project requires either SCIP or GLPK, and will not be compiled. "
|
||||||
|
"Please proivde either 'SCIP_DIR' or 'GLPK_INCLUDE_DIR' and 'GLPK_LIBRARIES'")
|
||||||
|
else()
|
||||||
|
add_compile_definitions(CGAL_USE_GLPK)
|
||||||
|
|
||||||
|
include_directories( BEFORE ${GLPK_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
target_link_libraries( polyfit_example_without_input_planes PRIVATE ${GLPK_LIBRARIES} )
|
||||||
|
target_link_libraries( polyfit_example_user_provided_planes PRIVATE ${GLPK_LIBRARIES} )
|
||||||
|
target_link_libraries( polyfit_example_model_complexty_control PRIVATE ${GLPK_LIBRARIES} )
|
||||||
|
|
||||||
|
message("GLPK found and used")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
add_compile_definitions(CGAL_USE_SCIP)
|
||||||
|
|
||||||
|
include_directories( BEFORE ${SCIP_INCLUDE_DIRS} )
|
||||||
|
|
||||||
|
target_link_libraries( polyfit_example_without_input_planes PRIVATE ${SCIP_LIBRARIES} )
|
||||||
|
target_link_libraries( polyfit_example_user_provided_planes PRIVATE ${SCIP_LIBRARIES} )
|
||||||
|
target_link_libraries( polyfit_example_model_complexty_control PRIVATE ${SCIP_LIBRARIES} )
|
||||||
|
|
||||||
|
message("SCIP found and used")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,18 @@
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Polygonal_surface_reconstruction.h>
|
#include <CGAL/Polygonal_surface_reconstruction.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
#elif defined(CGAL_USE_GLPK)
|
||||||
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -16,8 +27,6 @@ typedef Kernel::Vector_3 Vector;
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
|
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
|
||||||
|
|
||||||
// Point with normal, and plane index
|
// Point with normal, and plane index
|
||||||
typedef boost::tuple<Point, Vector, int> PNI;
|
typedef boost::tuple<Point, Vector, int> PNI;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
|
|
@ -131,3 +140,14 @@ int main()
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::cerr << "This test requires either GLPK or SCIP.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,18 @@
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Polygonal_surface_reconstruction.h>
|
#include <CGAL/Polygonal_surface_reconstruction.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
#elif defined(CGAL_USE_GLPK)
|
||||||
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -22,8 +33,6 @@ typedef CGAL::Nth_of_tuple_property_map<0, PNI> Point_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
typedef CGAL::Nth_of_tuple_property_map<1, PNI> Normal_map;
|
||||||
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
typedef CGAL::Nth_of_tuple_property_map<2, PNI> Plane_index_map;
|
||||||
|
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following example shows the reconstruction using user-provided
|
* The following example shows the reconstruction using user-provided
|
||||||
* planar segments stored in PLY format. In the PLY format, a property
|
* planar segments stored in PLY format. In the PLY format, a property
|
||||||
|
|
@ -94,3 +103,14 @@ int main()
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::cerr << "This test requires either GLPK or SCIP.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,22 @@
|
||||||
#include <CGAL/Surface_mesh.h>
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
#include <CGAL/Shape_detection/Efficient_RANSAC.h>
|
||||||
#include <CGAL/Polygonal_surface_reconstruction.h>
|
#include <CGAL/Polygonal_surface_reconstruction.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
|
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
|
#elif defined(CGAL_USE_GLPK)
|
||||||
|
|
||||||
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
#include <CGAL/Timer.h>
|
#include <CGAL/Timer.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
@ -32,8 +47,6 @@ typedef CGAL::Shape_detection::Point_to_shape_index_map<Traits> Point_to_sha
|
||||||
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
typedef CGAL::Polygonal_surface_reconstruction<Kernel> Polygonal_surface_reconstruction;
|
||||||
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
typedef CGAL::Surface_mesh<Point> Surface_mesh;
|
||||||
|
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This example first extracts planes from the input point cloud
|
* This example first extracts planes from the input point cloud
|
||||||
* (using RANSAC with default parameters) and then reconstructs
|
* (using RANSAC with default parameters) and then reconstructs
|
||||||
|
|
@ -135,3 +148,14 @@ int main()
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::cerr << "This test requires either GLPK or SCIP.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
|
||||||
|
|
@ -45,32 +45,39 @@ include( CGAL_CreateSingleSourceCGALProgram )
|
||||||
|
|
||||||
create_single_source_cgal_program( "polygonal_surface_reconstruction_test.cpp" )
|
create_single_source_cgal_program( "polygonal_surface_reconstruction_test.cpp" )
|
||||||
|
|
||||||
if ( SCIP_FOUND )
|
find_package( SCIP )
|
||||||
|
|
||||||
|
if (SCIP_FOUND)
|
||||||
|
|
||||||
|
include_directories( BEFORE ${SCIP_INCLUDE_DIRS} )
|
||||||
|
|
||||||
target_link_libraries( polygonal_surface_reconstruction_test PRIVATE ${SCIP_LIBRARIES} )
|
target_link_libraries( polygonal_surface_reconstruction_test PRIVATE ${SCIP_LIBRARIES} )
|
||||||
endif()
|
|
||||||
|
|
||||||
find_path(GLPK_INCLUDE_DIR
|
add_compile_definitions(CGAL_USE_SCIP)
|
||||||
NAMES glpk.h
|
|
||||||
DOC "Path to GLPK headers"
|
|
||||||
)
|
|
||||||
find_library(GLPK_LIBRARIES NAMES GLPK DOC "Path to the GLPK library")
|
|
||||||
|
|
||||||
if(GLPK_LIBRARIES AND GLPK_INCLUDE_DIR)
|
message("SCIP found and used")
|
||||||
set( GLPK_FOUND TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ( NOT SCIP_FOUND )
|
|
||||||
if ( NOT GLPK_FOUND )
|
|
||||||
message(STATUS "This project requires the SCIP library or the GLPK library, and will not be compiled.")
|
|
||||||
target_compile_definitions(polygonal_surface_reconstruction_test PRIVATE SKIP_TEST_USING_GLPK)
|
|
||||||
message("NOTICE: SCIP and GLPK not found")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if ( GLPK_FOUND )
|
find_package( GLPK )
|
||||||
include_directories( BEFORE ${GLPK_INCLUDE_DIR} )
|
|
||||||
target_link_libraries( polygonal_surface_reconstruction_test PRIVATE ${GLPK_LIBRARIES} )
|
if (GLPK_FOUND)
|
||||||
message("GLPK found and used")
|
|
||||||
|
include_directories( BEFORE ${GLPK_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
target_link_libraries( polygonal_surface_reconstruction_test PRIVATE ${GLPK_LIBRARIES} )
|
||||||
|
|
||||||
|
add_compile_definitions(CGAL_USE_GLPK)
|
||||||
|
|
||||||
|
message("GLPK found and used")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (NOT SCIP_FOUND AND NOT GLPK_FOUND)
|
||||||
|
|
||||||
|
message(STATUS "This project requires either SCIP or GLPK, and will not be compiled. "
|
||||||
|
"Please proivde either 'SCIP_DIR' or 'GLPK_INCLUDE_DIR' and 'GLPK_LIBRARIES'")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -8,28 +8,30 @@
|
||||||
// must be present storing the plane index for each point(-1 if the point is
|
// must be present storing the plane index for each point(-1 if the point is
|
||||||
// not assigned to a plane).
|
// not assigned to a plane).
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_GLPK
|
||||||
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> GLPK_Solver;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> SCIP_Solver;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
|
|
||||||
#include <CGAL/Simple_cartesian.h>
|
#include <CGAL/Simple_cartesian.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
#ifndef SKIP_TEST_USING_GLPK
|
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
|
||||||
#endif
|
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
|
||||||
|
|
||||||
#include "polygonal_surface_reconstruction_test_framework.h"
|
#include "polygonal_surface_reconstruction_test_framework.h"
|
||||||
|
|
||||||
|
|
||||||
// kernels:
|
// kernels:
|
||||||
typedef CGAL::Simple_cartesian<double> Cartesian;
|
typedef CGAL::Simple_cartesian<double> Cartesian;
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick;
|
||||||
|
|
||||||
// solvers:
|
|
||||||
#ifndef SKIP_TEST_USING_GLPK
|
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> GLPK_Solver;
|
|
||||||
#endif
|
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> SCIP_Solver;
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -60,7 +62,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef SKIP_TEST_USING_GLPK
|
#ifdef CGAL_USE_GLPK
|
||||||
std::cerr << "\n\t---- Using GLPK solver\n";
|
std::cerr << "\n\t---- Using GLPK solver\n";
|
||||||
|
|
||||||
std::cerr << "\t\t---- using provided planes\n";
|
std::cerr << "\t\t---- using provided planes\n";
|
||||||
|
|
@ -70,6 +72,7 @@ int main(int argc, char* argv[])
|
||||||
reconstruct<Cartesian, GLPK_Solver>(input_file, true);
|
reconstruct<Cartesian, GLPK_Solver>(input_file, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
std::cerr << "\n\t---- Using SCIP solver\n";
|
std::cerr << "\n\t---- Using SCIP solver\n";
|
||||||
|
|
||||||
std::cerr << "\t\t---- using provided planes\n";
|
std::cerr << "\t\t---- using provided planes\n";
|
||||||
|
|
@ -77,7 +80,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
std::cerr << "\t\t---- re-extract planes\n";
|
std::cerr << "\t\t---- re-extract planes\n";
|
||||||
reconstruct<Cartesian, SCIP_Solver>(input_file, true);
|
reconstruct<Cartesian, SCIP_Solver>(input_file, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -85,7 +88,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef SKIP_TEST_USING_GLPK
|
#ifdef CGAL_USE_GLPK
|
||||||
std::cerr << "\n\t---- Using GLPK solver\n";
|
std::cerr << "\n\t---- Using GLPK solver\n";
|
||||||
|
|
||||||
std::cerr << "\t\t---- using provided planes\n";
|
std::cerr << "\t\t---- using provided planes\n";
|
||||||
|
|
@ -95,6 +98,7 @@ int main(int argc, char* argv[])
|
||||||
reconstruct<Epick, GLPK_Solver>(input_file, true);
|
reconstruct<Epick, GLPK_Solver>(input_file, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
std::cerr << "\n\t---- Using SCIP solver\n";
|
std::cerr << "\n\t---- Using SCIP solver\n";
|
||||||
|
|
||||||
std::cerr << "\t\t---- using provided planes\n";
|
std::cerr << "\t\t---- using provided planes\n";
|
||||||
|
|
@ -102,6 +106,17 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
std::cerr << "\t\t---- re-extract planes\n";
|
std::cerr << "\t\t---- re-extract planes\n";
|
||||||
reconstruct<Epick, SCIP_Solver>(input_file, true);
|
reconstruct<Epick, SCIP_Solver>(input_file, true);
|
||||||
|
#endif
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::cerr << "This test requires either GLPK or SCIP.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,41 @@ if ( CGAL_FOUND )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
create_single_source_cgal_program( "diagonalize_matrix.cpp" )
|
create_single_source_cgal_program( "diagonalize_matrix.cpp" )
|
||||||
|
create_single_source_cgal_program( "mixed_integer_program.cpp" )
|
||||||
|
|
||||||
find_package( SCIP )
|
find_package( SCIP )
|
||||||
|
|
||||||
if (SCIP_FOUND)
|
if (SCIP_FOUND)
|
||||||
|
|
||||||
include_directories( BEFORE ${SCIP_INCLUDE_DIRS} )
|
include_directories( BEFORE ${SCIP_INCLUDE_DIRS} )
|
||||||
create_single_source_cgal_program( "mixed_integer_program.cpp" )
|
|
||||||
target_link_libraries( mixed_integer_program PRIVATE ${SCIP_LIBRARIES} )
|
target_link_libraries( mixed_integer_program PRIVATE ${SCIP_LIBRARIES} )
|
||||||
|
|
||||||
|
add_compile_definitions(CGAL_USE_SCIP)
|
||||||
|
|
||||||
|
message("SCIP found and used")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
message(STATUS "The MIP example requires the SCIP library, and will not be compiled.")
|
|
||||||
|
find_package( GLPK )
|
||||||
|
|
||||||
|
if (GLPK_FOUND)
|
||||||
|
|
||||||
|
include_directories( BEFORE ${GLPK_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
target_link_libraries( mixed_integer_program PRIVATE ${GLPK_LIBRARIES} )
|
||||||
|
|
||||||
|
add_compile_definitions(CGAL_USE_GLPK)
|
||||||
|
|
||||||
|
message("GLPK found and used")
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
message(STATUS "This project requires either SCIP or GLPK, and will not be compiled. "
|
||||||
|
"Please proivde either 'SCIP_DIR' or 'GLPK_INCLUDE_DIR' and 'GLPK_LIBRARIES'")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -18,24 +18,27 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if 1 // Uses SCIP
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
|
|
||||||
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
#include <CGAL/SCIP_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::SCIP_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
#else // Uses GLPK
|
#elif defined(CGAL_USE_GLPK)
|
||||||
|
|
||||||
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
#include <CGAL/GLPK_mixed_integer_program_traits.h>
|
||||||
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
typedef CGAL::GLPK_mixed_integer_program_traits<double> MIP_Solver;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
typedef typename MIP_Solver::Variable Variable;
|
typedef typename MIP_Solver::Variable Variable;
|
||||||
typedef typename MIP_Solver::Linear_objective Linear_objective;
|
typedef typename MIP_Solver::Linear_objective Linear_objective;
|
||||||
typedef typename MIP_Solver::Linear_constraint Linear_constraint;
|
typedef typename MIP_Solver::Linear_constraint Linear_constraint;
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
|
@ -96,3 +99,15 @@ int main()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
std::cerr << "This test requires either GLPK or SCIP.\n";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(CGAL_USE_GLPK) || defined(CGAL_USE_SCIP)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <CGAL/Mixed_integer_program_traits.h>
|
#include <CGAL/Mixed_integer_program_traits.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_GLPK
|
||||||
|
|
||||||
#include <glpk.h>
|
#include <glpk.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -292,4 +294,6 @@ namespace CGAL {
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_USE_GLPK
|
||||||
|
|
||||||
#endif // CGAL_GLPK_MIXED_INTEGER_PROGRAM_TRAITS_H
|
#endif // CGAL_GLPK_MIXED_INTEGER_PROGRAM_TRAITS_H
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <CGAL/Mixed_integer_program_traits.h>
|
#include <CGAL/Mixed_integer_program_traits.h>
|
||||||
|
|
||||||
|
#ifdef CGAL_USE_SCIP
|
||||||
|
|
||||||
#include "scip/scip.h"
|
#include "scip/scip.h"
|
||||||
#include "scip/scipdefplugins.h"
|
#include "scip/scipdefplugins.h"
|
||||||
|
|
||||||
|
|
@ -240,4 +242,6 @@ namespace CGAL {
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
|
#endif // CGAL_USE_SCIP
|
||||||
|
|
||||||
#endif // CGAL_SCIP_MIXED_INTEGER_PROGRAM_TRAITS_H
|
#endif // CGAL_SCIP_MIXED_INTEGER_PROGRAM_TRAITS_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue