Skip to content

Commit f5ae673

Browse files
authored
Merge branch 'latest' into strong-branch-refactor
2 parents 3fadc7c + b58075b commit f5ae673

38 files changed

+236
-152
lines changed

.github/workflows/build-fast.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Configure CMake
1919
shell: bash
2020
working-directory: ${{runner.workspace}}/build
21-
run: cmake $GITHUB_WORKSPACE -DFAST_BUILD=ON -DCMAKE_BUILD_TYPE=RELEASE
21+
run: cmake $GITHUB_WORKSPACE -DFAST_BUILD=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_UNITY_BUILD=ON
2222

2323
- name: Build
2424
working-directory: ${{runner.workspace}}/build
@@ -45,7 +45,7 @@ jobs:
4545
- name: Configure CMake
4646
shell: bash
4747
working-directory: ${{runner.workspace}}/build
48-
run: cmake $GITHUB_WORKSPACE -DFAST_BUILD=ON -DCMAKE_BUILD_TYPE=DEBUG
48+
run: cmake $GITHUB_WORKSPACE -DFAST_BUILD=ON -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_UNITY_BUILD=ON
4949

5050
- name: Build
5151
working-directory: ${{runner.workspace}}/build

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ option(BUILD_CXX "Build C++ library" ON)
7373
message(STATUS "Build C++ library: ${BUILD_CXX}")
7474

7575
option(BUILD_CXX_EXE "Build C++ executable" ON)
76-
message(STATUS "Build C++ library: ${BUILD_CXX_EXE}")
76+
message(STATUS "Build C++ executable: ${BUILD_CXX_EXE}")
7777

7878
option(BUILD_TESTING "Build Tests" ON)
7979

FEATURES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ Forcing column reduction now checks the bound on the column dual rather than whe
66

