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
4 changes: 2 additions & 2 deletions .github/workflows/macos-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: macOS unit
on:
push:
branches:
- master
#- develop
- main
- develop
pull_request:
branches:
- '**'
Expand Down
34 changes: 17 additions & 17 deletions .github/workflows/ubuntu-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Ubuntu unit
on:
push:
branches:
- master
#- develop
- main
- develop
pull_request:
branches:
- '**'
Expand All @@ -30,24 +30,24 @@ jobs:
- CC: gcc-13
CXX: g++-13
compiler: gcc-13 g++-13
- CC: clang-12
CXX: clang++-12
compiler: clang-12
- CC: clang-13
CXX: clang++-13
compiler: clang-13
- CC: clang-14
CXX: clang++-14
compiler: clang-14
# - CC: clang-12 -> error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression
# CXX: clang++-12
# compiler: clang-12
# - CC: clang-13
# CXX: clang++-13
# compiler: clang-13
# - CC: clang-14
# CXX: clang++-14
# compiler: clang-14
- CC: clang-15
CXX: clang++-15
compiler: clang-15
- CC: clang-16
CXX: clang++-16
compiler: clang-16
- CC: clang-17
CXX: clang++-17
compiler: clang-17
# - CC: clang-16 -> we don't have these as package.
# CXX: clang++-16
# compiler: clang-16
# - CC: clang-17
# CXX: clang++-17
# compiler: clang-17
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Windows unit
on:
push:
branches:
- master
#- develop
- main
- develop
pull_request:
branches:
- '**'
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This changelog contains a non-exhaustive list of new features and notable bug-fi

## New features
* OSQP support is removed.
* Simplex method is added.
* HiGHS solver is added.


Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ project(DTWC++ VERSION "0.0.4"


set(DTWC_ENABLE_GUROBI ON)
include(cmake/Dependencies.cmake) # Include external projects
include(cmake/FindGUROBI.cmake)
# include(cmake/ProjectOptions.cmake)
include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
include(cmake/Dependencies.cmake) # Include external projects
dtwc_setup_dependencies()


Expand All @@ -43,7 +43,7 @@ target_compile_features(project_options INTERFACE cxx_std_20)

enable_testing()

add_subdirectory(dtwc)
add_subdirectory(dtwc bin)



Expand Down
6 changes: 3 additions & 3 deletions cmake/Coverage.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
option (DTWC_ENABLE_COVERAGE "Enable coverage reporting for GCC or Clang" OFF)
# Setup macro for coverage testing for GCC or Clang
macro(add_executable_with_coverage_and_test TARGET_NAME CPP_FILE_NAME)
add_executable(${TARGET_NAME} ${CPP_FILE_NAME})
macro(add_executable_with_coverage_and_test TARGET_NAME)
add_executable(${TARGET_NAME} "${TARGET_NAME}.cpp")
target_link_libraries(${TARGET_NAME} PRIVATE dtwc++ Catch2::Catch2WithMain)
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME})
add_test(NAME ${TARGET_NAME} COMMAND ${TARGET_NAME} WORKING_DIRECTORY bin)
if (DTWC_ENABLE_COVERAGE)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
message (STATUS "Configuring with coverage")
Expand Down
66 changes: 33 additions & 33 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This cmake file is to add external dependency projects.
# Adapted from https://github.com/cpp-best-practices/cmake_template/tree/main
# Adapted from https://github.com/cpp-best-practices/cmake_tecomplate/tree/main
include(cmake/CPM.cmake)

# Done as a function so that updates to variables like
Expand All @@ -10,35 +10,37 @@ function(dtwc_setup_dependencies)
# For each dependency, see if it's
# already been provided to us by a parent project

if(NOT TARGET range-v3) # Range-v3 library:
CPMAddPackage(
NAME range-v3
URL "https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz"
DOWNLOAD_ONLY YES
)
# if(NOT TARGET range-v3) # Range-v3 library:
# CPMAddPackage(
# NAME range-v3
# URL "https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz"
# DOWNLOAD_ONLY YES
# )

