Skip to content

Commit ebb406a

Browse files
committed
Merge latest into fix-1423
2 parents 3a6d297 + 3d0e800 commit ebb406a

File tree

11 files changed

+229
-17
lines changed

11 files changed

+229
-17
lines changed

.github/workflows/build-intel.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build-intel
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Add oneAPI to apt
12+
shell: bash
13+
run: |
14+
cd /tmp
15+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
16+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
17+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
18+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
19+
20+
- name: Install oneAPI basekit
21+
shell: bash
22+
run: |
23+
sudo apt update
24+
sudo apt install intel-basekit
25+
26+
- name: Check compiler
27+
run: |
28+
source /opt/intel/oneapi/setvars.sh
29+
icpx --version
30+
icx --version
31+
32+
- name: Configure
33+
shell: bash
34+
run: |
35+
source /opt/intel/oneapi/setvars.sh
36+
cmake -S . -B build \
37+
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
38+
-DCMAKE_INSTALL_PREFIX=install \
39+
-DCMAKE_CXX_COMPILER=icpx \
40+
-DCMAKE_C_COMPILER=icx \
41+
-DALL_TESTS=ON \
42+
-DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL" \
43+
44+
- name: Build
45+
shell: bash
46+
run: |
47+
source /opt/intel/oneapi/setvars.sh
48+
cmake --build build --parallel
49+
50+
- name: Test
51+
shell: bash
52+
run: |
53+
source /opt/intel/oneapi/setvars.sh
54+
export SYCL_DEVICE_FILTER=opencl.cpu
55+
ctest --test-dir build --output-on-failure --timeout 300

.github/workflows/valgrind.yml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: valgrind
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
unit_tests:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest]
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install Valgrind
16+
run: sudo apt-get update && sudo apt-get install valgrind
17+
18+
- name: Create Build Environment
19+
run: cmake -E make_directory ${{runner.workspace}}/build
20+
21+
- name: Configure CMake
22+
shell: bash
23+
working-directory: ${{runner.workspace}}/build
24+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DALL_TESTS=ON
25+
26+
- name: Build
27+
working-directory: ${{runner.workspace}}/build
28+
shell: bash
29+
run: |
30+
cmake --build . --parallel
31+
32+
- name: Test
33+
working-directory: ${{runner.workspace}}/build
34+
shell: bash
35+
run: |
36+
valgrind \
37+
--leak-check=full \
38+
--show-leak-kinds=all \
39+
--track-origins=yes \
40+
-s \
41+
./bin/unit_tests \
42+
2>&1 | tee logfile
43+
44+
- name: Check log for Errors
45+
working-directory: ${{runner.workspace}}/build
46+
shell: bash
47+
run: |
48+
cat logfile
49+
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
50+
if grep -q "$OUTPUT" logfile; then
51+
exit 0
52+
fi
53+
exit 1
54+
55+
instance_tests:
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
matrix:
59+
os: [ubuntu-latest]
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Install Valgrind
65+
run: sudo apt-get update && sudo apt-get install valgrind
66+
67+
- name: Create Build Environment
68+
run: cmake -E make_directory ${{runner.workspace}}/build
69+
70+
- name: Configure CMake All
71+
shell: bash
72+
working-directory: ${{runner.workspace}}/build
73+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug -DALL_TESTS=ON
74+
75+
- name: Build All
76+
working-directory: ${{runner.workspace}}/build
77+
shell: bash
78+
run: |
79+
cmake --build . --parallel
80+
81+
- name: Test
82+
working-directory: ${{runner.workspace}}/build
83+
shell: bash
84+
run: |
85+
valgrind \
86+
--leak-check=full \
87+
--show-leak-kinds=all \
88+
--track-origins=yes \
89+
-s \
90+
ctest -E unit.* \
91+
--timeout 1000 \
92+
--output-on-failure \
93+
2>&1 | tee logfile2
94+
95+
- name: Check log for Errors
96+
working-directory: ${{runner.workspace}}/build
97+
shell: bash
98+
run: |
99+
cat logfile2
100+
OUTPUT='ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)'
101+
if grep -q "$OUTPUT" logfile2; then
102+
exit 0
103+
fi
104+
exit 1