77
Now handling correctly the case where an infeasible MIP has a feasible relaxation, so no ray is computed fixing [#2415](https://github.com/ERGO-Code/HiGHS/issues/2415)
88

9-
Refactored strong branching to minimise duplicated code
9+
Refactored strong branching to minimize duplicated code
10+
11+
Fixed minor bug exposed by [#2441](https://github.com/ERGO-Code/HiGHS/issues/2441) in Highs::setSolution() for a sparse user solution when the moidel is empty, and only clearing the dual data before solving with modified objective in Highs::multiobjectiveSolve() so that user-supplied solution is not cleared.
12+
1013

app/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if(FAST_BUILD)
2525
endif()
2626

2727
set_target_properties(highs-bin PROPERTIES OUTPUT_NAME highs)
28+
set_target_properties(highs-bin PROPERTIES UNITY_BUILD OFF)
2829

2930
target_compile_features(highs-bin PRIVATE cxx_std_11)
3031
target_link_libraries(highs-bin PRIVATE ${PROJECT_NAMESPACE}::highs)
@@ -78,6 +79,8 @@ else()
7879
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/app>
7980
)
8081

82+
set_target_properties(highs PROPERTIES UNITY_BUILD OFF)
83+
8184
# install the binary
8285
install(TARGETS highs EXPORT highs-targets
8386
RUNTIME)
@@ -87,4 +90,4 @@ endif()
8790
if(EMSCRIPTEN AND EMSCRIPTEN_HTML)
8891
set(CMAKE_EXECUTABLE_SUFFIX ".html")
8992
set_target_properties(highs PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/highs_webdemo_shell.html)
90-
endif()
93+
endif()

check/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ if ((NOT FAST_BUILD OR ALL_TESTS) AND NOT (BUILD_EXTRA_UNIT_ONLY))
106106

107107
add_executable(unit_tests ${TEST_SOURCES})
108108

109+
set_target_properties(unit_tests PROPERTIES UNITY_BUILD OFF)
110+
109111
if (UNIX)
110112
target_compile_options(unit_tests PRIVATE "-Wno-unused-variable")
111113
target_compile_options(unit_tests PRIVATE "-Wno-unused-const-variable")
@@ -258,7 +260,7 @@ if ((NOT FAST_BUILD OR ALL_TESTS) AND NOT (BUILD_EXTRA_UNIT_ONLY))
258260
"lseu\;1120|1119.9999999\;"
259261
"egout\;(568.1007|568.1006999)\;"
260262
"gt2\;21166\;"
261-
"rgn\;82.1999992\;"
263+
"rgn\;82.19999\;"
262264
"bell5\;(8966406.49152|8966406.491519|8966406.49151)\;"
263265
"sp150x300d\;(69|68.9999999)\;"
264266
"p0548\;(8691|8690.9999999)\;"

check/TestMipSolver.cpp

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,6 @@ TEST_CASE("issue-2290", "[highs_test_mip_solver]") {
932932

933933
TEST_CASE("issue-2409", "[highs_test_mip_solver]") {
934934
HighsLp lp;
935-
HighsModelStatus require_model_status;
936-
double optimal_objective;
937935
lp.num_col_ = 2;
938936
lp.num_row_ = 2;
939937
lp.col_cost_ = {-1, 1};
@@ -945,8 +943,8 @@ TEST_CASE("issue-2409", "[highs_test_mip_solver]") {
945943
lp.a_matrix_.index_ = {0, 1, 0, 1};
946944
lp.a_matrix_.value_ = {-1, 1, 1, 1};
947945
lp.integrality_ = {HighsVarType::kContinuous, HighsVarType::kInteger};
948-
require_model_status = HighsModelStatus::kOptimal;
949-
optimal_objective = 0.1;
946+
const HighsModelStatus require_model_status = HighsModelStatus::kOptimal;
947+
const double optimal_objective = 0.1;
950948
Highs highs;
951949
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
952950
if (dev_run) printf("Testing that presolve reduces the problem to empty\n");
@@ -956,12 +954,48 @@ TEST_CASE("issue-2409", "[highs_test_mip_solver]") {
956954

957955
if (dev_run)
958956
printf(
959-
"\nTesting that with presolve the correct optimal objecive is found\n");
957+
"\nTesting that with presolve the correct optimal objective is "
958+
"found\n");
959+
solve(highs, kHighsOnString, require_model_status, optimal_objective);
960+
highs.clearSolver();
961+
if (dev_run)
962+
printf(
963+
"\nTesting that without presolve the correct optimal objective is "
964+
"found\n");
965+
solve(highs, kHighsOffString, require_model_status, optimal_objective);
966+
}
967+
968+
TEST_CASE("issue-2432", "[highs_test_mip_solver]") {
969+
HighsLp lp;
970+
lp.num_col_ = 3;
971+
lp.num_row_ = 3;
972+
lp.col_cost_ = {-93, 25, 17};
973+
lp.col_lower_ = {-100, -100, -100};
974+
lp.col_upper_ = {120, 10, 0};
975+
lp.row_lower_ = {3994.5, -4878.3, -4930};
976+
lp.row_upper_ = {kHighsInf, kHighsInf, kHighsInf};
977+
lp.a_matrix_.start_ = {0, 3, 6, 9};
978+
lp.a_matrix_.index_ = {0, 1, 2, 0, 1, 2, 0, 1, 2};
979+
lp.a_matrix_.value_ = {-89, -0.1, -8.6, -40.7, 77.2, -6.5, -12, -23.7, 72.78};
980+
lp.integrality_ = {HighsVarType::kInteger, HighsVarType::kContinuous,
981+
HighsVarType::kInteger};
982+
const HighsModelStatus require_model_status = HighsModelStatus::kOptimal;
983+
const double optimal_objective = -3777.57124352;
984+
Highs highs;
985+
REQUIRE(highs.passModel(lp) == HighsStatus::kOk);
986+
if (dev_run) printf("Testing that presolve reduces the problem\n");
987+
REQUIRE(highs.presolve() == HighsStatus::kOk);
988+
REQUIRE(highs.getModelPresolveStatus() == HighsPresolveStatus::kReduced);
989+
990+
if (dev_run)
991+
printf(
992+
"\nTesting that with presolve the correct optimal objective is "
993+
"found\n");
960994
solve(highs, kHighsOnString, require_model_status, optimal_objective);
961995
highs.clearSolver();
962996
if (dev_run)
963997
printf(
964-
"\nTesting that without presolve the correct optimal objecive is "
998+
"\nTesting that without presolve the correct optimal objective is "
965999
"found\n");
9661000
solve(highs, kHighsOffString, require_model_status, optimal_objective);
9671001
}

cmake/cpp-highs.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function(highs_cxx_test FILE_NAME)
151151

152152
target_compile_features(${TEST_NAME} PRIVATE cxx_std_11)
153153
target_link_libraries(${TEST_NAME} PRIVATE ${PROJECT_NAMESPACE}::highs)
154+
set_target_properties(${TEST_NAME} PROPERTIES UNITY_BUILD OFF)
154155

155156
# include(GNUInstallDirs)
156157
# if(APPLE)
@@ -197,6 +198,7 @@ function(highs_c_test FILE_NAME)
197198

198199
target_compile_features(${TEST_NAME} PRIVATE cxx_std_11)
199200
target_link_libraries(${TEST_NAME} PRIVATE ${PROJECT_NAMESPACE}::highs)
201+
set_target_properties(${TEST_NAME} PROPERTIES UNITY_BUILD OFF)
200202

201203
# include(GNUInstallDirs)
202204
# if(APPLE)

cmake/sources.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ set(ipx_headers
176176
ipm/ipx/timer.h
177177
ipm/ipx/utils.h)
178178

179+
# redefinition of 'kHighsInf'
180+
set_source_files_properties (../extern/filereaderlp/reader.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
181+
179182
set(highs_sources
180183
../extern/filereaderlp/reader.cpp
181184
interfaces/highs_c_api.cpp

highs/Highs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class Highs {
9090
*/
9191
HighsStatus clearSolver();
9292

93+
/**
94+
* @brief Clear all dual data associated with the model
95+
*/
96+
HighsStatus clearSolverDualData();
97+
9398
/**
9499
* Methods for model input
95100
*/
@@ -1542,6 +1547,12 @@ class Highs {
15421547
// invalidateRanging(), invalidateInfo(), invalidateEkk() and
15431548
// invalidateIis()
15441549
void invalidateSolverData();
1550+
1551+
// Invalidates all solver dual data in Highs class members by calling
1552+
// invalidateModelStatus(), invalidateRanging(), and invalidateInfo()
1553+
//
1554+
// Used when only the objective changes
1555+
void invalidateSolverDualData();
15451556
//
15461557
// Invalidates the model status, solution_ and info_
15471558
void invalidateModelStatusSolutionAndInfo();

highs/ipm/basiclu/lu_list.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef _LU_LIST_H
2+
#define _LU_LIST_H
3+
14
/*
25
* lu_list.h
36
*
@@ -166,3 +169,5 @@ static inline void lu_list_swap(
166169
blink[e2next] = e1;
167170
}
168171
}
172+
173+
#endif

0 commit comments

Comments
 (0)