if(range-v3_ADDED)
add_library(range-v3 INTERFACE IMPORTED)
target_include_directories(range-v3 INTERFACE ${range-v3_SOURCE_DIR}/include)
endif()
endif()
# if(range-v3_ADDED)
# add_library(range-v3 INTERFACE IMPORTED)
# target_include_directories(range-v3 INTERFACE ${range-v3_SOURCE_DIR}/include)
# endif()
# endif()


if(NOT TARGET eigen) # Eigen library:
CPMAddPackage(
NAME eigen
URL "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"
DOWNLOAD_ONLY YES
)
# if(NOT TARGET eigen) # Eigen library:
# CPMAddPackage(
# NAME eigen
# URL "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz"
# DOWNLOAD_ONLY YES
# )

add_library(eigen INTERFACE IMPORTED)
target_include_directories(eigen SYSTEM INTERFACE ${eigen_SOURCE_DIR})
endif()
# add_library(eigen INTERFACE IMPORTED)
# target_include_directories(eigen SYSTEM INTERFACE ${eigen_SOURCE_DIR})
# endif()

if(NOT TARGET Catch2::Catch2WithMain) # Catch2 library:
CPMAddPackage(
NAME Catch2
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz"
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.3.2.tar.gz"
OPTIONS
"CATCH_INSTALL_DOCS OFF" "CATCH_INSTALL_EXTRAS OFF" "CATCH_BUILD_TESTING OFF"
)
endif()

Expand All @@ -50,17 +52,15 @@ function(dtwc_setup_dependencies)
)
endif()

# HiGHS library:
if(NOT TARGET highs::highs)# HiGHS library:
include(FetchContent)

FetchContent_Declare(
highs
GIT_REPOSITORY "https://github.com/ERGO-Code/HiGHS.git"
GIT_TAG "bazel"
)
set(FAST_BUILD ON CACHE INTERNAL "Fast Build")

FetchContent_MakeAvailable(highs)

CPMAddPackage(
NAME highs
URL "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.6.0.tar.gz"
SYSTEM
EXCLUDE_FROM_ALL
OPTIONS
"FAST_BUILD ON" "BUILD_TESTING OFF" "BUILD_EXAMPLES OFF")
endif()