FEATURES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ As part of [#2286](https://github.com/ERGO-Code/HiGHS/pull/2286)), the root of t
1616

1717
ZI rounding and shifting MIP primal heuristics have been added (see [#2287](https://github.com/ERGO-Code/HiGHS/pull/2287)). They are off by default, but can be activated by setting the options `mip_heuristic_run_zi_round` and `mip_heuristic_run_shifting` to be true. Options `mip_heuristic_run_rins`, `mip_heuristic_run_rens` and `mip_heuristic_run_root_reduced_cost` to run the RINS, RENS and rootReducedCost heuristics have been added. These are true by default, but setting them to be false can accelerate the MIP solver on easy problems.
1818

19+
Added `Highs_changeRowsBoundsByRange` to C API, fixing [#2296](https://github.com/ERGO-Code/HiGHS/issues/2296))
20+

check/TestCallbacks.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ TEST_CASE("highs-callback-logging", "[highs_callback]") {
295295
highs.startCallback(kCallbackLogging);
296296
highs.readModel(filename);
297297
highs.run();
298-
298+
299299
highs.resetGlobalScheduler(true);
300300
}
301301

@@ -312,7 +312,7 @@ TEST_CASE("highs-callback-solution-basis-logging", "[highs_callback]") {
312312
highs.startCallback(kCallbackLogging);
313313
if (dev_run) highs.writeSolution("", kSolutionStylePretty);
314314
if (dev_run) highs.writeBasis("");
315-
315+
316316
highs.resetGlobalScheduler(true);
317317
}
318318

@@ -329,7 +329,7 @@ TEST_CASE("highs-callback-simplex-interrupt", "[highs_callback]") {
329329
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInterrupt);
330330
REQUIRE(highs.getInfo().simplex_iteration_count >
331331
adlittle_simplex_iteration_limit);
332-
332+
333333
highs.resetGlobalScheduler(true);
334334
}
335335

@@ -346,7 +346,7 @@ TEST_CASE("highs-callback-ipm-interrupt", "[highs_callback]") {
346346
REQUIRE(status == HighsStatus::kWarning);
347347
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInterrupt);
348348
REQUIRE(highs.getInfo().ipm_iteration_count > adlittle_ipm_iteration_limit);
349-
349+
350350
highs.resetGlobalScheduler(true);
351351
}
352352

@@ -362,7 +362,7 @@ TEST_CASE("highs-callback-mip-interrupt", "[highs_callback]") {
362362
REQUIRE(status == HighsStatus::kWarning);
363363
REQUIRE(highs.getModelStatus() == HighsModelStatus::kInterrupt);
364364
REQUIRE(highs.getInfo().objective_function_value > egout_optimal_objective);
365-
365+
366366
highs.resetGlobalScheduler(true);
367367
}
368368

@@ -377,7 +377,7 @@ TEST_CASE("highs-callback-mip-improving", "[highs_callback]") {
377377
highs.startCallback(kCallbackMipImprovingSolution);
378378
highs.readModel(filename);
379379
highs.run();
380-
380+
381381
highs.resetGlobalScheduler(true);
382382
}
383383

@@ -391,7 +391,7 @@ TEST_CASE("highs-callback-mip-data", "[highs_callback]") {
391391
highs.startCallback(kCallbackMipLogging);
392392
highs.readModel(filename);
393393
highs.run();
394-
394+
395395
highs.resetGlobalScheduler(true);
396396
}
397397

@@ -413,7 +413,7 @@ TEST_CASE("highs-callback-mip-solution", "[highs_callback]") {
413413
highs.setCallback(userMipSolutionCallback, p_user_callback_data);
414414
highs.startCallback(kCallbackMipSolution);
415415
highs.run();
416-
416+
417417
highs.resetGlobalScheduler(true);
418418
}
419419

@@ -425,7 +425,7 @@ TEST_CASE("highs-callback-mip-cut-pool", "[highs_callback]") {
425425
highs.setCallback(userMipCutPoolCallback);
426426
highs.startCallback(kCallbackMipGetCutPool);
427427
highs.run();
428-
428+
429429
highs.resetGlobalScheduler(true);
430430
}
431431

@@ -469,6 +469,6 @@ TEST_CASE("highs-callback-mip-user-solution", "[highs_callback]") {
469469
std::max(1.0, std::fabs(objective_function_value0));
470470
REQUIRE(objective_diff < 1e-12);
471471
}
472-
472+
473473
highs.resetGlobalScheduler(true);
474474
}

check/TestIpm.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,5 +162,4 @@ TEST_CASE("test-2087", "[highs_ipm]") {
162162
REQUIRE(first_ipm_iteration_count == h.getInfo().ipm_iteration_count);
163163

164164
h.resetGlobalScheduler(true);
165-
166165
}

check/TestIpx.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "lp_data/HighsStatus.h"
99
#include "parallel/HighsParallel.h"
1010

11+
#include "Highs.h"
12+
1113
// Example for using IPX from its C++ interface. The program solves the Netlib
1214
// problem afiro.
1315

@@ -45,6 +47,7 @@ TEST_CASE("test-ipx", "[highs_ipx]") {
4547
ipx::Parameters parameters;
4648
if (!dev_run) parameters.display = 0;
4749
parameters.highs_logging = false;
50+
parameters.timeless_log = false;
4851
lps.SetParameters(parameters);
4952

5053
// Solve the LP.
@@ -87,4 +90,8 @@ TEST_CASE("test-ipx", "[highs_ipx]") {
8790
REQUIRE(fabs(ipx_col_value[11] - 339.9) < 1);
8891

8992
(void)(info); // surpress unused variable.
93+
94+
// hack to reset global scheduler
95+
Highs h;
96+
h.resetGlobalScheduler(true);
9097
}

check/TestPresolve.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,10 @@ HighsStatus zeroCostColSing() {
258258
assert(status == HighsStatus::kOk);
259259

260260
status = highs.run();
261-
return status;
262261

263262
highs.resetGlobalScheduler(true);
263+
264+
return status;
264265
}
265266

266267
// handled by doubleton equality
@@ -317,9 +318,9 @@ HighsStatus colSingDoubletonEquality() {
317318
assert(status == HighsStatus::kOk);
318319

319320
status = highs.run();
320-
return status;
321321

322322
highs.resetGlobalScheduler(true);
323+
return status;
323324
}
324325

325326
HighsStatus colSingDoubletonInequality() {
@@ -375,9 +376,9 @@ HighsStatus colSingDoubletonInequality() {
375376
assert(status == HighsStatus::kOk);
376377

377378
status = highs.run();
378-
return status;
379379

380380
highs.resetGlobalScheduler(true);
381+
return status;
381382
}
382383

383384
// handled by doubleton equality
@@ -414,9 +415,9 @@ HighsStatus twoColSingDoubletonEquality() {
414415
assert(status == HighsStatus::kOk);
415416

416417
status = highs.run();
417-
return status;
418418

419419
highs.resetGlobalScheduler(true);
420+
return status;
420421
}
421422

422423
// handled by special case.
@@ -454,9 +455,9 @@ HighsStatus twoColSingDoubletonInequality() {
454455

455456
highs.run();
456457
status = highs.run();
457-
return status;
458458

459459
highs.resetGlobalScheduler(true);
460+
return status;
460461
}
461462

462463
// No commas in test case name.
@@ -543,9 +544,9 @@ HighsStatus issue425() {
543544
assert(status == HighsStatus::kOk);
544545

545546
status = highs.run();
546-
return status;
547547

548548
highs.resetGlobalScheduler(true);
549+
return status;
549550
}
550551

551552
TEST_CASE("presolve-issue-425", "[highs_test_presolve]") {

highs/interfaces/highs_c_api.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,14 @@ HighsInt Highs_changeRowBounds(void* highs, const HighsInt row,
928928
return (HighsInt)((Highs*)highs)->changeRowBounds(row, lower, upper);
929929
}
930930

931+
HighsInt Highs_changeRowsBoundsByRange(void* highs, const HighsInt from_row,
932+
const HighsInt to_row,
933+
const double* lower,
934+
const double* upper) {
935+
return (HighsInt)((Highs*)highs)
936+
->changeRowsBounds(from_row, to_row, lower, upper);
937+
}
938+
931939
HighsInt Highs_changeRowsBoundsBySet(void* highs,
932940
const HighsInt num_set_entries,
933941
const HighsInt* set, const double* lower,

highs/interfaces/highs_c_api.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,6 +1671,24 @@ HighsInt Highs_changeColsBoundsByMask(void* highs, const HighsInt* mask,
16711671
HighsInt Highs_changeRowBounds(void* highs, const HighsInt row,
16721672
const double lower, const double upper);
16731673

1674+
/**
1675+
* Change the variable bounds of multiple adjacent rows.
1676+
*
1677+
* @param highs A pointer to the Highs instance.
1678+
* @param from_row The index of the first row whose bound changes.
1679+
* @param to_row The index of the last row whose bound changes.
1680+
* @param lower An array of length [to_row - from_row + 1] with the new
1681+
* lower bounds.
1682+
* @param upper An array of length [to_row - from_row + 1] with the new
1683+
* upper bounds.
1684+
*
1685+
* @returns A `kHighsStatus` constant indicating whether the call succeeded.
1686+
*/
1687+
HighsInt Highs_changeRowsBoundsByRange(void* highs, const HighsInt from_row,
1688+
const HighsInt to_row,
1689+
const double* lower,
1690+
const double* upper);
1691+
16741692
/**
16751693
* Change the bounds of multiple rows given by an array of indices.
16761694
*

0 commit comments

Comments
 (0)