Skip to content

Commit a3ccd3f

Browse files
committed
Merge branch 'latest' into data-races-10
2 parents 104266b + 3d0e800 commit a3ccd3f

File tree

7 files changed

+96
-12
lines changed

7 files changed

+96
-12
lines changed

.github/workflows/valgrind.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,25 @@ jobs:
3232
- name: Test
3333
working-directory: ${{runner.workspace}}/build
3434
shell: bash
35-
run: valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./bin/unit_tests
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
3654
3755
instance_tests:
3856
runs-on: ${{ matrix.os }}
@@ -63,4 +81,24 @@ jobs:
6381
- name: Test
6482
working-directory: ${{runner.workspace}}/build
6583
shell: bash
66-
run: valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ctest -E unit.* --timeout 1000 --output-on-failure
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
}

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
*

highs/interfaces/highs_csharp_api.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ private static extern int Highs_addCols(
416416
[DllImport(highslibname)]
417417
private static extern int Highs_changeRowBounds(IntPtr highs, int row, double lower, double upper);
418418

419+
[DllImport(highslibname)]
420+
private static extern int Highs_changeRowsBoundsByRange(IntPtr highs, int from_row, int to_row, double[] lower, double[] upper);
421+
419422
[DllImport(highslibname)]
420423
private static extern int Highs_changeRowsBoundsBySet(IntPtr highs, int num_set_entries, int[] set, double[] lower, double[] upper);
421424

@@ -914,6 +917,11 @@ public HighsStatus changeRowBounds(int row, double lower, double upper)
914917
return (HighsStatus)HighsLpSolver.Highs_changeRowBounds(this.highs, row, lower, upper);
915918
}
916919

920+
public HighsStatus changeRowsBoundsByRange(int from, int to, double[] lower, double[] upper)
921+
{
922+
return (HighsStatus)HighsLpSolver.Highs_changeRowsBoundsByRange(this.highs, from, to, lower, upper);
923+
}
924+
917925
public HighsStatus changeRowsBoundsBySet(int[] rows, double[] lower, double[] upper)
918926
{
919927
return (HighsStatus)HighsLpSolver.Highs_changeRowsBoundsBySet(this.highs, rows.Length, rows, lower, upper);

highs/interfaces/highs_fortran_api.f90

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,16 @@ function Highs_changeRowBounds (h, row, lo, up) result(s) bind(c, name='Highs_ch
572572
integer(c_int) :: s
573573
end function Highs_changeRowBounds
574574

575+
function Highs_changeRowsBoundsByRange (h, from, to, lo, up) result(s) bind(c, name='Highs_changeRowsBoundsByRange')
576+
use iso_c_binding
577+
type(c_ptr), VALUE :: h
578+
integer(c_int), VALUE :: from
579+
integer(c_int), VALUE :: to
580+
real(c_double) :: lo(*)
581+
real(c_double) :: up(*)
582+
integer(c_int) :: s
583+
end function Highs_changeRowsBoundsByRange
584+
575585
function Highs_changeRowsBoundsBySet (h, nse, set, lo, up) result(s) bind(c, name='Highs_changeRowsBoundsBySet')
576586
use iso_c_binding
577587
type(c_ptr), VALUE :: h

0 commit comments

Comments
 (0)