endfunction()
8 changes: 4 additions & 4 deletions cmake/StandardProjectSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ run_vcvarsall()
message(STATUS "Host system: ${CMAKE_HOST_SYSTEM}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin/RelWithDebInfo)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin/MinSizeRel)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/bin/RelWithDebInfo)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/bin/MinSizeRel)
4 changes: 2 additions & 2 deletions develop/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
- [ ] dtwclust in R
- [ ] Encapsulating Data and related functions in one folder.
- [ ] Open-source solver addition.
- [ ] Simplex is added.
- [ ] HiGHS is added.
- [ ] Simplex is added. -> temporarily removed.
- [x] HiGHS is added.
- [x] Exploration of totally unimodular matrices. -> Not totally unimodular.
- [ ] Creating DTW objects taking distance/band as a policy-based design
- [x] Doxygen website?
Expand Down
8 changes: 3 additions & 5 deletions dtwc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
add_subdirectory(solver)

add_library(dtwc++ STATIC)

Expand All @@ -16,9 +15,8 @@ target_link_libraries(dtwc++
PRIVATE
project_warnings
project_options
solvers
eigen
range-v3
# eigen
# range-v3
fmt
highs::highs
)
Expand All @@ -33,7 +31,7 @@ if(DTWC_ENABLE_GUROBI)
endif()


target_include_directories(dtwc++ PRIVATE ${HIGHS_INCLUDE_DIRS} ${range-v3_INCLUDE_DIRS})
target_include_directories(dtwc++ PRIVATE ${range-v3_INCLUDE_DIRS} )
target_compile_definitions(dtwc++ PRIVATE ROOT_FOLDER="${PROJECT_SOURCE_DIR}")

add_executable(dtwc_main
Expand Down
6 changes: 0 additions & 6 deletions dtwc/Problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,6 @@ void Problem::init_Kmeanspp()
void Problem::cluster_by_MIP()
{
MIP_clustering_byHiGHS(*this);
// MIP_clustering_byDenseSimplex(*this);
// MIP_clustering_bySparseSimplex(*this);

// if (settings::is_relaxed)
// MIP_clustering_byGurobi_relaxed(*this);
// else
// MIP_clustering_byGurobi(*this);
}

Expand Down
2 changes: 2 additions & 0 deletions dtwc/fileOperations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <utility> // for pair
#include <vector> // for vector
#include <fstream>
#include <string>
#include <sstream>

namespace dtwc {

Expand Down
15 changes: 1 addition & 14 deletions dtwc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,8 @@

#include <iostream>


#include "solver/EqualityConstraints.hpp"
#include "solver/test.hpp"

int main()
{
// auto [eq, c] = dtwc::solver::get_prob_small();

// dtwc::solver::SparseSimplex prob_small(eq, c);

// prob_small.gomoryAlgorithm();
// auto [solution_small, copt_small] = prob_small.getResults();

// fmt::println("Solution: {} and Copt = [{}]\n", solution_small, copt_small);

// Here are some examples. You can either take the contents of example functions into main or modify and run them.
dtwc::Clock clk; // Create a clock object

Expand Down Expand Up @@ -78,7 +65,7 @@ int main()

// std::cout << "Finished all tasks " << clk << "\n";

dtwc::benchmarks::run_all();
// dtwc::benchmarks::run_all();

std::cout << "Finished all tasks " << clk << "\n";
}
35 changes: 1 addition & 34 deletions dtwc/mip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
*/

#include "Data.hpp" // for Data
#include "sparse_util.hpp" // for Triplet, RowMajor
#include "types/types.hpp" // for Triplet, RowMajor
#include "mip.hpp"
#include "Problem.hpp"
#include "settings.hpp"
#include "timing.hpp"
#include "solver/Simplex.hpp"
#include "solver/SparseSimplex.hpp"

#include <fmt/core.h>
#include <fmt/ranges.h>
Expand Down Expand Up @@ -54,37 +52,6 @@ void extract_solution(Problem &prob, auto &solution)
}
}

template <typename T>
void MIP_clustering_bySimplex(Problem &prob)
{
std::cout << "Simplex is being called!" << std::endl;
dtwc::Clock clk; // Create a clock object

prob.clear_clusters();

thread_local auto simplexSolver = T(prob);

std::cout << "Problem formulation finished in " << clk << '\n';
simplexSolver.gomoryAlgorithm();
std::cout << "Problem solution finished in " << clk << '\n';

auto [solution, copt] = simplexSolver.getResults();

fmt::println("Solution: {} and Copt = [{}]\n", solution, copt);

extract_solution(prob, solution);
}

void MIP_clustering_bySparseSimplex(Problem &prob)
{
MIP_clustering_bySimplex<dtwc::solver::SparseSimplex>(prob);
}

void MIP_clustering_byDenseSimplex(Problem &prob)
{
MIP_clustering_bySimplex<dtwc::solver::Simplex>(prob);
}

void MIP_clustering_byHiGHS(Problem &prob)
{
std::cout << "HiGS is being called!" << std::endl;
Expand Down
4 changes: 0 additions & 4 deletions dtwc/mip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ namespace dtwc {
class Problem;

void MIP_clustering_byGurobi(Problem &prob);
void MIP_clustering_byGurobi_relaxed(Problem &prob);

void MIP_clustering_bySparseSimplex(Problem &prob);
void MIP_clustering_byDenseSimplex(Problem &prob);

void MIP_clustering_byHiGHS(Problem &prob);

Expand Down
Loading